Collapse formatting

This commit is contained in:
Timmy Welch 2022-12-15 20:21:53 -08:00
parent 9004ee1a6b
commit 53a0b23230
No known key found for this signature in database
8 changed files with 12 additions and 54 deletions

View File

@ -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

View File

@ -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")

View File

@ -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)

View File

@ -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",

View File

@ -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)

View File

@ -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:

View File

@ -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__()

View File

@ -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: