Skip to content

Commit 48d7bb3

Browse files
committed
🎨 Reformat with Black
1 parent 6649006 commit 48d7bb3

File tree

2 files changed

+19
-12
lines changed

2 files changed

+19
-12
lines changed

src/mods4pandas/lib.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,6 @@ def convert_db_to_parquet(con, table, index_col, output_file):
457457
def sqlite3_column_exists(con, table, col):
458458
"""Check if column col exists in table."""
459459
cur = con.execute(
460-
"SELECT 1 FROM pragma_table_info(?) WHERE name = ? LIMIT 1",
461-
(table, col)
460+
"SELECT 1 FROM pragma_table_info(?) WHERE name = ? LIMIT 1", (table, col)
462461
)
463462
return cur.fetchone() is not None

src/mods4pandas/mods4pandas.py

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -162,17 +162,19 @@ def has_event_type(origin_info):
162162
.descend(raise_errors)
163163
)
164164
elif tag == "{http://www.loc.gov/mods/v3}recordIdentifier":
165+
165166
def no_uuid(record_identifier):
166167
return record_identifier.attrib.get("type") != "uuid"
167168

168169
# By default we assume source="gbv-ppn" mods:recordIdentifiers (= PPNs),
169170
# however, in mods:relatedItems, there may be source="dnb-ppns",
170171
# which we need to distinguish by using a separate field name.
171172

172-
for field_name, source in \
173-
("recordIdentifier", "gbv-ppn"), \
174-
("recordIdentifier-dnb-ppn", "dnb-ppn"), \
175-
("recordIdentifier-zdb", "zdb"):
173+
for field_name, source in (
174+
("recordIdentifier", "gbv-ppn"),
175+
("recordIdentifier-dnb-ppn", "dnb-ppn"),
176+
("recordIdentifier-zdb", "zdb"),
177+
):
176178
try:
177179
value[field_name] = (
178180
TagGroup(tag, group)
@@ -525,7 +527,9 @@ def validate_mets_files(ctx, param, mets_files):
525527

526528

527529
@click.command()
528-
@click.argument("mets_files", type=click.Path(exists=True), nargs=-1, callback=validate_mets_files)
530+
@click.argument(
531+
"mets_files", type=click.Path(exists=True), nargs=-1, callback=validate_mets_files
532+
)
529533
@click.option(
530534
"--output",
531535
"-o",
@@ -539,9 +543,13 @@ def validate_mets_files(ctx, param, mets_files):
539543
"--output-page-info", type=click.Path(), help="Output page info Parquet file"
540544
)
541545
@click.option(
542-
"--mets-files-list", type=click.Path(), help="Read list of METS files from this file"
546+
"--mets-files-list",
547+
type=click.Path(),
548+
help="Read list of METS files from this file",
543549
)
544-
def process_command(mets_files: list[str], output_file: str, output_page_info: str, mets_files_list: str):
550+
def process_command(
551+
mets_files: list[str], output_file: str, output_page_info: str, mets_files_list: str
552+
):
545553
"""
546554
A tool to convert the MODS metadata in METS_FILES to a pandas DataFrame.
547555
@@ -558,9 +566,9 @@ def process_command(mets_files: list[str], output_file: str, output_page_info: s
558566
process(mets_files, output_file, output_page_info, mets_files_list)
559567

560568

561-
562-
563-
def process(mets_files: list[str], output_file: str, output_page_info: str, mets_files_list: str):
569+
def process(
570+
mets_files: list[str], output_file: str, output_page_info: str, mets_files_list: str
571+
):
564572
mets_files_real: list[str] = []
565573

566574
if mets_files_list:

0 commit comments

Comments
 (0)