diff --git a/inputs/Individuals.json b/inputs/Individuals.json index 8e0dd8c..6b32792 100644 --- a/inputs/Individuals.json +++ b/inputs/Individuals.json @@ -12096,7 +12096,7 @@ "sources": [ "‘Laves, Georg’, RKD Artists https://rkd.nl/artists/431018", "‘Laves, Georg Heinrich Wilhelm’ in: F. Noack, Das Deutschtum in Rom seit dem Ausgang des Mittelalters (Stuttgart/Berlin/Leipzig 1927) vol. 2, p. 348", - "H. Knocke, ‘Laves, Georg Heinrich Wilhelm’, in: D. Böttcher, Dirk, K. Mlynek et al. (ed.), Hannoversches Biographisches Lexikon (Hannover 2002) pp. 224-225" + "H. Knocke, ‘Laves, Georg Heinrich Wilhelm’, in: D. Böttcher, Dirk, K. Mlynek et al. (ed.), Hannoversches Biographisches Lexikon (Hannover 2002) pp. 224-225" ], "sources_other": [], "surname": "Laves", diff --git a/python/data_parsing/__init__.py b/python/data_parsing/__init__.py index 303a2bb..1640263 100644 --- a/python/data_parsing/__init__.py +++ b/python/data_parsing/__init__.py @@ -7,9 +7,9 @@ ) __all__ = [ + "control_title", "full_name_with_database", - "name_string", - "initialize_translation_database", "initialize_database_for_xml", - "control_title", + "initialize_translation_database", + "name_string", ] diff --git a/python/data_parsing/load_database.py b/python/data_parsing/load_database.py index 67c626d..844b735 100644 --- a/python/data_parsing/load_database.py +++ b/python/data_parsing/load_database.py @@ -4,9 +4,9 @@ from typing_utils import Database, TranslationDictCleaned, TranslationDictCleanedTitles -def initialize_translation_database() -> ( - tuple[TranslationDictCleanedTitles, TranslationDictCleaned, TranslationDictCleaned] -): +def initialize_translation_database() -> tuple[ + TranslationDictCleanedTitles, TranslationDictCleaned, TranslationDictCleaned +]: """Reads the files containing all translations of titles and functions.""" with open("inputs/Translations/Titles.json", encoding="utf-8") as file: titles = json.load(file) diff --git a/python/database_controls/__init__.py b/python/database_controls/__init__.py index 0fb8cc2..90487af 100644 --- a/python/database_controls/__init__.py +++ b/python/database_controls/__init__.py @@ -11,9 +11,9 @@ "check_all_comments", "check_all_placenames", "check_all_sources", + "check_translations", "control_date", "control_functions", "control_titles", - "check_translations", "is_isni", ] diff --git a/python/database_searches/__init__.py b/python/database_searches/__init__.py index 84fd8f2..02d97a3 100644 --- a/python/database_searches/__init__.py +++ b/python/database_searches/__init__.py @@ -2,8 +2,8 @@ from database_searches.search_wikidata import search_wikidata, unspecified_wikidate __all__ = [ - "search_wikidata", - "unspecified_wikidate", "convert_wikidata_to_isni", "search_isni_api", + "search_wikidata", + "unspecified_wikidate", ] diff --git a/python/date_functions/__init__.py b/python/date_functions/__init__.py index 3e1f087..14c84ba 100644 --- a/python/date_functions/__init__.py +++ b/python/date_functions/__init__.py @@ -8,10 +8,10 @@ __all__ = [ "check_date", "check_date_earlier", + "check_date_for_missing_elements", "check_date_later", - "create_document_date", - "extract_date", "create_date_data", - "check_date_for_missing_elements", "create_date_tuple", + "create_document_date", + "extract_date", ] diff --git a/python/date_functions/check_date_for_earlylate.py b/python/date_functions/check_date_for_earlylate.py index 7abf7a4..11169a2 100644 --- a/python/date_functions/check_date_for_earlylate.py +++ b/python/date_functions/check_date_for_earlylate.py @@ -22,15 +22,15 @@ def check_date_earlier( or isinstance(row[4].value, date) ): raise ValueError(f"Excel cells should not be dates. Please check {row}") - if not row[2].value or early_date[0] is not None and int(row[2].value) > int(early_date[0]): + if not row[2].value or (early_date[0] is not None and int(row[2].value) > int(early_date[0])): return early_date if early_date[0] is not None and int(row[2].value) < int(early_date[0]): return row[2].value, row[3].value, row[4].value - if not row[3].value or early_date[1] is not None and int(row[3].value) > int(early_date[1]): + if not row[3].value or (early_date[1] is not None and int(row[3].value) > int(early_date[1])): return early_date if early_date[1] is not None and int(row[3].value) < int(early_date[1]): return row[2].value, row[3].value, row[4].value - if not row[4].value or early_date[2] is not None and int(row[4].value) > int(early_date[2]): + if not row[4].value or (early_date[2] is not None and int(row[4].value) > int(early_date[2])): return early_date if early_date[2] is not None and int(row[4].value) < int(early_date[2]): return row[2].value, row[3].value, row[4].value @@ -56,15 +56,15 @@ def check_date_later( or isinstance(row[4].value, date) ): raise ValueError(f"Excel cells should not be dates. Please check {row}") - if not row[2].value or late_date[0] is not None and int(row[2].value) < int(late_date[0]): + if not row[2].value or (late_date[0] is not None and int(row[2].value) < int(late_date[0])): return late_date if late_date[0] is not None and int(row[2].value) > int(late_date[0]): return row[2].value, row[3].value, row[4].value - if not row[3].value or late_date[1] is not None and int(row[3].value) < int(late_date[1]): + if not row[3].value or (late_date[1] is not None and int(row[3].value) < int(late_date[1])): return late_date if late_date[1] is not None and int(row[3].value) > int(late_date[1]): return row[2].value, row[3].value, row[4].value - if not row[4].value or late_date[2] is not None and int(row[4].value) < int(late_date[2]): + if not row[4].value or (late_date[2] is not None and int(row[4].value) < int(late_date[2])): return late_date if late_date[2] is not None and int(row[4].value) > int(late_date[2]): return row[2].value, row[3].value, row[4].value diff --git a/python/json_create_descriptive_stats.py b/python/json_create_descriptive_stats.py index 8419d55..8e56bbb 100644 --- a/python/json_create_descriptive_stats.py +++ b/python/json_create_descriptive_stats.py @@ -62,7 +62,7 @@ def create_type_statistics(filename: str, type_list: list[int], skip: bool) -> N if data["wikidata:id"]: c_wikidata += 1 start_string = " Number of entries with" - if type_list != [] and skip or type_list != [0, 1, 2, 3, 4, 5] and not skip: + if (type_list != [] and skip) or (type_list != [0, 1, 2, 3, 4, 5] and not skip): type_string = f"the types {' and '.join(str(i) for i in type_list)}:" else: type_string = "the full database:" @@ -71,20 +71,22 @@ def create_type_statistics(filename: str, type_list: list[int], skip: bool) -> N print(f"For the entries excluding {type_string}") else: print(f"For the entries of {type_string}") - print(f"{start_string} ISNI id: {c_isni}, {c_isni/c_surname:.2%}") - print(f"{start_string} 'Daniel' comment: {c_comment_daniel}, {c_comment_daniel/c_surname:.2%}") - print(f"{start_string} birth dates: {c_date_of_birth}, {c_date_of_birth/c_surname:.2%}") - print(f"{start_string} death dates: {c_date_of_death}, {c_date_of_death/c_surname:.2%}") - print(f"{start_string} functions: {c_functions}, {c_functions/c_surname:.2%}") - print(f"{start_string} images: {c_images}, {c_images/c_surname:.2%}") - print(f"{start_string} name: {c_name}, {c_name/c_surname:.2%}") - print(f"{start_string} place of birth: {c_place_of_birth}, {c_place_of_birth/c_surname:.2%}") - print(f"{start_string} place of death: {c_place_of_death}, {c_place_of_death/c_surname:.2%}") - print(f"{start_string} sources: {c_sources}, {c_sources/c_surname:.2%}") - print(f"{start_string} sources other: {c_sources_other}, {c_sources_other/c_surname:.2%}") - print(f"{start_string} surname: {c_surname}, {c_surname/c_surname:.2%}") - print(f"{start_string} titles: {c_titles}, {c_titles/c_surname:.2%}") - print(f"{start_string} wikidata id: {c_wikidata}, {c_wikidata/c_surname:.2%}") + print(f"{start_string} ISNI id: {c_isni}, {c_isni / c_surname:.2%}") + print( + f"{start_string} 'Daniel' comment: {c_comment_daniel}, {c_comment_daniel / c_surname:.2%}" + ) + print(f"{start_string} birth dates: {c_date_of_birth}, {c_date_of_birth / c_surname:.2%}") + print(f"{start_string} death dates: {c_date_of_death}, {c_date_of_death / c_surname:.2%}") + print(f"{start_string} functions: {c_functions}, {c_functions / c_surname:.2%}") + print(f"{start_string} images: {c_images}, {c_images / c_surname:.2%}") + print(f"{start_string} name: {c_name}, {c_name / c_surname:.2%}") + print(f"{start_string} place of birth: {c_place_of_birth}, {c_place_of_birth / c_surname:.2%}") + print(f"{start_string} place of death: {c_place_of_death}, {c_place_of_death / c_surname:.2%}") + print(f"{start_string} sources: {c_sources}, {c_sources / c_surname:.2%}") + print(f"{start_string} sources other: {c_sources_other}, {c_sources_other / c_surname:.2%}") + print(f"{start_string} surname: {c_surname}, {c_surname / c_surname:.2%}") + print(f"{start_string} titles: {c_titles}, {c_titles / c_surname:.2%}") + print(f"{start_string} wikidata id: {c_wikidata}, {c_wikidata / c_surname:.2%}") def create_total_statistics(filename: str) -> None: @@ -104,12 +106,12 @@ def create_total_statistics(filename: str) -> None: start_string = " Number of entries with" total_count = len(persons.keys()) print("For the full database:") - print(f"{start_string} type 0: {c_types[0]}, {c_types[0]/total_count:.2%}") - print(f"{start_string} type 1: {c_types[1]}, {c_types[1]/total_count:.2%}") - print(f"{start_string} type 2: {c_types[2]}, {c_types[2]/total_count:.2%}") - print(f"{start_string} type 3: {c_types[3]}, {c_types[3]/total_count:.2%}") - print(f"{start_string} type 4: {c_types[4]}, {c_types[4]/total_count:.2%}") - print(f"{start_string} type 5: {c_types[5]}, {c_types[5]/total_count:.2%}") + print(f"{start_string} type 0: {c_types[0]}, {c_types[0] / total_count:.2%}") + print(f"{start_string} type 1: {c_types[1]}, {c_types[1] / total_count:.2%}") + print(f"{start_string} type 2: {c_types[2]}, {c_types[2] / total_count:.2%}") + print(f"{start_string} type 3: {c_types[3]}, {c_types[3] / total_count:.2%}") + print(f"{start_string} type 4: {c_types[4]}, {c_types[4] / total_count:.2%}") + print(f"{start_string} type 5: {c_types[5]}, {c_types[5] / total_count:.2%}") if __name__ == "__main__": diff --git a/python/json_geonames.py b/python/json_geonames.py index 89be83b..5b786f5 100644 --- a/python/json_geonames.py +++ b/python/json_geonames.py @@ -66,8 +66,8 @@ def update_placenames_with_geonames(filename: str) -> None: "S", }: # Places, islands, seas or estates raise ValueError( - f"""Geonames ID for {value['en_GB']} is not a place, island or sea. - Please check https://www.geonames.org/{value['geonames_id']}""" + f"""Geonames ID for {value["en_GB"]} is not a place, island or sea. + Please check https://www.geonames.org/{value["geonames_id"]}""" ) # Populate fields diff --git a/python/typing_utils/__init__.py b/python/typing_utils/__init__.py index a28879a..39e0050 100644 --- a/python/typing_utils/__init__.py +++ b/python/typing_utils/__init__.py @@ -17,22 +17,22 @@ ) __all__ = [ - "TranslationDictCleanedTitles", - "TranslationDictEntry", - "TranslationDictPlacenames", + "Database", + "DateData", + "DateTuple", + "FileData", + "IndividualsDict", + "IndividualsDictCleaned", + "IndividualsDictEntry", + "SeriesData", "TranslationDict", "TranslationDictCleaned", "TranslationDictCleanedDocuments", "TranslationDictCleanedPlacenames", - "TranslationDictTitles", - "TranslationDictEntryTitles", - "IndividualsDictEntry", + "TranslationDictCleanedTitles", + "TranslationDictEntry", "TranslationDictEntryPlacenames", - "IndividualsDict", - "IndividualsDictCleaned", - "Database", - "SeriesData", - "DateData", - "FileData", - "DateTuple", + "TranslationDictEntryTitles", + "TranslationDictPlacenames", + "TranslationDictTitles", ] diff --git a/python/xlsx_functions/__init__.py b/python/xlsx_functions/__init__.py index 1f5917b..5b628c1 100644 --- a/python/xlsx_functions/__init__.py +++ b/python/xlsx_functions/__init__.py @@ -6,11 +6,11 @@ from xlsx_functions.translate import translate_xlsx __all__ = [ + "add_identifier_columns", + "compare_rows", "fill_in_xlsx", "parse_file", "parse_series", "sanitize_xlsx", "translate_xlsx", - "compare_rows", - "add_identifier_columns", ] diff --git a/python/xml_functions/__init__.py b/python/xml_functions/__init__.py index cc39341..a469e96 100644 --- a/python/xml_functions/__init__.py +++ b/python/xml_functions/__init__.py @@ -6,12 +6,12 @@ from xml_functions.xml_writer import XMLWriter __all__ = [ - "add_unitdate", + "XMLWriter", + "add_dao", "add_dateset", "add_geognames", "add_persname", + "add_unitdate", "add_unittitle", "fix_daoset", - "add_dao", - "XMLWriter", ] diff --git a/python/xml_make_ead.py b/python/xml_make_ead.py index cb515cf..ab4c702 100644 --- a/python/xml_make_ead.py +++ b/python/xml_make_ead.py @@ -104,9 +104,9 @@ def _create_xml_file(self) -> None: for i in self.database.document_titles.keys() if i not in self.used_translations ) - assert ( - not unused_translations - ), f"Found the following unused translations:\n{unused_translations}" + assert not unused_translations, ( + f"Found the following unused translations:\n{unused_translations}" + ) # Make sure there are no missing translations with open(self.log_missing_translations, encoding="utf-8") as log: