gedcom-x 0.5.1__py3-none-any.whl → 0.5.5__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.1.dist-info → gedcom_x-0.5.5.dist-info}/METADATA +1 -1
- gedcom_x-0.5.5.dist-info/RECORD +43 -0
- gedcomx/Address.py +42 -11
- gedcomx/Agent.py +136 -23
- gedcomx/Attribution.py +39 -91
- gedcomx/Conclusion.py +132 -53
- gedcomx/Coverage.py +10 -0
- gedcomx/Date.py +47 -11
- gedcomx/Document.py +43 -12
- gedcomx/Event.py +24 -5
- gedcomx/EvidenceReference.py +2 -2
- gedcomx/Exceptions.py +16 -0
- gedcomx/Fact.py +73 -50
- gedcomx/Gedcom.py +40 -333
- gedcomx/Gedcom5x.py +558 -0
- gedcomx/GedcomX.py +439 -194
- gedcomx/Gender.py +27 -8
- gedcomx/Group.py +3 -3
- gedcomx/Identifier.py +192 -55
- gedcomx/Logging.py +19 -0
- gedcomx/Mutations.py +228 -0
- gedcomx/Name.py +73 -38
- gedcomx/Note.py +5 -4
- gedcomx/OnlineAccount.py +2 -2
- gedcomx/Person.py +106 -92
- gedcomx/PlaceDescription.py +39 -16
- gedcomx/PlaceReference.py +14 -15
- gedcomx/Relationship.py +35 -56
- gedcomx/Resource.py +75 -0
- gedcomx/Serialization.py +394 -30
- gedcomx/SourceCitation.py +6 -1
- gedcomx/SourceDescription.py +89 -75
- gedcomx/SourceReference.py +33 -88
- gedcomx/Subject.py +12 -10
- gedcomx/TextValue.py +2 -1
- gedcomx/Translation.py +219 -0
- gedcomx/URI.py +96 -61
- gedcomx/Zip.py +1 -0
- gedcomx/__init__.py +11 -3
- gedcom_x-0.5.1.dist-info/RECORD +0 -37
- gedcomx/_Resource.py +0 -11
- {gedcom_x-0.5.1.dist-info → gedcom_x-0.5.5.dist-info}/WHEEL +0 -0
- {gedcom_x-0.5.1.dist-info → gedcom_x-0.5.5.dist-info}/top_level.txt +0 -0
gedcomx/Translation.py
ADDED
@@ -0,0 +1,219 @@
|
|
1
|
+
from . import *
|
2
|
+
from .Mutations import GedcomXEventOrFact
|
3
|
+
|
4
|
+
'''
|
5
|
+
{'type': 'Object | Objects | Propertyof',
|
6
|
+
'Object': 'Class',
|
7
|
+
'Objects': ['Class',...],
|
8
|
+
'Propertyof': 'Class',
|
9
|
+
'Args': {'argname':'value|rTextValue|rIntValue|rFloatValue|rBoolValue|id|resource'},
|
10
|
+
'Assign': {'propertyname':'value|rTextValue|rIntValue|rFloatValue|rBoolValue|id|resource'},
|
11
|
+
'Selectoe':callable
|
12
|
+
}
|
13
|
+
|
14
|
+
'''
|
15
|
+
g7toXtable = {
|
16
|
+
"https://gedcom.io/terms/v7/ABBR": {},
|
17
|
+
"https://gedcom.io/terms/v7/ADDR": {'type':'Object','Object':Address, 'Args':{'value':'value'},'addmethod':'add_address'},
|
18
|
+
"https://gedcom.io/terms/v7/ADOP": {},
|
19
|
+
"https://gedcom.io/terms/v7/ADOP-FAMC": {},
|
20
|
+
"https://gedcom.io/terms/v7/ADR1": {'type':'Propertyof','propertyof':Address,'assign':{'street':'value'}},
|
21
|
+
"https://gedcom.io/terms/v7/ADR2": {'type':'Propertyof','propertyof':Address,'assign':{'street2':'value'}},
|
22
|
+
"https://gedcom.io/terms/v7/ADR3": {'type':'Propertyof','propertyof':Address,'assign':{'street3':'value'}},
|
23
|
+
"https://gedcom.io/terms/v7/AGE": {},
|
24
|
+
"https://gedcom.io/terms/v7/AGNC": {},
|
25
|
+
"https://gedcom.io/terms/v7/ALIA": {},
|
26
|
+
"https://gedcom.io/terms/v7/ANCI": {},
|
27
|
+
"https://gedcom.io/terms/v7/ANUL": {'type':'Mutation','Object':GedcomXEventOrFact,'Args':{'value':'value'},'propertyof':[Relationship],'method':'add_fact'},
|
28
|
+
"https://gedcom.io/terms/v7/ASSO": {},
|
29
|
+
"https://gedcom.io/terms/v7/AUTH": {},
|
30
|
+
"https://gedcom.io/terms/v7/BAPL": {},
|
31
|
+
"https://gedcom.io/terms/v7/BAPM": {},
|
32
|
+
"https://gedcom.io/terms/v7/BARM": {},
|
33
|
+
"https://gedcom.io/terms/v7/BASM": {},
|
34
|
+
"https://gedcom.io/terms/v7/BIRT": {},
|
35
|
+
"https://gedcom.io/terms/v7/BLES": {},
|
36
|
+
"https://gedcom.io/terms/v7/BURI": {},
|
37
|
+
"https://gedcom.io/terms/v7/CALN": {},
|
38
|
+
"https://gedcom.io/terms/v7/CAST": {},
|
39
|
+
"https://gedcom.io/terms/v7/CAUS": {},
|
40
|
+
"https://gedcom.io/terms/v7/CENS": {},
|
41
|
+
"https://gedcom.io/terms/v7/CHAN": {},
|
42
|
+
"https://gedcom.io/terms/v7/CHIL": {},
|
43
|
+
"https://gedcom.io/terms/v7/CHR": {},
|
44
|
+
"https://gedcom.io/terms/v7/CHRA": {},
|
45
|
+
"https://gedcom.io/terms/v7/CITY": {'type':'Propertyof','propertyof':Address,'assign':{'city':'value'}},
|
46
|
+
"https://gedcom.io/terms/v7/CONF": {},
|
47
|
+
"https://gedcom.io/terms/v7/CONL": {},
|
48
|
+
"https://gedcom.io/terms/v7/CONT": {},
|
49
|
+
"https://gedcom.io/terms/v7/COPR": {},
|
50
|
+
"https://gedcom.io/terms/v7/CORP": {},
|
51
|
+
"https://gedcom.io/terms/v7/CREA": {},
|
52
|
+
"https://gedcom.io/terms/v7/CREM": {},
|
53
|
+
"https://gedcom.io/terms/v7/CROP": {},
|
54
|
+
"https://gedcom.io/terms/v7/CTRY": {'type':'Propertyof','propertyof':Address,'assign':{'country':'value'}},
|
55
|
+
"https://gedcom.io/terms/v7/DATA": {},
|
56
|
+
"https://gedcom.io/terms/v7/DATA-EVEN": {},
|
57
|
+
"https://gedcom.io/terms/v7/DATA-EVEN-DATE": {},
|
58
|
+
"https://gedcom.io/terms/v7/DATE": {},
|
59
|
+
"https://gedcom.io/terms/v7/DATE-exact": {},
|
60
|
+
"https://gedcom.io/terms/v7/DEAT": {},
|
61
|
+
"https://gedcom.io/terms/v7/DESI": {},
|
62
|
+
"https://gedcom.io/terms/v7/DEST": {},
|
63
|
+
"https://gedcom.io/terms/v7/DIV": {'type':'Mutation','Object':GedcomXEventOrFact,'Args':{'value':'value'},'propertyof':[Relationship],'method':'add_fact'},
|
64
|
+
"https://gedcom.io/terms/v7/DIVF": {'type':'Mutation','Object':GedcomXEventOrFact,'Args':{'value':'value'},'propertyof':[Relationship],'method':'add_fact'},
|
65
|
+
"https://gedcom.io/terms/v7/DSCR": {},
|
66
|
+
"https://gedcom.io/terms/v7/EDUC": {},
|
67
|
+
"https://gedcom.io/terms/v7/EMAIL": {},
|
68
|
+
"https://gedcom.io/terms/v7/EMIG": {},
|
69
|
+
"https://gedcom.io/terms/v7/ENDL": {},
|
70
|
+
"https://gedcom.io/terms/v7/ENGA": {'type':'Mutation','Object':GedcomXEventOrFact,'Args':{'value':'value'},'propertyof':[Relationship],'method':'add_fact'},
|
71
|
+
"https://gedcom.io/terms/v7/EVEN": {},
|
72
|
+
"https://gedcom.io/terms/v7/EXID": {},
|
73
|
+
"https://gedcom.io/terms/v7/EXID-TYPE": {},
|
74
|
+
"https://gedcom.io/terms/v7/FACT": {},
|
75
|
+
"https://gedcom.io/terms/v7/FAM": {'type':'Object','Object':Relationship,'Args':{'id':'xref'},'stackentry':['lastrelationship','lastrelationshipdata']},
|
76
|
+
"https://gedcom.io/terms/v7/FAM-CENS": {'type':'Mutation','Object':GedcomXEventOrFact,'Args':{'value':'value'},'propertyof':[Relationship],'method':'add_fact'},
|
77
|
+
"https://gedcom.io/terms/v7/FAM-EVEN": {},
|
78
|
+
"https://gedcom.io/terms/v7/FAM-FACT": {},
|
79
|
+
"https://gedcom.io/terms/v7/FAM-HUSB": {'type':'Object','Object':Resource,'Args':{'Id':'xref'}},
|
80
|
+
"https://gedcom.io/terms/v7/FAM-NCHI": {},
|
81
|
+
"https://gedcom.io/terms/v7/FAM-RESI": {'type':'Mutation','Object':GedcomXEventOrFact,'Args':{'value':'value'},'propertyof':[Relationship],'method':'add_fact'},
|
82
|
+
"https://gedcom.io/terms/v7/FAM-WIFE": {'type':'Object','Object':Resource,'Args':{'Id':'xref'}},
|
83
|
+
"https://gedcom.io/terms/v7/FAMC": {},
|
84
|
+
"https://gedcom.io/terms/v7/FAMC-ADOP": {},
|
85
|
+
"https://gedcom.io/terms/v7/FAMC-STAT": {},
|
86
|
+
"https://gedcom.io/terms/v7/FAMS": {},
|
87
|
+
"https://gedcom.io/terms/v7/FAX": {},
|
88
|
+
"https://gedcom.io/terms/v7/FCOM": {},
|
89
|
+
"https://gedcom.io/terms/v7/FILE": {},
|
90
|
+
"https://gedcom.io/terms/v7/FILE-TRAN": {},
|
91
|
+
"https://gedcom.io/terms/v7/FORM": {},
|
92
|
+
"https://gedcom.io/terms/v7/GEDC": {},
|
93
|
+
"https://gedcom.io/terms/v7/GEDC-VERS": {},
|
94
|
+
"https://gedcom.io/terms/v7/GIVN": {},
|
95
|
+
"https://gedcom.io/terms/v7/GRAD": {},
|
96
|
+
"https://gedcom.io/terms/v7/HEAD": {},
|
97
|
+
"https://gedcom.io/terms/v7/HEAD-DATE": {},
|
98
|
+
"https://gedcom.io/terms/v7/HEAD-LANG": {},
|
99
|
+
"https://gedcom.io/terms/v7/HEAD-PLAC": {},
|
100
|
+
"https://gedcom.io/terms/v7/HEAD-PLAC-FORM": {},
|
101
|
+
"https://gedcom.io/terms/v7/HEAD-SOUR": {},
|
102
|
+
"https://gedcom.io/terms/v7/HEAD-SOUR-DATA": {},
|
103
|
+
"https://gedcom.io/terms/v7/HEIGHT": {},
|
104
|
+
"https://gedcom.io/terms/v7/HUSB": {},
|
105
|
+
"https://gedcom.io/terms/v7/IDNO": {},
|
106
|
+
"https://gedcom.io/terms/v7/IMMI": {},
|
107
|
+
"https://gedcom.io/terms/v7/INDI": {},
|
108
|
+
"https://gedcom.io/terms/v7/INDI-CENS": {},
|
109
|
+
"https://gedcom.io/terms/v7/INDI-EVEN": {},
|
110
|
+
"https://gedcom.io/terms/v7/INDI-FACT": {},
|
111
|
+
"https://gedcom.io/terms/v7/INDI-FAMC": {},
|
112
|
+
"https://gedcom.io/terms/v7/INDI-NAME": {},
|
113
|
+
"https://gedcom.io/terms/v7/INDI-NCHI": {},
|
114
|
+
"https://gedcom.io/terms/v7/INDI-RELI": {},
|
115
|
+
"https://gedcom.io/terms/v7/INDI-RESI": {},
|
116
|
+
"https://gedcom.io/terms/v7/INDI-TITL": {},
|
117
|
+
"https://gedcom.io/terms/v7/INIL": {},
|
118
|
+
"https://gedcom.io/terms/v7/LANG": {},
|
119
|
+
"https://gedcom.io/terms/v7/LATI": {},
|
120
|
+
"https://gedcom.io/terms/v7/LEFT": {},
|
121
|
+
"https://gedcom.io/terms/v7/LONG": {},
|
122
|
+
"https://gedcom.io/terms/v7/MAP": {},
|
123
|
+
"https://gedcom.io/terms/v7/MARB": {'type':'Mutation','Object':GedcomXEventOrFact,'Args':{'value':'value'},'propertyof':[Relationship],'method':'add_fact'},
|
124
|
+
"https://gedcom.io/terms/v7/MARC": {'type':'Mutation','Object':GedcomXEventOrFact,'Args':{'value':'value'},'propertyof':[Relationship],'method':'add_fact'},
|
125
|
+
"https://gedcom.io/terms/v7/MARL": {'type':'Mutation','Object':GedcomXEventOrFact,'Args':{'value':'value'},'propertyof':[Relationship],'method':'add_fact'},
|
126
|
+
"https://gedcom.io/terms/v7/MARR": {'type':'Mutation','Object':GedcomXEventOrFact,'Args':{'value':'value'},'propertyof':[Relationship],'method':'add_fact'},
|
127
|
+
"https://gedcom.io/terms/v7/MARS": {'type':'Mutation','Object':GedcomXEventOrFact,'Args':{'value':'value'},'propertyof':[Relationship],'method':'add_fact'},
|
128
|
+
"https://gedcom.io/terms/v7/MEDI": {},
|
129
|
+
"https://gedcom.io/terms/v7/MIME": {},
|
130
|
+
"https://gedcom.io/terms/v7/NAME": {},
|
131
|
+
"https://gedcom.io/terms/v7/NAME-TRAN": {},
|
132
|
+
"https://gedcom.io/terms/v7/NAME-TYPE": {},
|
133
|
+
"https://gedcom.io/terms/v7/NATI": {},
|
134
|
+
"https://gedcom.io/terms/v7/NATU": {},
|
135
|
+
"https://gedcom.io/terms/v7/NCHI": {},
|
136
|
+
"https://gedcom.io/terms/v7/NICK": {},
|
137
|
+
"https://gedcom.io/terms/v7/NMR": {},
|
138
|
+
"https://gedcom.io/terms/v7/NO": {},
|
139
|
+
"https://gedcom.io/terms/v7/NO-DATE": {},
|
140
|
+
"https://gedcom.io/terms/v7/NOTE": {},
|
141
|
+
"https://gedcom.io/terms/v7/NOTE-TRAN": {},
|
142
|
+
"https://gedcom.io/terms/v7/NPFX": {},
|
143
|
+
"https://gedcom.io/terms/v7/NSFX": {},
|
144
|
+
"https://gedcom.io/terms/v7/OBJE": {'type':'Object','Object':SourceReference,'Args':{'Id':'xref'}},
|
145
|
+
"https://gedcom.io/terms/v7/OCCU": {},
|
146
|
+
"https://gedcom.io/terms/v7/ORDN": {},
|
147
|
+
"https://gedcom.io/terms/v7/PAGE": {},
|
148
|
+
"https://gedcom.io/terms/v7/PEDI": {},
|
149
|
+
"https://gedcom.io/terms/v7/PHON": {},
|
150
|
+
"https://gedcom.io/terms/v7/PHRASE": {},
|
151
|
+
"https://gedcom.io/terms/v7/PLAC": {},
|
152
|
+
"https://gedcom.io/terms/v7/PLAC-FORM": {},
|
153
|
+
"https://gedcom.io/terms/v7/PLAC-TRAN": {},
|
154
|
+
"https://gedcom.io/terms/v7/POST": {},
|
155
|
+
"https://gedcom.io/terms/v7/PROB": {},
|
156
|
+
"https://gedcom.io/terms/v7/PROP": {},
|
157
|
+
"https://gedcom.io/terms/v7/PUBL": {},
|
158
|
+
"https://gedcom.io/terms/v7/QUAY": {},
|
159
|
+
"https://gedcom.io/terms/v7/REFN": {},
|
160
|
+
"https://gedcom.io/terms/v7/RELI": {},
|
161
|
+
"https://gedcom.io/terms/v7/REPO": {'type':'Object','Object':Resource,'Args':{'Id':'xref'}},
|
162
|
+
"https://gedcom.io/terms/v7/RESI": {},
|
163
|
+
"https://gedcom.io/terms/v7/RESN": {},
|
164
|
+
"https://gedcom.io/terms/v7/RETI": {},
|
165
|
+
"https://gedcom.io/terms/v7/ROLE": {},
|
166
|
+
"https://gedcom.io/terms/v7/SCHMA": {},
|
167
|
+
"https://gedcom.io/terms/v7/SDATE": {},
|
168
|
+
"https://gedcom.io/terms/v7/SEX": {},
|
169
|
+
"https://gedcom.io/terms/v7/SLGC": {},
|
170
|
+
"https://gedcom.io/terms/v7/SLGS": {},
|
171
|
+
"https://gedcom.io/terms/v7/SNOTE": {},
|
172
|
+
"https://gedcom.io/terms/v7/SOUR": {},
|
173
|
+
"https://gedcom.io/terms/v7/SOUR-DATA": {},
|
174
|
+
"https://gedcom.io/terms/v7/SOUR-EVEN": {},
|
175
|
+
"https://gedcom.io/terms/v7/SPFX": {},
|
176
|
+
"https://gedcom.io/terms/v7/SSN": {},
|
177
|
+
"https://gedcom.io/terms/v7/STAE": {'type':'Propertyof','propertyof':Address,'assign':{'stateOrProvince':'value'}},
|
178
|
+
"https://gedcom.io/terms/v7/STAT": {},
|
179
|
+
"https://gedcom.io/terms/v7/SUBM": {},
|
180
|
+
"https://gedcom.io/terms/v7/SUBM-LANG": {},
|
181
|
+
"https://gedcom.io/terms/v7/SURN": {'class':NamePart,
|
182
|
+
'args':{'type':NamePartType.Surname,'value':'rTextValue'}
|
183
|
+
},
|
184
|
+
"https://gedcom.io/terms/v7/TAG": {},
|
185
|
+
"https://gedcom.io/terms/v7/TEMP": {},
|
186
|
+
"https://gedcom.io/terms/v7/TEXT": {},
|
187
|
+
"https://gedcom.io/terms/v7/TIME": {},
|
188
|
+
"https://gedcom.io/terms/v7/TITL": {'type':'PropertyObject','Object':TextValue,'Args':{'value':'value'},'propertyof':[SourceDescription],'method':'add_title'},
|
189
|
+
"https://gedcom.io/terms/v7/TOP": {},
|
190
|
+
"https://gedcom.io/terms/v7/TRAN": {},
|
191
|
+
"https://gedcom.io/terms/v7/TRLR": {},
|
192
|
+
"https://gedcom.io/terms/v7/TYPE": {'type':'Object','Object':Note,'Args':{'text':'value'},'propertyof':[Fact],'method':'add_note'},
|
193
|
+
"https://gedcom.io/terms/v7/UID": {},
|
194
|
+
"https://gedcom.io/terms/v7/VERS": {},
|
195
|
+
"https://gedcom.io/terms/v7/WIDTH": {},
|
196
|
+
"https://gedcom.io/terms/v7/WIFE": {},
|
197
|
+
"https://gedcom.io/terms/v7/WILL": {},
|
198
|
+
"https://gedcom.io/terms/v7/WWW": {},
|
199
|
+
"https://gedcom.io/terms/v7/enumset-ADOP": {},
|
200
|
+
"https://gedcom.io/terms/v7/enumset-EVEN": {},
|
201
|
+
"https://gedcom.io/terms/v7/enumset-EVENATTR": {},
|
202
|
+
"https://gedcom.io/terms/v7/enumset-FAMC-STAT": {},
|
203
|
+
"https://gedcom.io/terms/v7/enumset-MEDI": {},
|
204
|
+
"https://gedcom.io/terms/v7/enumset-NAME-TYPE": {},
|
205
|
+
"https://gedcom.io/terms/v7/enumset-PEDI": {},
|
206
|
+
"https://gedcom.io/terms/v7/enumset-QUAY": {},
|
207
|
+
"https://gedcom.io/terms/v7/enumset-RESN": {},
|
208
|
+
"https://gedcom.io/terms/v7/enumset-ROLE": {},
|
209
|
+
"https://gedcom.io/terms/v7/enumset-SEX": {},
|
210
|
+
"https://gedcom.io/terms/v7/ord-STAT": {},
|
211
|
+
"https://gedcom.io/terms/v7/record-FAM": {'type':'TopLevelObject','Object':Relationship,'Args':{'id':'xref'}},
|
212
|
+
"https://gedcom.io/terms/v7/record-INDI": {'type':'TopLevelObject','Object':Person,'Args':{'id':'xref'}},
|
213
|
+
"https://gedcom.io/terms/v7/record-OBJE": {'type':'TopLevelObject','Object':SourceDescription, 'Args':{'id':'xref'}},
|
214
|
+
"https://gedcom.io/terms/v7/record-REPO": {'type':'TopLevelObject','Object':Agent,'Args':{'id':'xref'}},
|
215
|
+
"https://gedcom.io/terms/v7/record-SNOTE": {},
|
216
|
+
"https://gedcom.io/terms/v7/record-SOUR": {'type':'TopLevelObject','Object':SourceDescription,'Args':{'id':'xref'}},
|
217
|
+
"https://gedcom.io/terms/v7/record-SUBM": {'type':'Object','Object':Resource,'Args':{'Id':'xref'}},
|
218
|
+
}
|
219
|
+
|
gedcomx/URI.py
CHANGED
@@ -1,70 +1,105 @@
|
|
1
|
-
from
|
2
|
-
from
|
1
|
+
from __future__ import annotations
|
2
|
+
from dataclasses import dataclass, field
|
3
|
+
from typing import Mapping, Optional, Union, Iterable, Tuple
|
4
|
+
from urllib.parse import urlsplit, urlunsplit, urlencode, parse_qsl, SplitResult
|
3
5
|
|
6
|
+
_DEFAULT_SCHEME = "gedcomx"
|
7
|
+
|
8
|
+
@dataclass(frozen=False, slots=True)
|
4
9
|
class URI:
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
scheme=parsed_url.scheme if parsed_url.scheme else 'gedcomx',
|
11
|
-
authority=parsed_url.netloc,
|
12
|
-
path=parsed_url.path,
|
13
|
-
query=parsed_url.query,
|
14
|
-
fragment=parsed_url.fragment
|
15
|
-
)
|
16
|
-
|
17
|
-
def parse(value: str) -> None:
|
18
|
-
"""Parse the URI string and populate attributes."""
|
19
|
-
parsed = urlparse(value)
|
20
|
-
return URI(scheme=parsed.scheme,authority = parsed.netloc, path = parsed.path, query = parsed.query, fragment = parsed.fragment)
|
21
|
-
|
10
|
+
scheme: str = field(default=_DEFAULT_SCHEME)
|
11
|
+
authority: str = field(default="")
|
12
|
+
path: str = field(default="")
|
13
|
+
query: str = field(default="")
|
14
|
+
fragment: str = field(default="")
|
22
15
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
object = None) -> None:
|
30
|
-
|
31
|
-
self._scheme = scheme if scheme else 'gedcomx'
|
32
|
-
self._authority = authority
|
33
|
-
self._path = path
|
34
|
-
self._query = query
|
35
|
-
self._fragment = fragment
|
36
|
-
self._object = None
|
16
|
+
# ---------- constructors ----------
|
17
|
+
@classmethod
|
18
|
+
def from_url(cls, url: str, *, default_scheme: str = _DEFAULT_SCHEME) -> "URI":
|
19
|
+
s = urlsplit(url)
|
20
|
+
scheme = s.scheme or default_scheme
|
21
|
+
return cls(scheme=scheme, authority=s.netloc, path=s.path, query=s.query, fragment=s.fragment)
|
37
22
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
self._object._uri = self
|
23
|
+
@classmethod
|
24
|
+
def parse(cls, value: str) -> "URI":
|
25
|
+
return cls.from_url(value)
|
42
26
|
|
27
|
+
@classmethod
|
28
|
+
def from_parts(
|
29
|
+
cls,
|
30
|
+
*,
|
31
|
+
scheme: Optional[str] = None,
|
32
|
+
authority: str = "",
|
33
|
+
path: str = "",
|
34
|
+
query: Union[str, Mapping[str, str], Iterable[Tuple[str, str]]] = "",
|
35
|
+
fragment: str = ""
|
36
|
+
) -> "URI":
|
37
|
+
q = query if isinstance(query, str) else urlencode(query, doseq=True)
|
38
|
+
return cls(scheme=scheme or _DEFAULT_SCHEME, authority=authority, path=path, query=q, fragment=fragment)
|
43
39
|
|
40
|
+
# ---------- views ----------
|
44
41
|
@property
|
45
|
-
def
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
uri += f"?{self._query}"
|
55
|
-
if self._fragment:
|
56
|
-
uri += f"#{self._fragment}"
|
57
|
-
return uri
|
58
|
-
|
59
|
-
@property
|
60
|
-
def value(self):
|
61
|
-
return self._uri
|
62
|
-
|
42
|
+
def value(self) -> str:
|
43
|
+
return str(self)
|
44
|
+
|
45
|
+
def split(self) -> SplitResult:
|
46
|
+
return SplitResult(self.scheme, self.authority, self.path, self.query, self.fragment)
|
47
|
+
|
48
|
+
def __str__(self) -> str:
|
49
|
+
return urlunsplit(self.split())
|
50
|
+
|
63
51
|
@property
|
64
|
-
def _as_dict_(self):
|
65
|
-
|
66
|
-
|
67
|
-
|
52
|
+
def _as_dict_(self) -> dict:
|
53
|
+
# Keeps a simple, explicit structure
|
54
|
+
return urlunsplit(self.split())
|
55
|
+
return {
|
56
|
+
"scheme": self.scheme,
|
57
|
+
"authority": self.authority,
|
58
|
+
"path": self.path,
|
59
|
+
"query": self.query,
|
60
|
+
"fragment": self.fragment,
|
61
|
+
"value": str(self),
|
62
|
+
}
|
63
|
+
|
64
|
+
# Accepts {'resource': '...'} or a plain string, mirroring your original
|
68
65
|
@classmethod
|
69
|
-
def
|
70
|
-
|
66
|
+
def from_jsonish(cls, data: Union[str, Mapping[str, str]]) -> "URI":
|
67
|
+
if isinstance(data, str):
|
68
|
+
return cls.from_url(data)
|
69
|
+
if isinstance(data, Mapping):
|
70
|
+
raw = data.get("resource") or data.get("value") or ""
|
71
|
+
if raw:
|
72
|
+
return cls.from_url(raw)
|
73
|
+
raise ValueError(f"Cannot build URI from: {data!r}")
|
74
|
+
|
75
|
+
# ---------- functional updaters ----------
|
76
|
+
def with_scheme(self, scheme: str) -> "URI": return self.replace(scheme=scheme)
|
77
|
+
def with_authority(self, authority: str) -> "URI": return self.replace(authority=authority)
|
78
|
+
def with_path(self, path: str, *, join: bool = False) -> "URI":
|
79
|
+
new_path = (self.path.rstrip("/") + "/" + path.lstrip("/")) if join else path
|
80
|
+
return self.replace(path=new_path)
|
81
|
+
def with_fragment(self, fragment: str | None) -> "URI":
|
82
|
+
return self.replace(fragment=(fragment or ""))
|
83
|
+
def without_fragment(self) -> "URI": return self.replace(fragment="")
|
84
|
+
def with_query(self, query: Union[str, Mapping[str, str], Iterable[Tuple[str, str]]]) -> "URI":
|
85
|
+
q = query if isinstance(query, str) else urlencode(query, doseq=True)
|
86
|
+
return self.replace(query=q)
|
87
|
+
def add_query_params(self, params: Mapping[str, Union[str, Iterable[str]]]) -> "URI":
|
88
|
+
existing = parse_qsl(self.query, keep_blank_values=True)
|
89
|
+
for k, v in params.items():
|
90
|
+
if isinstance(v, str):
|
91
|
+
existing.append((k, v))
|
92
|
+
else:
|
93
|
+
for vv in v:
|
94
|
+
existing.append((k, vv))
|
95
|
+
return self.replace(query=urlencode(existing, doseq=True))
|
96
|
+
|
97
|
+
# ---------- helpers ----------
|
98
|
+
def replace(self, **kwargs) -> "URI":
|
99
|
+
return URI(
|
100
|
+
scheme=kwargs.get("scheme", self.scheme or _DEFAULT_SCHEME),
|
101
|
+
authority=kwargs.get("authority", self.authority),
|
102
|
+
path=kwargs.get("path", self.path),
|
103
|
+
query=kwargs.get("query", self.query),
|
104
|
+
fragment=kwargs.get("fragment", self.fragment),
|
105
|
+
)
|
gedcomx/Zip.py
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
import zipfile
|
gedcomx/__init__.py
CHANGED
@@ -14,26 +14,34 @@ from .Fact import Fact
|
|
14
14
|
from .Fact import FactQualifier
|
15
15
|
from .Fact import FactType
|
16
16
|
from .Gedcom import Gedcom
|
17
|
+
from .Gedcom5x import Gedcom5x
|
17
18
|
from .GedcomX import GedcomX, Translater
|
18
19
|
from .Gender import Gender, GenderType
|
19
20
|
from .Group import Group, GroupRole
|
20
|
-
from .Identifier import Identifier, IdentifierType
|
21
|
+
from .Identifier import Identifier, IdentifierType, IdentifierList
|
22
|
+
from .Logging import get_logger
|
21
23
|
from .Name import Name, NameForm, NamePart, NamePartType, NameType, NamePartQualifier
|
22
24
|
from .Note import Note
|
23
25
|
from .OnlineAccount import OnlineAccount
|
24
|
-
from .Person import Person
|
26
|
+
from .Person import Person, QuickPerson
|
25
27
|
from .PlaceDescription import PlaceDescription
|
26
28
|
from .PlaceReference import PlaceReference
|
27
29
|
from .Qualifier import Qualifier
|
28
30
|
from .Relationship import Relationship, RelationshipType
|
29
|
-
from .Serialization import
|
31
|
+
from .Serialization import Serialization
|
30
32
|
from .SourceCitation import SourceCitation
|
31
33
|
from .SourceDescription import SourceDescription
|
32
34
|
from .SourceDescription import ResourceType
|
33
35
|
from .SourceReference import SourceReference
|
34
36
|
from .Subject import Subject
|
35
37
|
from .TextValue import TextValue
|
38
|
+
from .Resource import Resource
|
36
39
|
from .URI import URI
|
37
40
|
|
41
|
+
from .Extensions.rs10.rsLink import rsLink
|
42
|
+
|
43
|
+
from .gedcom7 import Gedcom7, GedcomStructure
|
44
|
+
from .Translation import g7toXtable
|
45
|
+
|
38
46
|
|
39
47
|
|
gedcom_x-0.5.1.dist-info/RECORD
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
gedcomx/Address.py,sha256=gAi9vfSLdTBAsNpCNIV9mdOaB9ewoPpW-7Xrt6JYsPc,3672
|
2
|
-
gedcomx/Agent.py,sha256=lp_--92eEo1df0nBqV2pJJafv_Zfzfz_bNj-UlJIjJk,3478
|
3
|
-
gedcomx/Attribution.py,sha256=yVctLjdgDWp4d-uOOxHXsCyJvvGLyzkY-x2ysiYv4yc,4367
|
4
|
-
gedcomx/Conclusion.py,sha256=hymaHcHk2JayGAGpxOlJvxzxnDjPh2q67eXI9TQk50c,5240
|
5
|
-
gedcomx/Coverage.py,sha256=FuVsLDAhzS4HjNHKOHCjwQcvnxd4Uf_EeF3QcDEbems,912
|
6
|
-
gedcomx/Date.py,sha256=A21KaTl44dLnMuB2hAcZ7QbqmgaQC27LoNPl4uI3i48,741
|
7
|
-
gedcomx/Document.py,sha256=F04hRAddU5OmwAeULbXJRRAPh5CJIzeaaxFK6TI48d0,1850
|
8
|
-
gedcomx/Event.py,sha256=qZNGEYdS3jmKI0fnw1DM5zETTw7Du07A_1tr3sc02-w,9538
|
9
|
-
gedcomx/EvidenceReference.py,sha256=8LNyfnjLmXt4RbOHpRyw-VHyD2CCm33pPYuYqWIaxtg,333
|
10
|
-
gedcomx/Fact.py,sha256=7UVDiimuF8LJG7ASqVdCLKed1YWqb4YhAANI0KJLwdA,23682
|
11
|
-
gedcomx/Gedcom.py,sha256=VbPws7O0FhkvdbDQKOb_nGP0CYjS9bXxWsQkvjzQqO8,12723
|
12
|
-
gedcomx/GedcomX.py,sha256=bWNeBPxFGaVeTIbHgyEzrefk6rwq-XzI3VOkxsrp5aw,50225
|
13
|
-
gedcomx/Gender.py,sha256=98__1lMIdGLfMmUSh5jrqQ0SwQzN1xedgMiW9Gpabko,1720
|
14
|
-
gedcomx/Group.py,sha256=ayp3wZEnR8vSuPwe-KfeH8MM0uQ3HJH8NGRnHDPV58M,1586
|
15
|
-
gedcomx/Identifier.py,sha256=aFXJQNyWvfnIzUt7ALrRTtwQjSjuToCY7qLBFFVmRC8,3398
|
16
|
-
gedcomx/Name.py,sha256=cQkWDjhuF62aoRdGUBXZy6kfvXAmUz7AxWDbnZ-bWIA,11650
|
17
|
-
gedcomx/Note.py,sha256=PLElHAQ3XFwETL71UgGkmP4ir5s9nBo3X83jwrRBnTc,2132
|
18
|
-
gedcomx/OnlineAccount.py,sha256=dm9HbWWf1Xekn8grDJtWChDOR-hxrIxmIRFiPRx2SQQ,276
|
19
|
-
gedcomx/Person.py,sha256=B2zqHN8kYq4K8uRIayRxYOi6Dp7fiiv9EKd-pNDxG6U,7357
|
20
|
-
gedcomx/PlaceDescription.py,sha256=EEBWAuxHQr1Kx4PoUOOsu26g4I5ICV1emx1mQXEU1vM,1971
|
21
|
-
gedcomx/PlaceReference.py,sha256=N7kU8pjtmsru5tzD3cdyXkYlaRb7ncueyCqj9fihi6U,929
|
22
|
-
gedcomx/Qualifier.py,sha256=mZ_GWT3gca8g9nWidlXIRTN5dEtf_rmnLHYl1jJkQYs,728
|
23
|
-
gedcomx/Relationship.py,sha256=MVuIzHxw6jTFfOx-HK4VhnMxystZ_tWA3dv1cHJJQjo,4599
|
24
|
-
gedcomx/Serialization.py,sha256=LYH3HuSwTLEmM8DQyU0MTrIUBIThGy7uG45AfzDaCrA,1277
|
25
|
-
gedcomx/SourceCitation.py,sha256=WyeXHS2HbqxHCmVvcffr5xNTK8xxy68yaY_wX8seJuY,622
|
26
|
-
gedcomx/SourceDescription.py,sha256=dOg7-omwHVEI2-NaRNPh8ciXKwJ1ooZKDd3iwBzkiP0,11884
|
27
|
-
gedcomx/SourceReference.py,sha256=OpD1hQH_xA-BGw7Lt17wU9u1L98V2FBtxlNQgJrMXrc,7252
|
28
|
-
gedcomx/Subject.py,sha256=jGDYgTDIaQrECC9DtQBS2k76ik-yr39ZVDyjhQKCem8,3116
|
29
|
-
gedcomx/TextValue.py,sha256=znGDzzb-pNCaatwS7kxcUT1g_csswhnD5zebkLKmdV8,1098
|
30
|
-
gedcomx/TopLevelTypeCollection.py,sha256=nvTO6GwFwEZk9jX4fVqhy75ygsshomNb20tnlExKqyY,1495
|
31
|
-
gedcomx/URI.py,sha256=OUSCFA7oOtJ7Ya4mTJFoJawq0bZt8BDg8masb9XX-cY,2143
|
32
|
-
gedcomx/_Resource.py,sha256=JqtbinRXpt6dLUXUtqGCZ2WmcYmGRzqXmjaw8YPpnYE,242
|
33
|
-
gedcomx/__init__.py,sha256=brX-pkFLY5owEk1CKnArX5qXlpTu9PTu0mG_VG12ox4,1362
|
34
|
-
gedcom_x-0.5.1.dist-info/METADATA,sha256=r5gGfymgiW3lrAPdFVKA8ZkS8vGCs1lRNxxMvujR3RQ,633
|
35
|
-
gedcom_x-0.5.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
36
|
-
gedcom_x-0.5.1.dist-info/top_level.txt,sha256=smVBF4nxSU-mzCd6idtRYTbYjPICMMi8pTqewEmqF8Y,8
|
37
|
-
gedcom_x-0.5.1.dist-info/RECORD,,
|
gedcomx/_Resource.py
DELETED
File without changes
|
File without changes
|