mmif-python 0.5.1__tar.gz → 0.5.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mmif-python-0.5.1/mmif_python.egg-info → mmif-python-0.5.2}/PKG-INFO +2 -6
- mmif-python-0.5.2/README.md +3 -0
- mmif-python-0.5.2/VERSION +1 -0
- {mmif-python-0.5.1 → mmif-python-0.5.2}/mmif/serialize/annotation.py +3 -0
- {mmif-python-0.5.1 → mmif-python-0.5.2}/mmif/serialize/model.py +14 -8
- {mmif-python-0.5.1 → mmif-python-0.5.2}/mmif/serialize/view.py +4 -0
- mmif-python-0.5.2/mmif/ver/__init__.py +2 -0
- {mmif-python-0.5.1 → mmif-python-0.5.2/mmif_python.egg-info}/PKG-INFO +2 -6
- mmif-python-0.5.1/README.md +0 -7
- mmif-python-0.5.1/VERSION +0 -1
- mmif-python-0.5.1/mmif/ver/__init__.py +0 -2
- {mmif-python-0.5.1 → mmif-python-0.5.2}/LICENSE +0 -0
- {mmif-python-0.5.1 → mmif-python-0.5.2}/MANIFEST.in +0 -0
- {mmif-python-0.5.1 → mmif-python-0.5.2}/mmif/__init__.py +0 -0
- {mmif-python-0.5.1 → mmif-python-0.5.2}/mmif/res/__init__.py +0 -0
- {mmif-python-0.5.1 → mmif-python-0.5.2}/mmif/res/clams.vocabulary.yaml +0 -0
- {mmif-python-0.5.1 → mmif-python-0.5.2}/mmif/res/do-not-edit.txt +0 -0
- {mmif-python-0.5.1 → mmif-python-0.5.2}/mmif/res/mmif.json +0 -0
- {mmif-python-0.5.1 → mmif-python-0.5.2}/mmif/serialize/__init__.py +0 -0
- {mmif-python-0.5.1 → mmif-python-0.5.2}/mmif/serialize/mmif.py +0 -0
- {mmif-python-0.5.1 → mmif-python-0.5.2}/mmif/ver/do-not-edit.txt +0 -0
- {mmif-python-0.5.1 → mmif-python-0.5.2}/mmif/vocabulary/__init__.py +0 -0
- {mmif-python-0.5.1 → mmif-python-0.5.2}/mmif/vocabulary/annotation_types.py +0 -0
- {mmif-python-0.5.1 → mmif-python-0.5.2}/mmif/vocabulary/base_types.py +0 -0
- {mmif-python-0.5.1 → mmif-python-0.5.2}/mmif/vocabulary/do-not-edit.txt +0 -0
- {mmif-python-0.5.1 → mmif-python-0.5.2}/mmif/vocabulary/document_types.py +0 -0
- {mmif-python-0.5.1 → mmif-python-0.5.2}/mmif_python.egg-info/SOURCES.txt +0 -0
- {mmif-python-0.5.1 → mmif-python-0.5.2}/mmif_python.egg-info/dependency_links.txt +0 -0
- {mmif-python-0.5.1 → mmif-python-0.5.2}/mmif_python.egg-info/requires.txt +0 -0
- {mmif-python-0.5.1 → mmif-python-0.5.2}/mmif_python.egg-info/top_level.txt +0 -0
- {mmif-python-0.5.1 → mmif-python-0.5.2}/requirements.txt +0 -0
- {mmif-python-0.5.1 → mmif-python-0.5.2}/setup.cfg +0 -0
- {mmif-python-0.5.1 → mmif-python-0.5.2}/setup.py +0 -0
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: mmif-python
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.2
|
|
4
4
|
Summary: Python implementation of MultiMedia Interchange Format specification. (https://mmif.clams.ai)
|
|
5
5
|
Home-page: https://mmif.clams.ai
|
|
6
6
|
Author: Brandeis Lab for Linguistics and Computation
|
|
7
7
|
Author-email: admin@clams.ai
|
|
8
8
|
License: UNKNOWN
|
|
9
|
-
Description:
|
|
10
|
-
|
|
11
|
-
**NOTE** that this project is in pre-alpha and being actively developed. Nothing is guaranteed to reliably work for the moment and developer need to be very careful when using APIs implemented here. Please use [the issue track](https://github.com/clamsproject/mmif/issues) to report bugs and malfunctions.
|
|
12
|
-
|
|
13
|
-
## MultiMedia Interchange Format
|
|
9
|
+
Description: ## MultiMedia Interchange Format
|
|
14
10
|
[MMIF](https://mmif.clams.ai) is a JSON(-LD)-based data format designed for transferring annotation data between computational analysis applications in [CLAMS project](https://clams.ai).
|
|
15
11
|
|
|
16
12
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.5.2
|
|
@@ -113,7 +113,10 @@ class Document(Annotation):
|
|
|
113
113
|
:param document_obj: the JSON data that defines the document
|
|
114
114
|
"""
|
|
115
115
|
def __init__(self, doc_obj: Optional[Union[bytes, str, dict]] = None) -> None:
|
|
116
|
+
# to store the parent view ID
|
|
116
117
|
self._parent_view_id = ''
|
|
118
|
+
self.reserved_names.add('_parent_view_id')
|
|
119
|
+
|
|
117
120
|
self._type: Union[ThingTypesBase, DocumentTypesBase] = ThingTypesBase('')
|
|
118
121
|
self.properties: DocumentProperties = DocumentProperties()
|
|
119
122
|
self.disallow_additional_properties()
|
|
@@ -37,7 +37,7 @@ class MmifObject(object):
|
|
|
37
37
|
an actual representation with a JSON formatted string or equivalent
|
|
38
38
|
`dict` object argument.
|
|
39
39
|
|
|
40
|
-
This superclass has
|
|
40
|
+
This superclass has four specially designed instance variables, and these
|
|
41
41
|
variable names cannot be used as attribute names for MMIF objects.
|
|
42
42
|
|
|
43
43
|
1. _unnamed_attributes:
|
|
@@ -54,12 +54,15 @@ class MmifObject(object):
|
|
|
54
54
|
When serialize, an object will skip its *empty* (e.g. zero-length, or None)
|
|
55
55
|
attributes unless they are in this list. Otherwise, the serialized JSON
|
|
56
56
|
string would have empty representations (e.g. ``""``, ``[]``).
|
|
57
|
+
4. _exclude_from_diff:
|
|
58
|
+
This is a simple list of names of attributes that should be excluded from
|
|
59
|
+
the diff calculation in ``__eq__``.
|
|
57
60
|
|
|
58
61
|
# TODO (krim @ 8/17/20): this dict is however, a duplicate with the type hints in the class definition.
|
|
59
62
|
Maybe there is a better way to utilize type hints (e.g. getting them as a programmatically), but for now
|
|
60
63
|
developers should be careful to add types to hints as well as to this dict.
|
|
61
64
|
|
|
62
|
-
Also note that those
|
|
65
|
+
Also note that those special attributes MUST be set in the __init__()
|
|
63
66
|
before calling super method, otherwise deserialization will not work.
|
|
64
67
|
|
|
65
68
|
And also, a subclass that has one or more *named* attributes, it must
|
|
@@ -74,17 +77,15 @@ class MmifObject(object):
|
|
|
74
77
|
an ID value automatically generated, based on its parent object.
|
|
75
78
|
"""
|
|
76
79
|
|
|
77
|
-
reserved_names: Set = {
|
|
80
|
+
reserved_names: Set[str] = {
|
|
78
81
|
'reserved_names',
|
|
79
82
|
'_unnamed_attributes',
|
|
80
83
|
'_attribute_classes',
|
|
81
84
|
'_required_attributes',
|
|
82
|
-
|
|
83
|
-
'_parent_view_id',
|
|
84
|
-
# used in View class to autogenerate annotation ids
|
|
85
|
-
'_id_counts'
|
|
85
|
+
'_exclude_from_diff'
|
|
86
86
|
}
|
|
87
87
|
_unnamed_attributes: Optional[dict]
|
|
88
|
+
_exclude_from_diff: Set[str]
|
|
88
89
|
_attribute_classes: Dict[str, Type] = {} # Mapping: str -> Type
|
|
89
90
|
|
|
90
91
|
def __init__(self, mmif_obj: Optional[Union[bytes, str, dict]] = None) -> None:
|
|
@@ -92,6 +93,8 @@ class MmifObject(object):
|
|
|
92
93
|
mmif_obj = mmif_obj.decode('utf8')
|
|
93
94
|
if not hasattr(self, '_required_attributes'):
|
|
94
95
|
self._required_attributes = []
|
|
96
|
+
if not hasattr(self, '_exclude_from_diff'):
|
|
97
|
+
self._exclude_from_diff = set()
|
|
95
98
|
if not hasattr(self, '_unnamed_attributes'):
|
|
96
99
|
self._unnamed_attributes = {}
|
|
97
100
|
if mmif_obj is not None:
|
|
@@ -253,7 +256,10 @@ class MmifObject(object):
|
|
|
253
256
|
|
|
254
257
|
def __eq__(self, other) -> bool:
|
|
255
258
|
return isinstance(other, type(self)) and \
|
|
256
|
-
len(DeepDiff(self, other, report_repetition=True, exclude_types=[datetime]
|
|
259
|
+
len(DeepDiff(self, other, report_repetition=True, exclude_types=[datetime],
|
|
260
|
+
# https://github.com/clamsproject/mmif-python/issues/214
|
|
261
|
+
exclude_paths=self._exclude_from_diff)
|
|
262
|
+
) == 0
|
|
257
263
|
|
|
258
264
|
def __len__(self) -> int:
|
|
259
265
|
"""
|
|
@@ -31,7 +31,11 @@ class View(MmifObject):
|
|
|
31
31
|
"""
|
|
32
32
|
|
|
33
33
|
def __init__(self, view_obj: Optional[Union[bytes, str, dict]] = None) -> None:
|
|
34
|
+
# used to autogenerate annotation ids
|
|
34
35
|
self._id_counts = {}
|
|
36
|
+
self.reserved_names.add("_id_counts")
|
|
37
|
+
self._exclude_from_diff = {"_id_counts"}
|
|
38
|
+
|
|
35
39
|
self.id: str = ''
|
|
36
40
|
self.metadata: ViewMetadata = ViewMetadata()
|
|
37
41
|
self.annotations: AnnotationsList = AnnotationsList()
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: mmif-python
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.2
|
|
4
4
|
Summary: Python implementation of MultiMedia Interchange Format specification. (https://mmif.clams.ai)
|
|
5
5
|
Home-page: https://mmif.clams.ai
|
|
6
6
|
Author: Brandeis Lab for Linguistics and Computation
|
|
7
7
|
Author-email: admin@clams.ai
|
|
8
8
|
License: UNKNOWN
|
|
9
|
-
Description:
|
|
10
|
-
|
|
11
|
-
**NOTE** that this project is in pre-alpha and being actively developed. Nothing is guaranteed to reliably work for the moment and developer need to be very careful when using APIs implemented here. Please use [the issue track](https://github.com/clamsproject/mmif/issues) to report bugs and malfunctions.
|
|
12
|
-
|
|
13
|
-
## MultiMedia Interchange Format
|
|
9
|
+
Description: ## MultiMedia Interchange Format
|
|
14
10
|
[MMIF](https://mmif.clams.ai) is a JSON(-LD)-based data format designed for transferring annotation data between computational analysis applications in [CLAMS project](https://clams.ai).
|
|
15
11
|
|
|
16
12
|
|
mmif-python-0.5.1/README.md
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
# MMIF for python
|
|
2
|
-
|
|
3
|
-
**NOTE** that this project is in pre-alpha and being actively developed. Nothing is guaranteed to reliably work for the moment and developer need to be very careful when using APIs implemented here. Please use [the issue track](https://github.com/clamsproject/mmif/issues) to report bugs and malfunctions.
|
|
4
|
-
|
|
5
|
-
## MultiMedia Interchange Format
|
|
6
|
-
[MMIF](https://mmif.clams.ai) is a JSON(-LD)-based data format designed for transferring annotation data between computational analysis applications in [CLAMS project](https://clams.ai).
|
|
7
|
-
|
mmif-python-0.5.1/VERSION
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0.5.1
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|