gedcom-x 0.5.9__py3-none-any.whl → 0.5.10__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gedcom-x
3
- Version: 0.5.9
3
+ Version: 0.5.10
4
4
  Summary: Python implimentation of gedcom-x standard
5
5
  Author-email: "David J. Cartwright" <davidcartwright@hotmail.com>
6
6
  License: MIT
@@ -1,11 +1,11 @@
1
1
  gedcomx/Logging.py,sha256=vBDOjawVXc4tCge1laYjy6_2Ves-fnGzG0m6NnLZejE,624
2
2
  gedcomx/TopLevelTypeCollection.py,sha256=p99i-O5LXiXe3GlC6jWuz4nH1TAcKxOLbe0VRxWbSFY,1495
3
3
  gedcomx/Zip.py,sha256=lBxcv-Vip45884EHj56wZJJ5I36Q38UuHUidDxQBoS8,14
4
- gedcomx/__init__.py,sha256=8qEa_oYCC1nMyeMt0zNmsqXnocfA2q6VNUlp0cCnMLI,1723
4
+ gedcomx/__init__.py,sha256=iSsS6j_4t0Xdrz7PeE598cFP_oTxxjhMi-_DzdG4k8U,1825
5
5
  gedcomx/address.py,sha256=7tGUPRItlSiUZ6-WaDNj4sbjvU8W_f2kw-I8s_nntTU,8049
6
6
  gedcomx/agent.py,sha256=HxDRB8axhReUmTDtn0XFNemG6znjJQezi-qxO2JRfCg,12803
7
7
  gedcomx/attribution.py,sha256=S648H7it_780WLA0c4dkBSrjeXIMz_YVMk1eJ6wZk6Q,4586
8
- gedcomx/conclusion.py,sha256=BpLFZY0p02yGa3H9Fis2eZz8NYBi7YsiLbaX6N7ZICM,11167
8
+ gedcomx/conclusion.py,sha256=JNWukegiNsE3SHU9-q3gd9YbxOQunW1Bo5VEg7MAeCs,11169
9
9
  gedcomx/converter.py,sha256=_VzdkjS52AVXrtKUAzgI6VGDaw7Wysa76B1Vt1XnNEs,57637
10
10
  gedcomx/coverage.py,sha256=XmBiTGxuH9WoeXumrgu03EMWtccHe982hFJu2Coxceo,2206
11
11
  gedcomx/date.py,sha256=xiAatY25DXTW8usmhbyx_6rmEae3FJnmR5FriGkCN80,3560
@@ -13,6 +13,7 @@ gedcomx/document.py,sha256=quaa1N1XcqhMdpTwCzpvnZfRgygK1mRhFPWyX09ZrWw,4555
13
13
  gedcomx/event.py,sha256=7Iogi3eVmR4_-qg6seIo7orAmVS1ENvUQcJO3_tZGlc,15417
14
14
  gedcomx/evidence_reference.py,sha256=vtP0rYpehfuu4Jugf1V9u5V_wgPu-2EPb7mqPLS_9cI,696
15
15
  gedcomx/exceptions.py,sha256=0OdPM3euhBMgX8o61ZwPuKeN8zPuSuuDcSBFflVGFqk,587
16
+ gedcomx/extensible.py,sha256=6-VaJmOax8BoShKMKxKpJEyZf7aILqA8SMEqbRgP5yM,2659
16
17
  gedcomx/extensible_enum.py,sha256=DftCZLMBNul3C9hwh-rf0GE3SVdvylvyd5mt7bX_l6o,6535
17
18
  gedcomx/fact.py,sha256=bEAUKvLpn7ZAJjyOE57dcvOnvkdzZ63GqF3yb2nGhX0,24972
18
19
  gedcomx/gedcom.py,sha256=A8GQ670E6_knfP37kOGHdVl_cC9RXQoc4Dk6D_qlnuQ,2059
