Fix issues from static analysis

This commit is contained in:
Timmy Welch 2024-06-22 20:21:01 -07:00
parent 3fd1c13ecb
commit e452fa153b
8 changed files with 10 additions and 21 deletions

View File

@ -157,13 +157,9 @@ class ComicRack(Tag):
def assign(cr_entry: str, md_entry: Any) -> None:
if md_entry:
text = ""
if isinstance(md_entry, str):
text = md_entry
elif isinstance(md_entry, (list, set)):
text = str(md_entry)
if isinstance(md_entry, (list, set)):
text = ",".join(md_entry)
else:
text = str(md_entry)
et_entry = root.find(cr_entry)
if et_entry is not None:
et_entry.text = text

View File

@ -470,10 +470,6 @@ class CLI:
ii = IssueIdentifier(ca, self.config, self.current_talker())
def myoutput(text: str) -> None:
if self.config.Runtime_Options__verbose:
self.output(text)
ii.set_output_function(functools.partial(self.output, already_logged=True))
if not self.config.Auto_Tag__use_year_when_identifying:
md.year = None
@ -679,7 +675,8 @@ class CLI:
delete_success = False
export_success = False
if not self.config.Runtime_Options__dryrun:
if export_success := ca.export_as_zip(new_file):
if ca.export_as_zip(new_file):
export_success = True
if self.config.Runtime_Options__delete_original:
try:
filename_path.unlink(missing_ok=True)

View File

@ -238,7 +238,8 @@ class CoverImageWidget(QtWidgets.QWidget):
self.load_default()
self.cover_fetcher = ImageFetcher(self.cache_folder)
ImageFetcher.image_fetch_complete = self.image_fetch_complete.emit
if data := self.cover_fetcher.fetch(self.url_list[self.imageIndex]):
data = self.cover_fetcher.fetch(self.url_list[self.imageIndex])
if data:
self.cover_remote_fetch_complete(self.url_list[self.imageIndex], data)
# called when the image is done loading from internet

View File

@ -300,8 +300,8 @@ def validate_commandline_settings(config: settngs.Config[ct_ns], parser: settngs
letters.extend({f"{d}" for d in "ABCDEFGHIJKLMNOPQRSTUVWXYZ" if os.path.exists(f"{d}:\\")} - {"C"})
for letter in letters:
# look in some likely places for Windows machines
utils.add_to_path(rf"{letters}:\Program Files\WinRAR")
utils.add_to_path(rf"{letters}:\Program Files (x86)\WinRAR")
utils.add_to_path(rf"{letter}:\Program Files\WinRAR")
utils.add_to_path(rf"{letter}:\Program Files (x86)\WinRAR")
else:
if platform.system() == "Darwin":
result = subprocess.run(("/usr/libexec/path_helper", "-s"), capture_output=True)

View File

@ -260,7 +260,7 @@ class App:
comicapi.comicarchive.tags["cr"].enabled = False
if len(self.talkers) < 1:
error = error = (
error = (
"Failed to load any talkers, please re-install and check the log located in '"
+ str(self.config[0].Runtime_Options__config.user_log_dir)
+ "' for more details",

View File

@ -1810,8 +1810,7 @@ class TaggerWindow(QtWidgets.QMainWindow):
if ct_md is not None:
temp_opts = cast(ct_ns, settngs.get_namespace(self.config, True, True, True, False)[0])
if dlg.cbxClearMetadata.isChecked():
temp_opts.Auto_Tag__clear_tags
temp_opts.Auto_Tag__clear_tags = dlg.cbxClearMetadata.isChecked()
md = prepare_metadata(md, ct_md, temp_opts)

View File

@ -80,8 +80,6 @@ def generate_api_widgets(
# get the actual config objects in case they have overwritten the default
btn_test_row = None
le_key = None
le_url = None
# only file settings are saved
if key_option.file:

View File

@ -202,8 +202,6 @@ class ComicCacher:
return results
def get_series_info(self, series_id: str, source: str, expire_stale: bool = True) -> tuple[Series, bool] | None:
result: Series | None = None
with sqlite3.connect(self.db_file) as con:
con.row_factory = sqlite3.Row
cur = con.cursor()