gedcom-x 0.5.5__py3-none-any.whl → 0.5.7__py3-none-any.whl
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.
- gedcom_x-0.5.7.dist-info/METADATA +144 -0
- gedcom_x-0.5.7.dist-info/RECORD +49 -0
- gedcomx/Address.py +13 -13
- gedcomx/Agent.py +28 -16
- gedcomx/Attribution.py +34 -7
- gedcomx/Conclusion.py +24 -13
- gedcomx/Converter.py +1034 -0
- gedcomx/Coverage.py +7 -6
- gedcomx/Date.py +11 -4
- gedcomx/Document.py +2 -1
- gedcomx/Event.py +95 -20
- gedcomx/ExtensibleEnum.py +183 -0
- gedcomx/Extensions/__init__.py +1 -0
- gedcomx/Extensions/rs10/__init__.py +1 -0
- gedcomx/Extensions/rs10/rsLink.py +116 -0
- gedcomx/Fact.py +16 -13
- gedcomx/Gedcom5x.py +115 -77
- gedcomx/GedcomX.py +184 -1034
- gedcomx/Gender.py +7 -9
- gedcomx/Identifier.py +10 -13
- gedcomx/LoggingHub.py +207 -0
- gedcomx/Mutations.py +8 -8
- gedcomx/Name.py +207 -87
- gedcomx/Note.py +16 -9
- gedcomx/Person.py +39 -18
- gedcomx/PlaceDescription.py +70 -19
- gedcomx/PlaceReference.py +40 -8
- gedcomx/Qualifier.py +39 -12
- gedcomx/Relationship.py +5 -3
- gedcomx/Resource.py +38 -28
- gedcomx/Serialization.py +773 -358
- gedcomx/SourceDescription.py +133 -74
- gedcomx/SourceReference.py +10 -9
- gedcomx/Subject.py +5 -21
- gedcomx/Translation.py +976 -1
- gedcomx/URI.py +1 -1
- gedcomx/__init__.py +4 -2
- gedcom_x-0.5.5.dist-info/METADATA +0 -17
- gedcom_x-0.5.5.dist-info/RECORD +0 -43
- {gedcom_x-0.5.5.dist-info → gedcom_x-0.5.7.dist-info}/WHEEL +0 -0
- {gedcom_x-0.5.5.dist-info → gedcom_x-0.5.7.dist-info}/top_level.txt +0 -0
gedcomx/PlaceReference.py
CHANGED
@@ -1,29 +1,61 @@
|
|
1
|
-
from
|
1
|
+
from __future__ import annotations
|
2
|
+
from typing import Optional, TYPE_CHECKING
|
3
|
+
if TYPE_CHECKING:
|
4
|
+
from .PlaceDescription import PlaceDescription
|
2
5
|
|
6
|
+
"""
|
7
|
+
======================================================================
|
8
|
+
Project: Gedcom-X
|
9
|
+
File: PlaceReference.py
|
10
|
+
Author: David J. Cartwright
|
11
|
+
Purpose: Python Object representation of GedcomX PlaceReference Type
|
12
|
+
|
13
|
+
Created: 2025-08-25
|
14
|
+
Updated:
|
15
|
+
- 2025-08-31: _as_dict_ to only create entries in dict for fields that hold data
|
16
|
+
|
17
|
+
======================================================================
|
18
|
+
"""
|
19
|
+
|
20
|
+
"""
|
21
|
+
======================================================================
|
22
|
+
GEDCOM Module Types
|
23
|
+
======================================================================
|
24
|
+
"""
|
3
25
|
from .Resource import Resource
|
4
|
-
from .Serialization import Serialization
|
5
26
|
|
6
27
|
class PlaceReference:
|
28
|
+
"""defines a reference to a PlaceDescription.
|
29
|
+
|
30
|
+
|
31
|
+
Attributes:
|
32
|
+
original (Optional[str]): The unnormalized, user- or source-provided place text.
|
33
|
+
Keep punctuation and ordering exactly as recorded in the source.
|
34
|
+
description (Optional[Resource|PlaceDescription]): A :class:`gedcomx.PlaceDescription` Object or pointer to it. (URI/:class:`~Resource`)
|
35
|
+
|
36
|
+
"""
|
7
37
|
identifier = 'http://gedcomx.org/v1/PlaceReference'
|
8
38
|
version = 'http://gedcomx.org/conceptual-model/v1'
|
9
39
|
|
10
40
|
def __init__(self,
|
11
41
|
original: Optional[str] = None,
|
12
|
-
description: Optional[Resource] = None) -> None:
|
42
|
+
description: Optional["Resource | PlaceDescription"] = None) -> None:
|
13
43
|
self.original = original
|
14
44
|
self.description = description
|
15
45
|
|
16
46
|
@property
|
17
47
|
def _as_dict_(self):
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
48
|
+
from .Serialization import Serialization
|
49
|
+
type_as_dict = {}
|
50
|
+
if self.original:
|
51
|
+
type_as_dict['original'] = self.original
|
52
|
+
if self.description:
|
53
|
+
type_as_dict['description'] = self.description._as_dict_
|
22
54
|
return Serialization.serialize_dict(type_as_dict)
|
23
55
|
|
24
56
|
@classmethod
|
25
57
|
def _from_json_(cls, data):
|
26
|
-
|
58
|
+
from .Serialization import Serialization
|
27
59
|
return Serialization.deserialize(data, PlaceReference)
|
28
60
|
|
29
61
|
|
gedcomx/Qualifier.py
CHANGED
@@ -1,6 +1,33 @@
|
|
1
1
|
from typing import Optional
|
2
2
|
|
3
|
+
"""
|
4
|
+
======================================================================
|
5
|
+
Project: Gedcom-X
|
6
|
+
File: Qualifier.py
|
7
|
+
Author: David J. Cartwright
|
8
|
+
Purpose: Python Object representation of GedcomX Qualifier Type
|
9
|
+
|
10
|
+
Created: 2025-08-25
|
11
|
+
Updated:
|
12
|
+
- 2025-08-31: _as_dict_ to only create entries in dict for fields that
|
13
|
+
hold data, updated _from_json
|
14
|
+
|
15
|
+
======================================================================
|
16
|
+
"""
|
17
|
+
|
3
18
|
class Qualifier:
|
19
|
+
"""defines the data structure used to supply additional details, annotations,
|
20
|
+
tags, or other qualifying data to a specific data element.
|
21
|
+
|
22
|
+
|
23
|
+
Attributes:
|
24
|
+
name str: The name of the Qualifier. *It is RECOMMENDED that the qualifier
|
25
|
+
name resolve to an element of a constrained vocabulary.*
|
26
|
+
|
27
|
+
value (Optional[str]): The value of the Qualifier. *If provided, the name
|
28
|
+
MAY give the semantic meaning of the value.*
|
29
|
+
|
30
|
+
"""
|
4
31
|
identifier = 'http://gedcomx.org/v1/Qualifier'
|
5
32
|
version = 'http://gedcomx.org/conceptual-model/v1'
|
6
33
|
|
@@ -10,18 +37,18 @@ class Qualifier:
|
|
10
37
|
|
11
38
|
@property
|
12
39
|
def __as_dict__(self):
|
13
|
-
from .Serialization import
|
14
|
-
|
15
|
-
data = {
|
16
|
-
"name":self.name if self.name else None,
|
17
|
-
"value":self.value if self.value else None
|
18
|
-
}
|
40
|
+
from .Serialization import Serialization
|
19
41
|
|
20
|
-
|
42
|
+
type_as_dict = {}
|
43
|
+
if self.name:
|
44
|
+
type_as_dict["name"] = self.name
|
45
|
+
if self.value:
|
46
|
+
type_as_dict["value"] = self.value
|
47
|
+
|
48
|
+
return Serialization.serialize_dict(type_as_dict)
|
21
49
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
))
|
50
|
+
@classmethod
|
51
|
+
def _from_json(cls,data):
|
52
|
+
qualifier = Qualifier(name=data.get('name',"ERROR: This Qualifier require a 'name' but has none."),value=data.get('value'))
|
53
|
+
return qualifier
|
27
54
|
|
gedcomx/Relationship.py
CHANGED
@@ -8,7 +8,7 @@ from .Fact import Fact
|
|
8
8
|
from .Identifier import Identifier
|
9
9
|
from .Note import Note
|
10
10
|
from .Person import Person
|
11
|
-
|
11
|
+
|
12
12
|
from .SourceReference import SourceReference
|
13
13
|
from .Resource import Resource
|
14
14
|
|
@@ -77,11 +77,12 @@ class Relationship(Subject):
|
|
77
77
|
|
78
78
|
@property
|
79
79
|
def _as_dict_(self):
|
80
|
+
from .Serialization import Serialization
|
80
81
|
type_as_dict = super()._as_dict_
|
81
82
|
type_as_dict.update({
|
82
83
|
"type": self.type.value if isinstance(self.type, RelationshipType) else self.type,
|
83
|
-
"person1": self.person1._as_dict_ if self.person1 else None,
|
84
|
-
"person2": self.
|
84
|
+
"person1": Resource(target=self.person1)._as_dict_ if self.person1 else None,
|
85
|
+
"person2": Resource(target=self.person1)._as_dict_ if self.person2 else None,
|
85
86
|
"facts": [fact for fact in self.facts] if self.facts else None
|
86
87
|
})
|
87
88
|
return Serialization.serialize_dict(type_as_dict)
|
@@ -91,5 +92,6 @@ class Relationship(Subject):
|
|
91
92
|
"""
|
92
93
|
Create a Person instance from a JSON-dict (already parsed).
|
93
94
|
"""
|
95
|
+
from .Serialization import Serialization
|
94
96
|
return Serialization.deserialize(data, Relationship)
|
95
97
|
|
gedcomx/Resource.py
CHANGED
@@ -1,5 +1,24 @@
|
|
1
|
-
from typing import
|
1
|
+
from typing import Optional
|
2
2
|
|
3
|
+
"""
|
4
|
+
======================================================================
|
5
|
+
Project: Gedcom-X
|
6
|
+
File: Resource.py
|
7
|
+
Author: David J. Cartwright
|
8
|
+
Purpose: References TopLevel Types for Serialization
|
9
|
+
|
10
|
+
Created: 2025-08-25
|
11
|
+
Updated:
|
12
|
+
- 2025-08-31: working on target=Resource and deserialization issues
|
13
|
+
|
14
|
+
======================================================================
|
15
|
+
"""
|
16
|
+
|
17
|
+
"""
|
18
|
+
======================================================================
|
19
|
+
GEDCOM Module Types
|
20
|
+
======================================================================
|
21
|
+
"""
|
3
22
|
|
4
23
|
from .URI import URI
|
5
24
|
|
@@ -15,6 +34,7 @@ class Resource:
|
|
15
34
|
ValueError
|
16
35
|
If `id` is not a valid UUID.
|
17
36
|
"""
|
37
|
+
# TODO, Deal with a resouce being passed, as it may be unresolved.
|
18
38
|
def __init__(self,uri: Optional[URI|str] = None, id:Optional[str] = None,top_lvl_object: Optional[object] = None,target= None) -> None:
|
19
39
|
|
20
40
|
self.resource = URI.from_url(uri.value) if isinstance(uri,URI) else URI.from_url(uri) if isinstance(uri,str) else None
|
@@ -26,15 +46,27 @@ class Resource:
|
|
26
46
|
self.remote: bool | None = None # is the resource pointed to persitent on a remote datastore?
|
27
47
|
|
28
48
|
if target:
|
29
|
-
|
30
|
-
|
31
|
-
|
49
|
+
if isinstance(target,Resource):
|
50
|
+
self.resource = target.resource
|
51
|
+
self.Id = target.Id
|
52
|
+
self.target = target.target
|
53
|
+
else:
|
54
|
+
self.resource = target.uri
|
55
|
+
self.Id = target.id
|
56
|
+
self.type = type(target)
|
32
57
|
|
58
|
+
@property
|
59
|
+
def uri(self):
|
60
|
+
return self.resource
|
61
|
+
|
33
62
|
@property
|
34
63
|
def _as_dict_(self):
|
35
64
|
from .Serialization import Serialization
|
36
|
-
typ_as_dict = {
|
37
|
-
|
65
|
+
typ_as_dict = {}
|
66
|
+
if self.resource:
|
67
|
+
typ_as_dict['resource'] = self.resource.value if self.resource else None
|
68
|
+
if self.Id:
|
69
|
+
typ_as_dict['resourceId'] = self.Id
|
38
70
|
return Serialization.serialize_dict(typ_as_dict)
|
39
71
|
|
40
72
|
@classmethod
|
@@ -49,27 +81,5 @@ class Resource:
|
|
49
81
|
def __str__(self) -> str:
|
50
82
|
return f"{self.resource}{f', id={self.Id}' if self.Id else ''}"
|
51
83
|
|
52
|
-
def get_resource_as_dict(value):
|
53
|
-
"""
|
54
|
-
If value is truthy:
|
55
|
-
- If it's already a Resource, return it.
|
56
|
-
- Otherwise, wrap it in Resource using (value._uri, value.id).
|
57
|
-
Returns None if value is falsy.
|
58
|
-
"""
|
59
|
-
|
60
|
-
if not value:
|
61
|
-
return None
|
62
84
|
|
63
|
-
if isinstance(value, Resource):
|
64
|
-
return value._as_dict_
|
65
|
-
|
66
|
-
try:
|
67
|
-
return Resource(
|
68
|
-
getattr(value, "uri", None),
|
69
|
-
getattr(value, "id", None)
|
70
|
-
)._as_dict_
|
71
|
-
except AttributeError:
|
72
|
-
print('get_resource_as_dict',type(value),value)
|
73
|
-
print((f"value: {value} as inproper attributes"))
|
74
|
-
exit()
|
75
85
|
|