From 53a0b232309806a6fddf5ba21df417865d09d40c Mon Sep 17 00:00:00 2001 From: Timmy Welch Date: Thu, 15 Dec 2022 20:21:53 -0800 Subject: [PATCH] Collapse formatting --- comicapi/filenameparser.py | 11 ++--------- comictaggerlib/issueidentifier.py | 7 +------ comictaggerlib/issueselectionwindow.py | 6 +----- comictaggerlib/log.py | 5 +---- comictaggerlib/optionalmsgdialog.py | 5 +---- comictaggerlib/taggerwindow.py | 9 ++------- comictalker/talkerbase.py | 7 +------ comictalker/talkers/comicvine.py | 16 +++------------- 8 files changed, 12 insertions(+), 54 deletions(-) diff --git a/comicapi/filenameparser.py b/comicapi/filenameparser.py index 14cc060..92911ff 100644 --- a/comicapi/filenameparser.py +++ b/comicapi/filenameparser.py @@ -995,11 +995,7 @@ def get_remainder(p: Parser) -> str: ] and i > 0 and inp[i - 1].typ - in [ - filenamelexer.ItemType.LeftBrace, - filenamelexer.ItemType.LeftParen, - filenamelexer.ItemType.LeftSBrace, - ] + in [filenamelexer.ItemType.LeftBrace, filenamelexer.ItemType.LeftParen, filenamelexer.ItemType.LeftSBrace] ): remainder = remainder.rstrip("[{(") continue @@ -1108,10 +1104,7 @@ def join_title(lst: list[filenamelexer.Item]) -> str: if item.typ == filenamelexer.ItemType.Honorific and lst[i + 1].typ == filenamelexer.ItemType.Dot: continue # No space if the next item is an operator or symbol - if lst[i + 1].typ in [ - filenamelexer.ItemType.Operator, - filenamelexer.ItemType.Symbol, - ]: + if lst[i + 1].typ in [filenamelexer.ItemType.Operator, filenamelexer.ItemType.Symbol]: continue # Add a space diff --git a/comictaggerlib/issueidentifier.py b/comictaggerlib/issueidentifier.py index a39cba8..2657afe 100644 --- a/comictaggerlib/issueidentifier.py +++ b/comictaggerlib/issueidentifier.py @@ -480,12 +480,7 @@ class IssueIdentifier: alt_urls = issue["alt_image_urls"] score_item = self.get_issue_cover_match_score( - issue["id"], - image_url, - thumb_url, - alt_urls, - hash_list, - use_remote_alternates=False, + issue["id"], image_url, thumb_url, alt_urls, hash_list, use_remote_alternates=False ) except Exception: logger.exception("Scoring series failed") diff --git a/comictaggerlib/issueselectionwindow.py b/comictaggerlib/issueselectionwindow.py index dc51dc3..671dc7e 100644 --- a/comictaggerlib/issueselectionwindow.py +++ b/comictaggerlib/issueselectionwindow.py @@ -109,11 +109,7 @@ class IssueSelectionWindow(QtWidgets.QDialog): self.issue_list = self.talker_api.fetch_issues_by_volume(self.series_id) except TalkerError as e: QtWidgets.QApplication.restoreOverrideCursor() - QtWidgets.QMessageBox.critical( - self, - f"{e.source} {e.code_name} Error", - f"{e}", - ) + QtWidgets.QMessageBox.critical(self, f"{e.source} {e.code_name} Error", f"{e}") return self.twList.setRowCount(0) diff --git a/comictaggerlib/log.py b/comictaggerlib/log.py index db8b929..efdf98b 100644 --- a/comictaggerlib/log.py +++ b/comictaggerlib/log.py @@ -39,10 +39,7 @@ def setup_logging(verbose: int, log_dir: pathlib.Path) -> None: stream_handler.setLevel(logging.WARNING) logging.basicConfig( - handlers=[ - stream_handler, - file_handler, - ], + handlers=[stream_handler, file_handler], level=logging.WARNING, format="%(asctime)s | %(name)s | %(levelname)s | %(message)s", datefmt="%Y-%m-%dT%H:%M:%S", diff --git a/comictaggerlib/optionalmsgdialog.py b/comictaggerlib/optionalmsgdialog.py index 23c2de3..d49ae75 100644 --- a/comictaggerlib/optionalmsgdialog.py +++ b/comictaggerlib/optionalmsgdialog.py @@ -77,10 +77,7 @@ class OptionalMessageDialog(QtWidgets.QDialog): else: btnbox_style = QtWidgets.QDialogButtonBox.StandardButton.Ok - self.theButtonBox = QtWidgets.QDialogButtonBox( - btnbox_style, - parent=self, - ) + self.theButtonBox = QtWidgets.QDialogButtonBox(btnbox_style, parent=self) self.theButtonBox.accepted.connect(self.accept) self.theButtonBox.rejected.connect(self.reject) diff --git a/comictaggerlib/taggerwindow.py b/comictaggerlib/taggerwindow.py index b9aa040..4b2dbad 100644 --- a/comictaggerlib/taggerwindow.py +++ b/comictaggerlib/taggerwindow.py @@ -137,8 +137,7 @@ class TaggerWindow(QtWidgets.QMainWindow): self.fileSelectionList.selectionChanged.connect(self.file_list_selection_changed) self.fileSelectionList.listCleared.connect(self.file_list_cleared) self.fileSelectionList.set_sorting( - self.options[0].internal_sort_column, - QtCore.Qt.SortOrder(self.options[0].internal_sort_direction), + self.options[0].internal_sort_column, QtCore.Qt.SortOrder(self.options[0].internal_sort_direction) ) # we can't specify relative font sizes in the UI designer, so @@ -1078,11 +1077,7 @@ Have fun! ) except TalkerError as e: QtWidgets.QApplication.restoreOverrideCursor() - QtWidgets.QMessageBox.critical( - self, - f"{e.source} {e.code_name} Error", - f"{e}", - ) + QtWidgets.QMessageBox.critical(self, f"{e.source} {e.code_name} Error", f"{e}") else: QtWidgets.QApplication.restoreOverrideCursor() if new_metadata is not None: diff --git a/comictalker/talkerbase.py b/comictalker/talkerbase.py index 13c1351..687430d 100644 --- a/comictalker/talkerbase.py +++ b/comictalker/talkerbase.py @@ -70,12 +70,7 @@ class TalkerError(Exception): source -- the name of the source producing the error """ - codes = { - 1: "General", - 2: "Network", - 3: "Data", - 4: "Other", - } + codes = {1: "General", 2: "Network", 3: "Data", 4: "Other"} def __init__(self, source: str, desc: str, code: int = 4, sub_code: int = 0) -> None: super().__init__() diff --git a/comictalker/talkers/comicvine.py b/comictalker/talkers/comicvine.py index 81f6ec0..459d0f2 100644 --- a/comictalker/talkers/comicvine.py +++ b/comictalker/talkers/comicvine.py @@ -179,10 +179,7 @@ class ComicVineTalker(ComicTalker): wait_on_ratelimit: bool = False, ): super().__init__(version, cache_folder, api_url, api_key) - self.source_details = SourceDetails( - name="Comic Vine", - ident="comicvine", - ) + self.source_details = SourceDetails(name="Comic Vine", ident="comicvine") self.static_options = SourceStaticOptions( website="https://comicvine.gamespot.com/", has_issues=True, @@ -218,11 +215,7 @@ class ComicVineTalker(ComicTalker): cv_response: CVResult = requests.get( test_url, headers={"user-agent": "comictagger/" + self.version}, - params={ - "api_key": key, - "format": "json", - "field_list": "name", - }, + params={"api_key": key, "format": "json", "field_list": "name"}, ).json() # Bogus request, but if the key is wrong, you get error 100: "Invalid API Key" @@ -624,10 +617,7 @@ class ComicVineTalker(ComicTalker): if f_record and f_record["complete"]: # Cache had full record return talker_utils.map_comic_issue_to_metadata( - f_record, - self.source_name_friendly, - self.remove_html_tables, - self.use_series_start_as_volume, + f_record, self.source_name_friendly, self.remove_html_tables, self.use_series_start_as_volume ) if f_record is not None: