gedcom-x 0.5.9__tar.gz → 0.5.10__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.
Files changed (64) hide show
  1. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/PKG-INFO +1 -1
  2. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcom_x.egg-info/PKG-INFO +1 -1
  3. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcom_x.egg-info/SOURCES.txt +4 -1
  4. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/__init__.py +3 -0
  5. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/conclusion.py +1 -1
  6. gedcom_x-0.5.10/gedcomx/extensible.py +86 -0
  7. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/gedcom7/GedcomStructure.py +1 -3
  8. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/gedcom7/__init__.py +1 -1
  9. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/gedcom7/gedcom7.py +3 -3
  10. gedcom_x-0.5.10/gedcomx/gedcom7/specification.py +4817 -0
  11. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/person.py +2 -1
  12. gedcom_x-0.5.10/gedcomx/schemas.py +328 -0
  13. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/pyproject.toml +1 -1
  14. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/setup.py +1 -1
  15. gedcom_x-0.5.9/gedcomx/gedcom7/Specification.py +0 -347
  16. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/README.md +0 -0
  17. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcom_x.egg-info/dependency_links.txt +0 -0
  18. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcom_x.egg-info/top_level.txt +0 -0
  19. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/Extensions/__init__.py +0 -0
  20. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/Extensions/rs10/__init__.py +0 -0
  21. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/Extensions/rs10/rsLink.py +0 -0
  22. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/Logging.py +0 -0
  23. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/TopLevelTypeCollection.py +0 -0
  24. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/Zip.py +0 -0
  25. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/address.py +0 -0
  26. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/agent.py +0 -0
  27. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/attribution.py +0 -0
  28. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/converter.py +0 -0
  29. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/coverage.py +0 -0
  30. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/date.py +0 -0
  31. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/document.py +0 -0
  32. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/event.py +0 -0
  33. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/evidence_reference.py +0 -0
  34. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/exceptions.py +0 -0
  35. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/extensible_enum.py +0 -0
  36. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/fact.py +0 -0
  37. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/gedcom.py +0 -0
  38. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/gedcom5x.py +0 -0
  39. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/gedcom7/Exceptions.py +0 -0
  40. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/gedcom7/g7interop.py +0 -0
  41. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/gedcom7/logger.py +0 -0
  42. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/gedcomx.py +0 -0
  43. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/gender.py +0 -0
  44. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/group.py +0 -0
  45. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/identifier.py +0 -0
  46. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/logging_hub.py +0 -0
  47. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/mutations.py +0 -0
  48. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/name.py +0 -0
  49. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/note.py +0 -0
  50. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/online_account.py +0 -0
  51. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/place_description.py +0 -0
  52. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/place_reference.py +0 -0
  53. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/qualifier.py +0 -0
  54. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/relationship.py +0 -0
  55. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/resource.py +0 -0
  56. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/serialization.py +0 -0
  57. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/source_citation.py +0 -0
  58. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/source_description.py +0 -0
  59. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/source_reference.py +0 -0
  60. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/subject.py +0 -0
  61. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/textvalue.py +0 -0
  62. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/translation.py +0 -0
  63. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/gedcomx/uri.py +0 -0
  64. {gedcom_x-0.5.9 → gedcom_x-0.5.10}/setup.cfg +0 -0
@@ -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,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
@@ -49,6 +49,7 @@ gedcomx/document.py
49
49
  gedcomx/event.py
50
50
  gedcomx/evidence_reference.py
51
51
  gedcomx/exceptions.py
52
+ gedcomx/extensible.py
52
53
  gedcomx/extensible_enum.py
53
54
  gedcomx/fact.py
54
55
  gedcomx/gedcom.py
@@ -68,6 +69,7 @@ gedcomx/place_reference.py
68
69
  gedcomx/qualifier.py
69
70
  gedcomx/relationship.py
70
71
  gedcomx/resource.py
72
+ gedcomx/schemas.py
71
73
  gedcomx/serialization.py
72
74
  gedcomx/source_citation.py
73
75
  gedcomx/source_description.py
@@ -86,4 +88,5 @@ gedcomx/gedcom7/Specification.py
86
88
  gedcomx/gedcom7/__init__.py
87
89
  gedcomx/gedcom7/g7interop.py
88
90
  gedcomx/gedcom7/gedcom7.py
89
- gedcomx/gedcom7/logger.py
91
+ gedcomx/gedcom7/logger.py
92
+ gedcomx/gedcom7/specification.py
@@ -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
@@ -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
@@ -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,