@@ -26,12 +27,13 @@ gedcomx/mutations.py,sha256=ugQgfQh0o9r8FIB_dz5s6KqPyIDMHn2YSP7DvAHsDv0,7236
26
27
  gedcomx/name.py,sha256=5UpNgFPBfTfzC5yLQDqmeSJ-Fg1T6Nio9vEa6f5kA2Y,19501
27
28
  gedcomx/note.py,sha256=joDgKrDS9pbOEEve9LGopP2Gz48kFKqMeHYR72Z7bA0,3813
28
29
  gedcomx/online_account.py,sha256=EYMW-CepfwppaJu5RiPQOK63YKxnjE8bVOPUNQqbrMM,639
29
- gedcomx/person.py,sha256=QALVxY2NlZ93BU0QR9Q4Ykm4kZ-7j4j4QTVXo4hpO60,8993
30
+ gedcomx/person.py,sha256=iUyX_Yl6cmbwYPC91OEfwS4i1csdPrkdcpa5yaGeiZc,9040
30
31
  gedcomx/place_description.py,sha256=vFCVW37tKBosYCGttkXppR7yDXA-L8YVLpixSN-8b4E,7564
31
32
  gedcomx/place_reference.py,sha256=XE-tyRsvfXVK--vdiA_Pvj0ZrUecl72JldbV-c-k_PU,2939
32
33
  gedcomx/qualifier.py,sha256=Lg5D_CRLKxaUHcCGLzXhKmpMkmdOeQso0V-XN3yH2n4,2352
33
34
  gedcomx/relationship.py,sha256=_wA1NujEqQO0HzSfjlfLcl-yCFWBcOsRyxs3klr0HfE,5852
34
35
  gedcomx/resource.py,sha256=ShK3sQOaNI4ZlrIUcepL7_uLd_QX4zMx-A1SU2In_m4,3608
36
+ gedcomx/schemas.py,sha256=wZ7GISQSoQ6reghE92OsutnTqQ1LXy6JD_XBX55Loe4,12506
35
37
  gedcomx/serialization.py,sha256=Pg_tDO5wUXDgyMqVGPwAlm2WdBBNUA0L-TBaRSWhaNo,30308
36
38
  gedcomx/source_citation.py,sha256=QSh1zHK9DsgjQu6oHPDTCReLVs2HP8YDR-NlLAG-pek,1237
37
39
  gedcomx/source_description.py,sha256=A2R1T26HYqpk8Q4W8BYp7zlvHYqycHkUMX94uQRpwV8,19258
@@ -44,13 +46,13 @@ gedcomx/Extensions/__init__.py,sha256=MQzi_whzlxiLiknUNh10hG8OVrNqJE38l6n-AwCssx
44
46
  gedcomx/Extensions/rs10/__init__.py,sha256=nSHoZiD8hsCAyE-KyRTuWSLqSJSFh12kSz7hqilAMps,26
45
47
  gedcomx/Extensions/rs10/rsLink.py,sha256=IdmcG1pVicxX91ZMu9fUPwKYoXCl0Q60inGwiThDAVE,6004
46
48
  gedcomx/gedcom7/Exceptions.py,sha256=xeKr4x8b7r8pOqJ9yMpsCVTyxPeOlREDGgKoM5rX4U0,149
47
- gedcomx/gedcom7/GedcomStructure.py,sha256=ZKNoEcXc41KdrCLPx-A8ohOU9VYmXAkFc4xuZExsBPw,3435
48
- gedcomx/gedcom7/Specification.py,sha256=qIBe9wzL1GB0l0NyetS1ncbhz5C44b9nMyjAxHuqMt8,9245
49
- gedcomx/gedcom7/__init__.py,sha256=tPHWW9kchPFEZ5sfURWPPzK8ZBimsQn7SRDULAW1Yc4,679
49
+ gedcomx/gedcom7/GedcomStructure.py,sha256=45p6o01j_bmgCasfprDnGTVy-gyKM_8BuvAakLqCl3c,3431
50
+ gedcomx/gedcom7/__init__.py,sha256=izlM3__nzpZ32qLU8cqqyIpGQ4cA9vlQh3_RXxgMCg4,682
50
51
  gedcomx/gedcom7/g7interop.py,sha256=hSzwqeok2n7xziEvN2QiJY7bVCWrOnZIZWXubnkrv7w,9945
