From 32391dd64d129bac618d15a0ebdd3da8eae85d9b Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Wed, 29 Sep 2021 12:38:31 -0700 Subject: [PATCH] Python formatting --- bookwyrm/connectors/abstract_connector.py | 6 ++++-- bookwyrm/connectors/inventaire.py | 2 +- bookwyrm/connectors/openlibrary.py | 12 ++++++++++-- bookwyrm/migrations/0101_auto_20210929_1847.py | 2 +- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/bookwyrm/connectors/abstract_connector.py b/bookwyrm/connectors/abstract_connector.py index 175253490..060b7182d 100644 --- a/bookwyrm/connectors/abstract_connector.py +++ b/bookwyrm/connectors/abstract_connector.py @@ -314,8 +314,9 @@ class Mapping: except: # pylint: disable=bare-except return None + def infer_physical_format(format_text): - """ try to figure out what the standardized format is from the free value """ + """try to figure out what the standardized format is from the free value""" format_text = format_text.lower() if format_text in format_mappings: # try a direct match @@ -327,8 +328,9 @@ def infer_physical_format(format_text): return None return matches[0] + def unique_physical_format(format_text): - """ only store the format if it isn't diretly in the format mappings""" + """only store the format if it isn't diretly in the format mappings""" format_text = format_text.lower() if format_text in format_mappings: # try a direct match, so saving this would be redundant diff --git a/bookwyrm/connectors/inventaire.py b/bookwyrm/connectors/inventaire.py index 704554880..1bfd2b500 100644 --- a/bookwyrm/connectors/inventaire.py +++ b/bookwyrm/connectors/inventaire.py @@ -8,7 +8,7 @@ from .connector_manager import ConnectorException class Connector(AbstractConnector): - """instantiate a connector for OL""" + """instantiate a connector for inventaire""" def __init__(self, identifier): super().__init__(identifier) diff --git a/bookwyrm/connectors/openlibrary.py b/bookwyrm/connectors/openlibrary.py index 5177f665f..ef8a7b3db 100644 --- a/bookwyrm/connectors/openlibrary.py +++ b/bookwyrm/connectors/openlibrary.py @@ -43,8 +43,16 @@ class Connector(AbstractConnector): ), Mapping("publishedDate", remote_field="publish_date"), Mapping("pages", remote_field="number_of_pages"), - Mapping("physicalFormat", remote_field="physical_format", formatter=infer_physical_format), - Mapping("physicalFormatDetail", remote_field="physical_format", formatter=unique_physical_format), + Mapping( + "physicalFormat", + remote_field="physical_format", + formatter=infer_physical_format, + ), + Mapping( + "physicalFormatDetail", + remote_field="physical_format", + formatter=unique_physical_format, + ), Mapping("publishers"), ] diff --git a/bookwyrm/migrations/0101_auto_20210929_1847.py b/bookwyrm/migrations/0101_auto_20210929_1847.py index 2acaa127e..3fca28eac 100644 --- a/bookwyrm/migrations/0101_auto_20210929_1847.py +++ b/bookwyrm/migrations/0101_auto_20210929_1847.py @@ -27,7 +27,7 @@ def reverse(app_registry, schema_editor): class Migration(migrations.Migration): dependencies = [ - ('bookwyrm', '0100_shelf_description'), + ("bookwyrm", "0100_shelf_description"), ] operations = [