Exemplo n.º 1
0
    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
Exemplo n.º 2
0
    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
Exemplo n.º 3
0
    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)
Exemplo n.º 4
0
    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)
Exemplo n.º 5
0
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
Exemplo n.º 6
0
    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
Exemplo n.º 7
0
    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)
Exemplo n.º 8
0
    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)
Exemplo n.º 9
0
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
Exemplo n.º 10
0
    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)
Exemplo n.º 11
0
    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
Exemplo n.º 12
0
 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
Exemplo n.º 13
0
    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)
Exemplo n.º 14
0
    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)
Exemplo n.º 15
0
    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)
Exemplo n.º 16
0
 def _add_unknown_tag(self, iterator, tag, data, config, pos):
     if tag != 'xml':
         warn_or_raise(
             UnknownElementWarning, UnknownElementWarning, tag, config, pos)
Exemplo n.º 17
0
    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)