51
- gedcomx/gedcom7/gedcom7.py,sha256=i_g9W0qsZQYLMoD2sBCA13ibKRYFnSf4uj9-ix_tE4Q,5614
52
+ gedcomx/gedcom7/gedcom7.py,sha256=oAp94vmkGtyqqI8-3uA1t5bepxLovMSi3r9rZFlZ0Lg,5620
52
53
  gedcomx/gedcom7/logger.py,sha256=QM1SySyh91UEhs90d2DMhH-s9qGF8XS8I8gr1eOcmfw,617
53
- gedcom_x-0.5.9.dist-info/METADATA,sha256=Wn8DcPMkZvmTZRrnNlo4GzUlwRYGSRbKJABN7oVYTaw,4332
54
- gedcom_x-0.5.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
55
- gedcom_x-0.5.9.dist-info/top_level.txt,sha256=smVBF4nxSU-mzCd6idtRYTbYjPICMMi8pTqewEmqF8Y,8
56
- gedcom_x-0.5.9.dist-info/RECORD,,
54
+ gedcomx/gedcom7/specification.py,sha256=H6l4IW4UX7YRKoNH6t84REFeGl52kEyRnn6a9f21gbg,288703
55
+ gedcom_x-0.5.10.dist-info/METADATA,sha256=6sx_S_SMYe8PooiGv8TYwqOSodtyBBDVl9gKbdQes5w,4333
56
+ gedcom_x-0.5.10.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
57
+ gedcom_x-0.5.10.dist-info/top_level.txt,sha256=smVBF4nxSU-mzCd6idtRYTbYjPICMMi8pTqewEmqF8Y,8
58
+ gedcom_x-0.5.10.dist-info/RECORD,,
gedcomx/__init__.py CHANGED
@@ -1,3 +1,4 @@
1
+ from .schemas import SCHEMA
1
2
  from .agent import Agent
2
3
  from .address import Address
3
4
  from .attribution import Attribution
@@ -12,6 +13,8 @@ from .extensible_enum import ExtensibleEnum
12
13
  from .event import Event
13
14
  from .event import EventType
14
15
  from .event import EventRole
16
+ from .extensible import Extensible
17
+ from. extensible import _ExtraField
15
18
  from .fact import Fact
16
19
  from .fact import FactQualifier
17
20
  from .fact import FactType
gedcomx/conclusion.py CHANGED
@@ -113,7 +113,7 @@ class ConfidenceLevel(Qualifier):
113
113
  return descriptions.get(key, "No description available.")
114
114
 
115
115
 
116
- class Conclusion:
116
+ class Conclusion():
117
117
  """
118
118
  Represents a conclusion in the GEDCOM X conceptual model. A conclusion is a
119
119
  genealogical assertion about a person, relationship, or event, derived from
gedcomx/extensible.py ADDED
@@ -0,0 +1,86 @@
1
+ # extensible.py
2
+ from __future__ import annotations
3
+ from dataclasses import dataclass, field
4
+ from typing import Any, Dict, Optional, Callable
5
+
6
+ from .schemas import SCHEMA
7
+ # If you're using the earlier schema registry:
8
+ #from .serialization_schema import SCHEMA
9
+
10
+
11
+
12
+ class Extensible:
13
+ # class-level registry of declared extras
14
+ _declared_extras: Dict[str, Any] = {}
15
+
16
+ def __init_subclass__(cls, **kw):
17
+ super().__init_subclass__(**kw)
18
+ # each subclass gets its own dict (copy, not shared)
19
+ cls._declared_extras = dict(getattr(cls, "_declared_extras", {}))
20
+
21
+ def __init__(self, *args, **kwargs):
22
+ super().__init__(*args, **kwargs) # cooperative
23
+ self.extras: Dict[str, Any] = {}
24
+ # seed declared defaults
25
+ for k, default in type(self)._declared_extras.items():
26
+ self.extras[k] = _copy_default(default)
27
+
28
+ @classmethod
29
+ def define_ext(
30
+ cls,
31
+ name: str,
32
+ *,
33
+ typ: type | None = None,
34
+ default: Any = None,
35
+ overwrite: bool = False,
36
+ ) -> None:
37
+ """
38
+ Declare an extra field on the CLASS.
39
+
40
+ Args:
41
+ name: field name
42
+ typ: Python type (used to update schema registry)
43
+ default: default value for new instances
44
+ overwrite: if True, replaces existing definition
45
+ """
46
+ if name in getattr(cls, "__dataclass_fields__", {}):
47
+ raise AttributeError(f"{name!r} already exists on {cls.__name__}")
48
+
49
+ already = hasattr(cls, name)
50
+ if already and not overwrite:
51
+ return
52
+
53
+ # Attach descriptor
54
+ setattr(cls, name, _ExtraField(name, default))
55
+ cls._declared_extras[name] = default
56
+
57
+ # Register with schema
58
+ if typ is None and default is not None:
59
+ typ = type(default)
60
+ SCHEMA.register_extra(cls, name, typ or type(None))
61
+
62
+ @classmethod
63
+ def declared_extras(cls) -> Dict[str, Any]:
64
+ return dict(getattr(cls, "_declared_extras", {}))
65
+
66
+
67
+ class _ExtraField:
68
+ def __init__(self, name: str, default: Any):
69
+ self.name = name
70
+ self.default = default
71
+ def __get__(self, obj, owner):
72
+ if obj is None:
73
+ return self
74
+ return obj.extras.get(self.name, self.default)
75
+ def __set__(self, obj, value):
76
+ obj.extras[self.name] = value
77
+
78
+
79
+ def _copy_default(v: Any) -> Any:
80
+ if isinstance(v, (list, dict, set)):
81
+ return v.copy()
82
+ return v
83
+ # avoid shared mutable defaults
84
+ if isinstance(v, (list, dict, set)):
85
+ return v.copy()
86
+ return v
@@ -2,7 +2,7 @@ from __future__ import annotations
2
2
 
3
3
  from typing import Dict, Any
4
4
  import warnings
5
- from . import Specification as g7
5
+ from . import specification as g7
6
6
 
7
7
  from typing import Dict, List,Optional,Any
8
8
 
@@ -19,8 +19,6 @@ gedcom_top_level_terms = ['https://gedcom.io/terms/v7/CONT',
19
19
  'https://gedcom.io/terms/v7/record-SOUR']
20
20
 
21
21
 
22
-
23
-
24
22
  class GedcomStructure:
25
23
  version = 'v7'
26
24
 
@@ -21,6 +21,6 @@ GEDCOM Module Types
21
21
  """
22
22
  from .GedcomStructure import GedcomStructure
23
23
  from .logger import get_logger
24
- from .Specification import structure_specs
24
+ from .specification import g7_structure_specs
25
25
  from .gedcom7 import Gedcom7
26
26
  __all__ = ["Gedcom7"]
@@ -5,7 +5,7 @@ from collections import defaultdict
5
5
 
6
6
 
7
7
  from .GedcomStructure import GedcomStructure
8
- from . import Specification as g7specs
8
+ from . import specification as g7specs
9
9
  from .logger import get_logger
10
10
 
11
11
 
@@ -114,8 +114,8 @@ class Gedcom7:
114
114
 
115
115
  if tag == 'TAG':
116
116
  xtag, uri = value.split()
117
- g7specs.structure_specs[xtag] = uri
118
- g7specs.structure_specs[uri] = {'label': 'Extension_' + xtag}
117
+ g7specs.g7_structure_specs[xtag] = uri
118
+ g7specs.g7_structure_specs[uri] = {'label': 'Extension_' + xtag}
119
119
 
120
120
  return {
121
121
  "level": level,