def __init__(self, config=None, pos=None, **kwargs): super(DataModelType, self).__init__(config=config, pos=pos, **kwargs) ivo_id = kwargs.get('ivo-id', None) if ivo_id is None: warn_or_raise(W26, W26, config=config, pos=pos) self.ivo_id = ivo_id
def parse(self, iterator, config): super(TableAccess, self).parse(iterator, config) if not self.languages: warn_or_raise(W20, W20, config=config, pos=self._pos) if not self.outputformats: warn_or_raise(W21, W21, config=config, pos=self._pos)
def check_datatype_flag(data, config=None, pos=None): """ Checks if the datatype flag is valid """ if data not in ('indexed', 'primary', 'nullable'): warn_or_raise(W04, W04, data, config=config, pos=pos) return False return True
def datatype(self, iterator, tag, data, config, pos): datatype = TableDataType(config, pos, 'dataType', **data) datatype.parse(iterator, config) if self.datatype: warn_or_raise( W37, args=self._Element__name, config=config, pos=pos) self.datatype = datatype
def __init__( self, config=None, pos=None, _name='capability', standardID=None, **kwargs ): if standardID != 'ivo://ivoa.net/std/TAP': warn_or_raise(W19, W19, config=config, pos=pos) super(TAPCapRestriction, self).__init__( config, pos, _name, standardID='ivo://ivoa.net/std/TAP', **kwargs)
def check_anyuri(uri, config=None, pos=None): """ Raises a `~pyvo.io.vosi.tables.exceptions.VOSITablesWarning` if *uri* is not a valid URI. As defined in RFC 2396. """ if uri is not None and not xml_check.check_anyuri(uri): warn_or_raise(W01, W01, uri, config=config, pos=pos) return False return True
def add_complexcontent(iterator, tag, data, config, pos): attr = getattr(self, attr_name) element = cls_(config=config, pos=pos, _name=element_name, **data) if attr and exc_class is not None: warn_or_raise(exc_class, args=element_name, config=config, pos=pos) if isinstance(getattr(self, attr_name, None), list): getattr(self, attr_name).append(element) else: setattr(self, attr_name, element) element.parse(iterator, config)
def add_simplecontent(iterator, tag, data, config, pos): for start, tag, data, pos in iterator: if not start and tag == element_name: attr = getattr(self, attr_name) if attr and exc_class: warn_or_raise( exc_class, args=self._Element__name, config=config, pos=pos) if check_func: check_func(data, config, pos) if data_func: data = data_func(data) if isinstance(getattr(self, attr_name), list): getattr(self, attr_name).append(data) else: setattr(self, attr_name, data or None) break
def size(self, size): if size is not None and int(size) < 0: size = 0 warn_or_raise(W03, W03, config=self._config, pos=self._pos) self._size = size
def parse(self, iterator, config): super(DataLimit, self).parse(iterator, config) if self.unit not in ('byte', 'row'): warn_or_raise(W31, W31, config=config, pos=self._pos)
def parse(self, iterator, config): super(ParamHTTP, self).parse(iterator, config) if len(self.querytypes) > 2: warn_or_raise(W18, W18, config=config, pos=self._pos)
def parse(self, iterator, config): super(TableSet, self).parse(iterator, config) if not self.schemas: warn_or_raise(W14, W14, config=config, pos=self._pos)
def _add_unknown_tag(self, iterator, tag, data, config, pos): if tag != 'xml': warn_or_raise( UnknownElementWarning, UnknownElementWarning, tag, config, pos)