rara-tools 0.7.11__py3-none-any.whl → 0.7.13__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.
Potentially problematic release.
This version of rara-tools might be problematic. Click here for more details.
- rara_tools/core_formatters/formatted_meta.py +11 -1
- rara_tools/normalizers/authorities.py +3 -0
- rara_tools/normalizers/base.py +25 -5
- {rara_tools-0.7.11.dist-info → rara_tools-0.7.13.dist-info}/METADATA +1 -1
- {rara_tools-0.7.11.dist-info → rara_tools-0.7.13.dist-info}/RECORD +8 -8
- {rara_tools-0.7.11.dist-info → rara_tools-0.7.13.dist-info}/WHEEL +0 -0
- {rara_tools-0.7.11.dist-info → rara_tools-0.7.13.dist-info}/licenses/LICENSE.md +0 -0
- {rara_tools-0.7.11.dist-info → rara_tools-0.7.13.dist-info}/top_level.txt +0 -0
|
@@ -56,7 +56,17 @@ class FormattedAuthor(FormattedObject):
|
|
|
56
56
|
|
|
57
57
|
@property
|
|
58
58
|
def name(self) -> str:
|
|
59
|
-
|
|
59
|
+
""" Force all names into format <last_name>, <first_name>.
|
|
60
|
+
"""
|
|
61
|
+
if "," in self.entity:
|
|
62
|
+
name = self.entity
|
|
63
|
+
else:
|
|
64
|
+
name_tokens = self.entity.rsplit(" ", 1)
|
|
65
|
+
if len(name_tokens) == 2:
|
|
66
|
+
name = f"{name_tokens[1]}, {name_tokens[0]}"
|
|
67
|
+
else:
|
|
68
|
+
name = self.entity
|
|
69
|
+
return name
|
|
60
70
|
|
|
61
71
|
@property
|
|
62
72
|
def name_order(self) -> str:
|
|
@@ -59,6 +59,9 @@ class AuthoritiesRecordNormalizer(RecordNormalizer):
|
|
|
59
59
|
record, "046", "f", formatted_birth_date)
|
|
60
60
|
death_date = self.get_subfield(
|
|
61
61
|
record, "046", "g", formatted_death_date)
|
|
62
|
+
|
|
63
|
+
if not birth_date and not death_date:
|
|
64
|
+
return
|
|
62
65
|
|
|
63
66
|
subfields_046 = [
|
|
64
67
|
Subfield("f", birth_date),
|
rara_tools/normalizers/base.py
CHANGED
|
@@ -213,13 +213,33 @@ class RecordNormalizer:
|
|
|
213
213
|
)
|
|
214
214
|
|
|
215
215
|
def _add_fields_to_record(self, record: Record, fields: List[Field]) -> Record:
|
|
216
|
-
|
|
216
|
+
cleaned_fields = []
|
|
217
|
+
|
|
217
218
|
for field in fields:
|
|
218
|
-
field.subfields = [sub for sub in field.subfields if sub.value and sub.value not in ["0", 0]]
|
|
219
219
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
220
|
+
# Always assume control fields cleaned
|
|
221
|
+
if field.tag < "010" and field.tag.isdigit():
|
|
222
|
+
cleaned_fields.append(field)
|
|
223
|
+
continue
|
|
224
|
+
|
|
225
|
+
# filter out subfields that are empty or 0 (VIAF returns 0 for unknown dates)
|
|
226
|
+
field.subfields = [
|
|
227
|
+
sub for sub in field.subfields
|
|
228
|
+
if sub.value and sub.value not in ["0", 0]
|
|
229
|
+
]
|
|
230
|
+
|
|
231
|
+
# only keep the field if it still has subfields left
|
|
232
|
+
if field.subfields:
|
|
233
|
+
cleaned_fields.append(field)
|
|
234
|
+
|
|
235
|
+
if not cleaned_fields:
|
|
236
|
+
return record
|
|
237
|
+
|
|
238
|
+
self._handle_repeatable_fields(record, *cleaned_fields)
|
|
239
|
+
self._handle_editable_fields(record, *cleaned_fields)
|
|
240
|
+
self._handle_default_fields(record, *cleaned_fields)
|
|
241
|
+
|
|
242
|
+
return record
|
|
223
243
|
|
|
224
244
|
def _add_author(self, record: Record, viaf_record: VIAFRecord) -> Optional[Field]:
|
|
225
245
|
|
|
@@ -17,11 +17,11 @@ rara_tools/constants/parsers.py,sha256=L6nh1Itget9_9DMsliDkh6T25z78eMFPWVkbaU08D
|
|
|
17
17
|
rara_tools/constants/subject_indexer.py,sha256=0snyyB8IMCWXOYPXR_c0Kavq4nBiww559rdNOKjawx8,2133
|
|
18
18
|
rara_tools/core_formatters/core_formatter.py,sha256=u_Cdgv9qBcyF-XddjaRGUqAFik9OMAdSzAulXpYR7vE,4997
|
|
19
19
|
rara_tools/core_formatters/formatted_keyword.py,sha256=hhi6wh4ErFionjBqYsEeKGbf1CACF7c5hu2XPaZDidc,7990
|
|
20
|
-
rara_tools/core_formatters/formatted_meta.py,sha256=
|
|
20
|
+
rara_tools/core_formatters/formatted_meta.py,sha256=WEnMs8K0YeTLGjXn_mxQTpshxcz5_9YjvqcbRFa3M1g,5605
|
|
21
21
|
rara_tools/core_formatters/formatted_object.py,sha256=7a499ZmcZXOqtlwxDi6FWHWF5a6HdCsduS22wV3uHIE,5656
|
|
22
22
|
rara_tools/normalizers/__init__.py,sha256=_NqpS5w710DhaURytHq9JpEt8HgYpSPfRDcOtOymJgE,193
|
|
23
|
-
rara_tools/normalizers/authorities.py,sha256=
|
|
24
|
-
rara_tools/normalizers/base.py,sha256=
|
|
23
|
+
rara_tools/normalizers/authorities.py,sha256=w7r2KIFSnmo57Pt9YGsxYYCH8AkdNkiBBFHhpf1GLJA,4794
|
|
24
|
+
rara_tools/normalizers/base.py,sha256=LzWdjzG_5zFGbzOCpUSOdmzrJJ7p23iODEtar8wDrrY,15942
|
|
25
25
|
rara_tools/normalizers/bibs.py,sha256=7H-spiqj6x8Xk4JQkBY5GK7q5pKjYUmXTRFf0RgzC-w,4040
|
|
26
26
|
rara_tools/normalizers/reader.py,sha256=GYCkAtnsNx135w5lD-_MqCZzdHQHHPDF-pDxYj839Vo,1595
|
|
27
27
|
rara_tools/normalizers/viaf.py,sha256=C-NfbvL83ZcHVB9ICMw43wAMYKTqDTHU3ZT2mXKec00,24288
|
|
@@ -39,8 +39,8 @@ rara_tools/parsers/marc_records/title_record.py,sha256=XrtJ4gj7wzSaGxNaPtPuawmqq
|
|
|
39
39
|
rara_tools/parsers/tools/entity_normalizers.py,sha256=VyCy_NowCLpOsL0luQ55IW-Qi-J5oBH0Ofzr7HRFBhM,8949
|
|
40
40
|
rara_tools/parsers/tools/marc_converter.py,sha256=LgSHe-7n7aiDrw2bnsB53r3fXTRFjZXTwBYfTpL0pfs,415
|
|
41
41
|
rara_tools/parsers/tools/russian_transliterator.py,sha256=5ZU66iTqAhr7pmfVqXPAI_cidF43VqqmuN4d7H4_JuA,9770
|
|
42
|
-
rara_tools-0.7.
|
|
43
|
-
rara_tools-0.7.
|
|
44
|
-
rara_tools-0.7.
|
|
45
|
-
rara_tools-0.7.
|
|
46
|
-
rara_tools-0.7.
|
|
42
|
+
rara_tools-0.7.13.dist-info/licenses/LICENSE.md,sha256=hkZVnIZll7e_KNEQzeY94Y9tlzVL8iVZBTMBvDykksU,35142
|
|
43
|
+
rara_tools-0.7.13.dist-info/METADATA,sha256=WOwPPJ8wE9B-0Mpf9BCWQalBzTaRg9L4GvpAhFK0PnI,4080
|
|
44
|
+
rara_tools-0.7.13.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
45
|
+
rara_tools-0.7.13.dist-info/top_level.txt,sha256=JwfB5b8BAtW5OFKRln2AQ_WElTRyIBM4nO0FKN1cupY,11
|
|
46
|
+
rara_tools-0.7.13.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|