diff --git a/.flake8 b/.flake8 index 0aca4d8..ccb0c2e 100644 --- a/.flake8 +++ b/.flake8 @@ -2,3 +2,5 @@ max-line-length = 120 extend-ignore = E203, E501, A003 extend-exclude = venv, scripts, build, dist +per-file-ignores = + comictaggerlib/cli.py: T20 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 939ff0b..a172a0d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -36,7 +36,7 @@ repos: rev: 4.0.1 hooks: - id: flake8 - additional_dependencies: [flake8-encodings, flake8-warnings, flake8-builtins, flake8-eradicate, flake8-length] + additional_dependencies: [flake8-encodings, flake8-warnings, flake8-builtins, flake8-eradicate, flake8-length, flake8-print] - repo: https://github.com/pre-commit/mirrors-mypy rev: v0.960 hooks: diff --git a/comictaggerlib/fileselectionlist.py b/comictaggerlib/fileselectionlist.py index 48124bc..aeb6dd4 100644 --- a/comictaggerlib/fileselectionlist.py +++ b/comictaggerlib/fileselectionlist.py @@ -235,7 +235,7 @@ class FileSelectionList(QtWidgets.QWidget): def get_current_list_row(self, path: str) -> int: for r in range(self.twList.rowCount()): ca = cast(ComicArchive, self.get_archive_by_row(r)) - if ca.path == path: + if str(ca.path) == path: return r return -1 diff --git a/comictaggerlib/main.py b/comictaggerlib/main.py index 49bfc12..8b02384 100755 --- a/comictaggerlib/main.py +++ b/comictaggerlib/main.py @@ -138,7 +138,7 @@ def ctmain() -> None: SETTINGS.cv_api_key = opts.cv_api_key SETTINGS.save() if opts.only_set_cv_key: - print("Key set") + print("Key set") # noqa: T201 return ComicVineTalker.api_key = SETTINGS.cv_api_key @@ -161,8 +161,7 @@ def ctmain() -> None: if not qt_available and not opts.no_gui: opts.no_gui = True - print("PyQt5 is not available. ComicTagger is limited to command-line mode.") - logger.info("PyQt5 is not available. ComicTagger is limited to command-line mode.") + logger.warn("PyQt5 is not available. ComicTagger is limited to command-line mode.") if opts.no_gui: try: diff --git a/comictaggerlib/taggerwindow.py b/comictaggerlib/taggerwindow.py index a731e5e..63650c0 100644 --- a/comictaggerlib/taggerwindow.py +++ b/comictaggerlib/taggerwindow.py @@ -91,7 +91,7 @@ class TaggerWindow(QtWidgets.QMainWindow): socket.connectToServer(settings.install_id) alive = socket.waitForConnected(3000) if alive: - print(f"Another application with key [{settings.install_id}] is already running") + logger.setLevel(logging.INFO) logger.info("Another application with key [%s] is already running", settings.install_id) # send file list to other instance if file_list: diff --git a/comictaggerlib/volumeselectionwindow.py b/comictaggerlib/volumeselectionwindow.py index 1fb73ec..ae67493 100644 --- a/comictaggerlib/volumeselectionwindow.py +++ b/comictaggerlib/volumeselectionwindow.py @@ -209,7 +209,7 @@ class VolumeSelectionWindow(QtWidgets.QDialog): def log_id_output(self, text: str) -> None: if self.iddialog is not None: - print(text, end=" ") + print(text, end=" ") # noqa: T201 self.iddialog.textEdit.ensureCursorVisible() self.iddialog.textEdit.insertPlainText(text)