Пример #1
0
    def __init__(self,
                 id=None,
                 type=None,
                 attributes=None,
                 text=None,
                 metas=None,
                 namespace=None,
                 nsmap=None):
        XigtContainerMixin.__init__(self, contained_type=Meta)
        XigtAttributeMixin.__init__(self,
                                    id=id,
                                    type=type,
                                    attributes=attributes,
                                    namespace=namespace,
                                    nsmap=nsmap)

        if text is not None:
            metadata_text_warning()
            if metas is not None:
                raise XigtError('text and metas cannot both be specified.')
            if isinstance(text, str):
                warnings.warn(
                    'String values of Metadata are deprecated; '
                    'it will be put in an untyped Meta object.',
                    DeprecationWarning)
                text = [Meta(text=text)]
            metas = text

        self.extend(metas or [])
Пример #2
0
    def __init__(self,
                 id=None,
                 type=None,
                 attributes=None,
                 metadata=None,
                 tiers=None,
                 corpus=None,
                 namespace=None,
                 nsmap=None):
        XigtContainerMixin.__init__(self, contained_type=Tier)
        XigtAttributeMixin.__init__(self,
                                    id=id,
                                    type=type,
                                    attributes=attributes,
                                    namespace=namespace,
                                    nsmap=nsmap)
        XigtMetadataMixin.__init__(self, metadata)

        self._referent_cache = {}
        self._referrer_cache = {}
        self._parent = corpus
        self._itemdict = {}

        self.extend(tiers or [])
        self.refresh_indices()
Пример #3
0
    def __init__(self,
                 id=None,
                 type=None,
                 alignment=None,
                 content=None,
                 segmentation=None,
                 attributes=None,
                 metadata=None,
                 items=None,
                 igt=None,
                 namespace=None,
                 nsmap=None):
        XigtContainerMixin.__init__(self, contained_type=Item)
        XigtAttributeMixin.__init__(self,
                                    id=id,
                                    type=type,
                                    attributes=attributes,
                                    namespace=namespace,
                                    nsmap=nsmap)
        XigtReferenceAttributeMixin.__init__(self,
                                             alignment=alignment,
                                             content=content,
                                             segmentation=segmentation)
        XigtMetadataMixin.__init__(self, metadata)

        self._parent = igt
        self.extend(items or [])
Пример #4
0
    def __init__(
        self, id=None, type=None, attributes=None, text=None, children=None, metadata=None, namespace=None, nsmap=None
    ):
        XigtContainerMixin.__init__(self, contained_type=MetaChild)
        XigtAttributeMixin.__init__(self, id=id, type=type, attributes=attributes, namespace=namespace, nsmap=nsmap)

        self._parent = metadata
        self.text = text
        self.extend(children or [])
Пример #5
0
    def __init__(self, name, attributes=None, text=None, children=None, parent=None, namespace=None, nsmap=None):
        XigtContainerMixin.__init__(self, contained_type=MetaChild)
        XigtAttributeMixin.__init__(self, id=None, type=None, attributes=attributes, namespace=namespace, nsmap=nsmap)

        if not name_re.match(name):
            raise ValueError("Invalid name for MetaChild: {}".format(name))
        self.name = name
        self._parent = parent
        self.text = text
        self.extend(children or [])
Пример #6
0
Файл: model.py Проект: xigt/xigt
 def __init__(self, id=None, type=None, attributes=None, metadata=None,
              igts=None, mode=FULL, namespace=None, nsmap=None):
     XigtContainerMixin.__init__(self, contained_type=Igt)
     XigtAttributeMixin.__init__(
         self, id=id, type=type, attributes=attributes,
         namespace=namespace, nsmap=nsmap
     )
     XigtMetadataMixin.__init__(self, metadata)
     self.mode = mode
     if mode == FULL:
         self.extend(igts or [])
     else:
         self._generator = igts
Пример #7
0
Файл: model.py Проект: xigt/xigt
    def __init__(self, id=None, type=None,
                 alignment=None, content=None, segmentation=None,
                 attributes=None, text=None, tier=None,
                 namespace=None, nsmap=None):
        XigtAttributeMixin.__init__(
            self, id=id, type=type, attributes=attributes,
            namespace=namespace, nsmap=nsmap
        )
        XigtReferenceAttributeMixin.__init__(
            self, alignment=alignment, content=content,
            segmentation=segmentation
        )

        self._parent = tier  # mainly used for alignment expressions
        self.text = text
Пример #8
0
Файл: model.py Проект: xigt/xigt
    def __init__(self, id=None, type=None, attributes=None, metadata=None,
                 tiers=None, corpus=None, namespace=None, nsmap=None):
        XigtContainerMixin.__init__(self, contained_type=Tier)
        XigtAttributeMixin.__init__(
            self, id=id, type=type, attributes=attributes,
            namespace=namespace, nsmap=nsmap
        )
        XigtMetadataMixin.__init__(self, metadata)

        self._referent_cache = {}
        self._referrer_cache = {}
        self._parent = corpus
        self._itemdict = {}

        self.extend(tiers or [])
        self.refresh_indices()
Пример #9
0
Файл: model.py Проект: xigt/xigt
 def __eq__(self, other):
     try:
         return (
             self.text == other.text
             and XigtAttributeMixin.__eq__(self, other)
         )
     except AttributeError:
         return False
Пример #10
0
    def __init__(self, id=None, type=None, attributes=None, text=None, metas=None, namespace=None, nsmap=None):
        XigtContainerMixin.__init__(self, contained_type=Meta)
        XigtAttributeMixin.__init__(self, id=id, type=type, attributes=attributes, namespace=namespace, nsmap=nsmap)

        if text is not None:
            metadata_text_warning()
            if metas is not None:
                raise XigtError("text and metas cannot both be specified.")
            if isinstance(text, str):
                warnings.warn(
                    "String values of Metadata are deprecated; " "it will be put in an untyped Meta object.",
                    DeprecationWarning,
                )
                text = [Meta(text=text)]
            metas = text

        self.extend(metas or [])
Пример #11
0
Файл: model.py Проект: xigt/xigt
    def __init__(self, id=None, type=None,
                 alignment=None, content=None, segmentation=None,
                 attributes=None, metadata=None,
                 items=None, igt=None,
                 namespace=None, nsmap=None):
        XigtContainerMixin.__init__(self, contained_type=Item)
        XigtAttributeMixin.__init__(
            self, id=id, type=type, attributes=attributes,
            namespace=namespace, nsmap=nsmap
        )
        XigtReferenceAttributeMixin.__init__(
            self, alignment=alignment, content=content,
            segmentation=segmentation
        )
        XigtMetadataMixin.__init__(self, metadata)

        self._parent = igt
        self.extend(items or [])
Пример #12
0
 def __eq__(self, other):
     try:
         return (
             self.name == other.name
             and self.text == other.text
             and XigtContainerMixin.__eq__(self, other)
             and XigtAttributeMixin.__eq__(self, other)
         )
     except AttributeError:
         return False
Пример #13
0
    def __init__(self,
                 id=None,
                 type=None,
                 attributes=None,
                 text=None,
                 children=None,
                 metadata=None,
                 namespace=None,
                 nsmap=None):
        XigtContainerMixin.__init__(self, contained_type=MetaChild)
        XigtAttributeMixin.__init__(self,
                                    id=id,
                                    type=type,
                                    attributes=attributes,
                                    namespace=namespace,
                                    nsmap=nsmap)

        self._parent = metadata
        self.text = text
        self.extend(children or [])
Пример #14
0
 def __init__(self,
              id=None,
              type=None,
              attributes=None,
              metadata=None,
              igts=None,
              mode=FULL,
              namespace=None,
              nsmap=None):
     XigtContainerMixin.__init__(self, contained_type=Igt)
     XigtAttributeMixin.__init__(self,
                                 id=id,
                                 type=type,
                                 attributes=attributes,
                                 namespace=namespace,
                                 nsmap=nsmap)
     XigtMetadataMixin.__init__(self, metadata)
     self.mode = mode
     if mode == FULL:
         self.extend(igts or [])
     else:
         self._generator = igts
Пример #15
0
    def __init__(self,
                 name,
                 attributes=None,
                 text=None,
                 children=None,
                 parent=None,
                 namespace=None,
                 nsmap=None):
        XigtContainerMixin.__init__(self, contained_type=MetaChild)
        XigtAttributeMixin.__init__(self,
                                    id=None,
                                    type=None,
                                    attributes=attributes,
                                    namespace=namespace,
                                    nsmap=nsmap)

        if not name_re.match(name):
            raise ValueError('Invalid name for MetaChild: {}'.format(name))
        self.name = name
        self._parent = parent
        self.text = text
        self.extend(children or [])
Пример #16
0
    def __init__(self,
                 id=None,
                 type=None,
                 alignment=None,
                 content=None,
                 segmentation=None,
                 attributes=None,
                 text=None,
                 tier=None,
                 namespace=None,
                 nsmap=None):
        XigtAttributeMixin.__init__(self,
                                    id=id,
                                    type=type,
                                    attributes=attributes,
                                    namespace=namespace,
                                    nsmap=nsmap)
        XigtReferenceAttributeMixin.__init__(self,
                                             alignment=alignment,
                                             content=content,
                                             segmentation=segmentation)

        self._parent = tier  # mainly used for alignment expressions
        self.text = text
Пример #17
0
Файл: model.py Проект: xigt/xigt
 def __eq__(self, other):
     return (
         XigtMetadataMixin.__eq__(self, other)
         and XigtContainerMixin.__eq__(self, other)
         and XigtAttributeMixin.__eq__(self, other)
     )
Пример #18
0
 def __eq__(self, other):
     return XigtContainerMixin.__eq__(self, other) and XigtAttributeMixin.__eq__(self, other)