mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-30 13:31:08 +00:00
Python formatting
This commit is contained in:
parent
0aef011258
commit
32391dd64d
4 changed files with 16 additions and 6 deletions
|
@ -314,6 +314,7 @@ class Mapping:
|
||||||
except: # pylint: disable=bare-except
|
except: # pylint: disable=bare-except
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def infer_physical_format(format_text):
|
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()
|
format_text = format_text.lower()
|
||||||
|
@ -327,6 +328,7 @@ def infer_physical_format(format_text):
|
||||||
return None
|
return None
|
||||||
return matches[0]
|
return matches[0]
|
||||||
|
|
||||||
|
|
||||||
def unique_physical_format(format_text):
|
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()
|
format_text = format_text.lower()
|
||||||
|
|
|
@ -8,7 +8,7 @@ from .connector_manager import ConnectorException
|
||||||
|
|
||||||
|
|
||||||
class Connector(AbstractConnector):
|
class Connector(AbstractConnector):
|
||||||
"""instantiate a connector for OL"""
|
"""instantiate a connector for inventaire"""
|
||||||
|
|
||||||
def __init__(self, identifier):
|
def __init__(self, identifier):
|
||||||
super().__init__(identifier)
|
super().__init__(identifier)
|
||||||
|
|
|
@ -43,8 +43,16 @@ class Connector(AbstractConnector):
|
||||||
),
|
),
|
||||||
Mapping("publishedDate", remote_field="publish_date"),
|
Mapping("publishedDate", remote_field="publish_date"),
|
||||||
Mapping("pages", remote_field="number_of_pages"),
|
Mapping("pages", remote_field="number_of_pages"),
|
||||||
Mapping("physicalFormat", remote_field="physical_format", formatter=infer_physical_format),
|
Mapping(
|
||||||
Mapping("physicalFormatDetail", remote_field="physical_format", formatter=unique_physical_format),
|
"physicalFormat",
|
||||||
|
remote_field="physical_format",
|
||||||
|
formatter=infer_physical_format,
|
||||||
|
),
|
||||||
|
Mapping(
|
||||||
|
"physicalFormatDetail",
|
||||||
|
remote_field="physical_format",
|
||||||
|
formatter=unique_physical_format,
|
||||||
|
),
|
||||||
Mapping("publishers"),
|
Mapping("publishers"),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ def reverse(app_registry, schema_editor):
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('bookwyrm', '0100_shelf_description'),
|
("bookwyrm", "0100_shelf_description"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
Loading…
Reference in a new issue