forked from mirrors/bookwyrm
Python formatting for the new Black standard
This commit is contained in:
parent
85297426e0
commit
7b65291a59
3 changed files with 10 additions and 10 deletions
|
@ -8,7 +8,7 @@ from .image import Document
|
||||||
|
|
||||||
@dataclass(init=False)
|
@dataclass(init=False)
|
||||||
class BookData(ActivityObject):
|
class BookData(ActivityObject):
|
||||||
""" shared fields for all book data and authors"""
|
"""shared fields for all book data and authors"""
|
||||||
|
|
||||||
openlibraryKey: str = None
|
openlibraryKey: str = None
|
||||||
inventaireId: str = None
|
inventaireId: str = None
|
||||||
|
|
|
@ -69,7 +69,7 @@ class AbstractMinimalConnector(ABC):
|
||||||
return results
|
return results
|
||||||
|
|
||||||
def get_search_data(self, remote_id, **kwargs): # pylint: disable=no-self-use
|
def get_search_data(self, remote_id, **kwargs): # pylint: disable=no-self-use
|
||||||
""" this allows connectors to override the default behavior """
|
"""this allows connectors to override the default behavior"""
|
||||||
return get_data(remote_id, **kwargs)
|
return get_data(remote_id, **kwargs)
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
|
@ -155,7 +155,7 @@ class AbstractConnector(AbstractMinimalConnector):
|
||||||
return edition
|
return edition
|
||||||
|
|
||||||
def get_book_data(self, remote_id): # pylint: disable=no-self-use
|
def get_book_data(self, remote_id): # pylint: disable=no-self-use
|
||||||
""" this allows connectors to override the default behavior """
|
"""this allows connectors to override the default behavior"""
|
||||||
return get_data(remote_id)
|
return get_data(remote_id)
|
||||||
|
|
||||||
def create_edition_from_data(self, work, edition_data):
|
def create_edition_from_data(self, work, edition_data):
|
||||||
|
|
|
@ -6,7 +6,7 @@ from .connector_manager import ConnectorException
|
||||||
|
|
||||||
|
|
||||||
class Connector(AbstractConnector):
|
class Connector(AbstractConnector):
|
||||||
""" instantiate a connector for OL """
|
"""instantiate a connector for OL"""
|
||||||
|
|
||||||
def __init__(self, identifier):
|
def __init__(self, identifier):
|
||||||
super().__init__(identifier)
|
super().__init__(identifier)
|
||||||
|
@ -51,7 +51,7 @@ class Connector(AbstractConnector):
|
||||||
] + shared_mappings
|
] + shared_mappings
|
||||||
|
|
||||||
def get_remote_id(self, value):
|
def get_remote_id(self, value):
|
||||||
""" convert an id/uri into a url """
|
"""convert an id/uri into a url"""
|
||||||
return "{:s}?action=by-uris&uris={:s}".format(self.books_url, value)
|
return "{:s}?action=by-uris&uris={:s}".format(self.books_url, value)
|
||||||
|
|
||||||
def get_book_data(self, remote_id):
|
def get_book_data(self, remote_id):
|
||||||
|
@ -88,16 +88,16 @@ class Connector(AbstractConnector):
|
||||||
)
|
)
|
||||||
|
|
||||||
def parse_isbn_search_data(self, data):
|
def parse_isbn_search_data(self, data):
|
||||||
""" boop doop """
|
"""boop doop"""
|
||||||
|
|
||||||
def format_isbn_search_result(self, search_result):
|
def format_isbn_search_result(self, search_result):
|
||||||
""" beep bloop """
|
"""beep bloop"""
|
||||||
|
|
||||||
def is_work_data(self, data):
|
def is_work_data(self, data):
|
||||||
return data.get("type") == "work"
|
return data.get("type") == "work"
|
||||||
|
|
||||||
def load_edition_data(self, work_uri):
|
def load_edition_data(self, work_uri):
|
||||||
""" get a list of editions for a work """
|
"""get a list of editions for a work"""
|
||||||
url = "{:s}?action=reverse-claims&property=wdt:P629&value={:s}".format(
|
url = "{:s}?action=reverse-claims&property=wdt:P629&value={:s}".format(
|
||||||
self.books_url, work_uri
|
self.books_url, work_uri
|
||||||
)
|
)
|
||||||
|
@ -149,7 +149,7 @@ class Connector(AbstractConnector):
|
||||||
return "%s%s" % (self.covers_url, cover_id)
|
return "%s%s" % (self.covers_url, cover_id)
|
||||||
|
|
||||||
def resolve_keys(self, keys):
|
def resolve_keys(self, keys):
|
||||||
""" cool, it's "wd:Q3156592" now what the heck does that mean """
|
"""cool, it's "wd:Q3156592" now what the heck does that mean"""
|
||||||
results = []
|
results = []
|
||||||
for uri in keys:
|
for uri in keys:
|
||||||
try:
|
try:
|
||||||
|
@ -161,5 +161,5 @@ class Connector(AbstractConnector):
|
||||||
|
|
||||||
|
|
||||||
def get_language_code(options, code="en"):
|
def get_language_code(options, code="en"):
|
||||||
""" when there are a bunch of translation but we need a single field """
|
"""when there are a bunch of translation but we need a single field"""
|
||||||
return options.get(code)
|
return options.get(code)
|
||||||
|
|
Loading…
Reference in a new issue