From cb0052b5562cad5d7247dba928ab621ff09a944c Mon Sep 17 00:00:00 2001 From: Abdo Date: Fri, 27 Jun 2025 13:44:26 +0300 Subject: [PATCH] Remove pylint disables --- pylib/anki/_backend.py | 4 +--- pylib/anki/collection.py | 9 ++------- pylib/anki/exporting.py | 3 +-- pylib/anki/find.py | 1 - pylib/anki/hooks.py | 1 - pylib/anki/importing/anki2.py | 2 +- pylib/anki/importing/apkg.py | 2 +- pylib/anki/importing/base.py | 2 +- pylib/anki/importing/csvfile.py | 2 -- pylib/anki/importing/mnemo.py | 3 --- pylib/anki/importing/noteimp.py | 1 - pylib/anki/importing/pauker.py | 1 - pylib/anki/importing/supermemo_xml.py | 2 +- pylib/anki/lang.py | 8 ++++---- pylib/anki/models.py | 4 +--- pylib/anki/scheduler/dummy.py | 1 - pylib/anki/scheduler/legacy.py | 1 - pylib/anki/scheduler/v3.py | 7 +++---- pylib/anki/stats.py | 3 --- pylib/anki/statsbg.py | 2 -- pylib/anki/stdmodels.py | 1 - pylib/anki/utils.py | 8 +++----- pylib/tests/test_schedv3.py | 5 ++--- pylib/tools/genbuildinfo.py | 1 - qt/aqt/browser/table/state.py | 2 +- qt/aqt/clayout.py | 2 +- qt/aqt/debug_console.py | 1 - qt/aqt/editor.py | 2 +- qt/aqt/importing.py | 2 +- qt/aqt/main.py | 1 - qt/aqt/mpv.py | 6 ++---- qt/aqt/qt/__init__.py | 2 +- qt/aqt/sound.py | 8 ++++---- qt/aqt/sync.py | 2 +- qt/aqt/theme.py | 2 +- qt/aqt/tts.py | 3 +-- qt/aqt/utils.py | 6 +++--- rslib/proto/python.rs | 1 - 38 files changed, 38 insertions(+), 76 deletions(-) diff --git a/pylib/anki/_backend.py b/pylib/anki/_backend.py index 583eaa55d..447946fa6 100644 --- a/pylib/anki/_backend.py +++ b/pylib/anki/_backend.py @@ -11,8 +11,6 @@ from threading import current_thread, main_thread from typing import TYPE_CHECKING, Any from weakref import ref -from markdown import markdown - import anki.buildinfo from anki import _rsbridge, backend_pb2, i18n_pb2 from anki._backend_generated import RustBackendGenerated @@ -20,6 +18,7 @@ from anki._fluent import GeneratedTranslations from anki.dbproxy import Row as DBRow from anki.dbproxy import ValueForDB from anki.utils import from_json_bytes, to_json_bytes +from markdown import markdown if TYPE_CHECKING: from anki.collection import FsrsItem @@ -46,7 +45,6 @@ from .errors import ( # the following comment is required to suppress a warning that only shows up # when there are other pylint failures -# pylint: disable=c-extension-no-member if _rsbridge.buildhash() != anki.buildinfo.buildhash: raise Exception( f"""rsbridge and anki build hashes do not match: diff --git a/pylib/anki/collection.py b/pylib/anki/collection.py index c0192c782..c64ffdb8b 100644 --- a/pylib/anki/collection.py +++ b/pylib/anki/collection.py @@ -158,7 +158,7 @@ class Collection(DeprecatedNamesMixin): self.tags = TagManager(self) self.conf = ConfigManager(self) self._load_scheduler() - self._startReps = 0 # pylint: disable=invalid-name + self._startReps = 0 def name(self) -> Any: return os.path.splitext(os.path.basename(self.path))[0] @@ -511,9 +511,7 @@ class Collection(DeprecatedNamesMixin): # Utils ########################################################################## - def nextID( # pylint: disable=invalid-name - self, type: str, inc: bool = True - ) -> Any: + def nextID(self, type: str, inc: bool = True) -> Any: type = f"next{type.capitalize()}" id = self.conf.get(type, 1) if inc: @@ -849,7 +847,6 @@ class Collection(DeprecatedNamesMixin): ) def _pb_search_separator(self, operator: SearchJoiner) -> SearchNode.Group.Joiner.V: - # pylint: disable=no-member if operator == "AND": return SearchNode.Group.Joiner.AND else: @@ -1214,8 +1211,6 @@ class Collection(DeprecatedNamesMixin): # the count on things like edits, which we probably could do by checking # the previous state in moveToState. - # pylint: disable=invalid-name - def startTimebox(self) -> None: self._startTime = time.time() self._startReps = self.sched.reps diff --git a/pylib/anki/exporting.py b/pylib/anki/exporting.py index 43713d8b2..ef6f02c63 100644 --- a/pylib/anki/exporting.py +++ b/pylib/anki/exporting.py @@ -1,7 +1,6 @@ # Copyright: Ankitects Pty Ltd and contributors # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -# pylint: disable=invalid-name from __future__ import annotations @@ -351,7 +350,7 @@ class AnkiPackageExporter(AnkiExporter): colfile = path.replace(".apkg", ".anki2") AnkiExporter.exportInto(self, colfile) # prevent older clients from accessing - # pylint: disable=unreachable + self._addDummyCollection(z) z.write(colfile, "collection.anki21") diff --git a/pylib/anki/find.py b/pylib/anki/find.py index bcae6e556..106bf2876 100644 --- a/pylib/anki/find.py +++ b/pylib/anki/find.py @@ -1,7 +1,6 @@ # Copyright: Ankitects Pty Ltd and contributors # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -# pylint: disable=invalid-name from __future__ import annotations diff --git a/pylib/anki/hooks.py b/pylib/anki/hooks.py index fcc3758f4..13148c649 100644 --- a/pylib/anki/hooks.py +++ b/pylib/anki/hooks.py @@ -1,7 +1,6 @@ # Copyright: Ankitects Pty Ltd and contributors # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -# pylint: disable=invalid-name """ Tools for extending Anki. diff --git a/pylib/anki/importing/anki2.py b/pylib/anki/importing/anki2.py index 098265c3f..dcfa15c8d 100644 --- a/pylib/anki/importing/anki2.py +++ b/pylib/anki/importing/anki2.py @@ -1,7 +1,7 @@ # Copyright: Ankitects Pty Ltd and contributors # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -# pylint: disable=invalid-name + from __future__ import annotations import os diff --git a/pylib/anki/importing/apkg.py b/pylib/anki/importing/apkg.py index ea2325960..012686ffa 100644 --- a/pylib/anki/importing/apkg.py +++ b/pylib/anki/importing/apkg.py @@ -1,7 +1,7 @@ # Copyright: Ankitects Pty Ltd and contributors # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -# pylint: disable=invalid-name + from __future__ import annotations import json diff --git a/pylib/anki/importing/base.py b/pylib/anki/importing/base.py index 2ddcaaebf..fc27dc909 100644 --- a/pylib/anki/importing/base.py +++ b/pylib/anki/importing/base.py @@ -1,7 +1,7 @@ # Copyright: Ankitects Pty Ltd and contributors # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -# pylint: disable=invalid-name + from __future__ import annotations from typing import Any diff --git a/pylib/anki/importing/csvfile.py b/pylib/anki/importing/csvfile.py index 6a2ed347c..fde7ec8ac 100644 --- a/pylib/anki/importing/csvfile.py +++ b/pylib/anki/importing/csvfile.py @@ -1,7 +1,6 @@ # Copyright: Ankitects Pty Ltd and contributors # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -# pylint: disable=invalid-name from __future__ import annotations @@ -144,7 +143,6 @@ class TextImporter(NoteImporter): self.close() zuper = super() if hasattr(zuper, "__del__"): - # pylint: disable=no-member zuper.__del__(self) # type: ignore def noteFromFields(self, fields: list[str]) -> ForeignNote: diff --git a/pylib/anki/importing/mnemo.py b/pylib/anki/importing/mnemo.py index 5b7fda65f..a2f68ad4c 100644 --- a/pylib/anki/importing/mnemo.py +++ b/pylib/anki/importing/mnemo.py @@ -1,7 +1,6 @@ # Copyright: Ankitects Pty Ltd and contributors # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -# pylint: disable=invalid-name import re import time @@ -35,7 +34,6 @@ f._id=d._fact_id""" ): if id != curid: if note: - # pylint: disable=unsubscriptable-object notes[note["_id"]] = note note = {"_id": _id} curid = id @@ -185,7 +183,6 @@ acq_reps+ret_reps, lapses, card_type_id from cards""" state = dict(n=1) def repl(match): - # pylint: disable=cell-var-from-loop # replace [...] with cloze refs res = "{{c%d::%s}}" % (state["n"], match.group(1)) state["n"] += 1 diff --git a/pylib/anki/importing/noteimp.py b/pylib/anki/importing/noteimp.py index f827a525a..cb35a373a 100644 --- a/pylib/anki/importing/noteimp.py +++ b/pylib/anki/importing/noteimp.py @@ -1,7 +1,6 @@ # Copyright: Ankitects Pty Ltd and contributors # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -# pylint: disable=invalid-name from __future__ import annotations diff --git a/pylib/anki/importing/pauker.py b/pylib/anki/importing/pauker.py index ea5c45082..4087aeb12 100644 --- a/pylib/anki/importing/pauker.py +++ b/pylib/anki/importing/pauker.py @@ -1,7 +1,6 @@ # Copyright: Andreas Klauer # License: BSD-3 -# pylint: disable=invalid-name import gzip import html diff --git a/pylib/anki/importing/supermemo_xml.py b/pylib/anki/importing/supermemo_xml.py index 202592c2e..22b939c8a 100644 --- a/pylib/anki/importing/supermemo_xml.py +++ b/pylib/anki/importing/supermemo_xml.py @@ -2,7 +2,7 @@ # License: GNU GPL, version 3 or later; http://www.gnu.org/licenses/agpl.html # pytype: disable=attribute-error # type: ignore -# pylint: disable=C + from __future__ import annotations import re diff --git a/pylib/anki/lang.py b/pylib/anki/lang.py index f20eddf3e..3cbb60319 100644 --- a/pylib/anki/lang.py +++ b/pylib/anki/lang.py @@ -157,13 +157,13 @@ def lang_to_disk_lang(lang: str) -> str: # the currently set interface language -current_lang = "en" # pylint: disable=invalid-name +current_lang = "en" # the current Fluent translation instance. Code in pylib/ should # not reference this, and should use col.tr instead. The global # instance exists for legacy reasons, and as a convenience for the # Qt code. -current_i18n: anki._backend.RustBackend | None = None # pylint: disable=invalid-name +current_i18n: anki._backend.RustBackend | None = None tr_legacyglobal = anki._backend.Translations(None) @@ -178,7 +178,7 @@ def ngettext(single: str, plural: str, num: int) -> str: def set_lang(lang: str) -> None: - global current_lang, current_i18n # pylint: disable=invalid-name + global current_lang, current_i18n current_lang = lang current_i18n = anki._backend.RustBackend(langs=[lang]) tr_legacyglobal.backend = weakref.ref(current_i18n) @@ -198,7 +198,7 @@ def get_def_lang(user_lang: str | None = None) -> tuple[int, str]: # getdefaultlocale() is deprecated since Python 3.11, but we need to keep using it as getlocale() behaves differently: https://bugs.python.org/issue38805 with warnings.catch_warnings(): warnings.simplefilter("ignore", DeprecationWarning) - (sys_lang, enc) = locale.getdefaultlocale() # pylint: disable=deprecated-method + (sys_lang, enc) = locale.getdefaultlocale() except AttributeError: # this will return a different format on Windows (e.g. Italian_Italy), resulting in us falling back to en_US # further below diff --git a/pylib/anki/models.py b/pylib/anki/models.py index 03f23023f..a2267663a 100644 --- a/pylib/anki/models.py +++ b/pylib/anki/models.py @@ -419,7 +419,7 @@ and notes.mid = ? and cards.ord = ?""", # legacy API - used by unit tests and add-ons - def change( # pylint: disable=invalid-name + def change( self, notetype: NotetypeDict, nids: list[anki.notes.NoteId], @@ -478,8 +478,6 @@ and notes.mid = ? and cards.ord = ?""", # Legacy ########################################################################## - # pylint: disable=invalid-name - @deprecated(info="use note.cloze_numbers_in_fields()") def _availClozeOrds( self, notetype: NotetypeDict, flds: str, allow_empty: bool = True diff --git a/pylib/anki/scheduler/dummy.py b/pylib/anki/scheduler/dummy.py index 5732ad346..08896b1e5 100644 --- a/pylib/anki/scheduler/dummy.py +++ b/pylib/anki/scheduler/dummy.py @@ -1,7 +1,6 @@ # Copyright: Ankitects Pty Ltd and contributors # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -# pylint: disable=invalid-name from __future__ import annotations diff --git a/pylib/anki/scheduler/legacy.py b/pylib/anki/scheduler/legacy.py index 58bed7933..35092588d 100644 --- a/pylib/anki/scheduler/legacy.py +++ b/pylib/anki/scheduler/legacy.py @@ -1,7 +1,6 @@ # Copyright: Ankitects Pty Ltd and contributors # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -# pylint: disable=invalid-name from __future__ import annotations diff --git a/pylib/anki/scheduler/v3.py b/pylib/anki/scheduler/v3.py index 2a18ee021..3c1123d0b 100644 --- a/pylib/anki/scheduler/v3.py +++ b/pylib/anki/scheduler/v3.py @@ -1,7 +1,6 @@ # Copyright: Ankitects Pty Ltd and contributors # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -# pylint: disable=invalid-name """ The V3/2021 scheduler. @@ -184,7 +183,7 @@ class Scheduler(SchedulerBaseWithLegacy): return self._interval_for_filtered_state(state.filtered) else: assert_exhaustive(kind) - return 0 # pylint: disable=unreachable + return 0 def _interval_for_normal_state( self, normal: scheduler_pb2.SchedulingState.Normal @@ -200,7 +199,7 @@ class Scheduler(SchedulerBaseWithLegacy): return normal.relearning.learning.scheduled_secs else: assert_exhaustive(kind) - return 0 # pylint: disable=unreachable + return 0 def _interval_for_filtered_state( self, filtered: scheduler_pb2.SchedulingState.Filtered @@ -212,7 +211,7 @@ class Scheduler(SchedulerBaseWithLegacy): return self._interval_for_normal_state(filtered.rescheduling.original_state) else: assert_exhaustive(kind) - return 0 # pylint: disable=unreachable + return 0 def nextIvl(self, card: Card, ease: int) -> Any: "Don't use this - it is only required by tests, and will be moved in the future." diff --git a/pylib/anki/stats.py b/pylib/anki/stats.py index 14e8f050c..e8045decb 100644 --- a/pylib/anki/stats.py +++ b/pylib/anki/stats.py @@ -1,7 +1,6 @@ # Copyright: Ankitects Pty Ltd and contributors # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -# pylint: disable=C from __future__ import annotations @@ -324,7 +323,6 @@ group by day order by day""" yaxes=[dict(min=0), dict(position="right", min=0)], ) if days is not None: - # pylint: disable=invalid-unary-operand-type conf["xaxis"]["min"] = -days + 0.5 def plot(id: str, data: Any, ylabel: str, ylabel2: str) -> str: @@ -359,7 +357,6 @@ group by day order by day""" yaxes=[dict(min=0), dict(position="right", min=0)], ) if days is not None: - # pylint: disable=invalid-unary-operand-type conf["xaxis"]["min"] = -days + 0.5 def plot(id: str, data: Any, ylabel: str, ylabel2: str) -> str: diff --git a/pylib/anki/statsbg.py b/pylib/anki/statsbg.py index 552dfb5a9..b9ebb5aa8 100644 --- a/pylib/anki/statsbg.py +++ b/pylib/anki/statsbg.py @@ -1,5 +1,3 @@ -# pylint: disable=invalid-name - # from subtlepatterns.com; CC BY 4.0. # by Daniel Beaton # https://www.toptal.com/designers/subtlepatterns/fancy-deboss/ diff --git a/pylib/anki/stdmodels.py b/pylib/anki/stdmodels.py index 721b96bc6..4edb83a7a 100644 --- a/pylib/anki/stdmodels.py +++ b/pylib/anki/stdmodels.py @@ -12,7 +12,6 @@ from anki import notetypes_pb2 from anki._legacy import DeprecatedNamesMixinForModule from anki.utils import from_json_bytes -# pylint: disable=no-member StockNotetypeKind = notetypes_pb2.StockNotetype.Kind # add-on authors can add ("note type name", function) diff --git a/pylib/anki/utils.py b/pylib/anki/utils.py index c61fd0588..60ae75507 100644 --- a/pylib/anki/utils.py +++ b/pylib/anki/utils.py @@ -24,7 +24,6 @@ from anki.dbproxy import DBProxy _tmpdir: str | None try: - # pylint: disable=c-extension-no-member import orjson to_json_bytes: Callable[[Any], bytes] = orjson.dumps @@ -156,12 +155,12 @@ def field_checksum(data: str) -> int: # Temp files ############################################################################## -_tmpdir = None # pylint: disable=invalid-name +_tmpdir = None def tmpdir() -> str: "A reusable temp folder which we clean out on each program invocation." - global _tmpdir # pylint: disable=invalid-name + global _tmpdir if not _tmpdir: def cleanup() -> None: @@ -216,7 +215,6 @@ def call(argv: list[str], wait: bool = True, **kwargs: Any) -> int: try: info.dwFlags |= subprocess.STARTF_USESHOWWINDOW # type: ignore except Exception: - # pylint: disable=no-member info.dwFlags |= subprocess._subprocess.STARTF_USESHOWWINDOW # type: ignore else: info = None @@ -282,7 +280,7 @@ def plat_desc() -> str: elif is_win: theos = f"win:{platform.win32_ver()[0]}" elif system == "Linux": - import distro # pytype: disable=import-error # pylint: disable=import-error + import distro # pytype: disable=import-error dist_id = distro.id() dist_version = distro.version() diff --git a/pylib/tests/test_schedv3.py b/pylib/tests/test_schedv3.py index 6e6025372..6bafdf66f 100644 --- a/pylib/tests/test_schedv3.py +++ b/pylib/tests/test_schedv3.py @@ -8,7 +8,6 @@ from collections.abc import Callable from typing import Dict import pytest - from anki import hooks from anki.consts import * from anki.lang import without_unicode_isolation @@ -551,10 +550,10 @@ def test_bury(): col.addNote(note) c2 = note.cards()[0] # burying - col.sched.bury_cards([c.id], manual=True) # pylint: disable=unexpected-keyword-arg + col.sched.bury_cards([c.id], manual=True) c.load() assert c.queue == QUEUE_TYPE_MANUALLY_BURIED - col.sched.bury_cards([c2.id], manual=False) # pylint: disable=unexpected-keyword-arg + col.sched.bury_cards([c2.id], manual=False) c2.load() assert c2.queue == QUEUE_TYPE_SIBLING_BURIED diff --git a/pylib/tools/genbuildinfo.py b/pylib/tools/genbuildinfo.py index b997ca5b3..add188d41 100644 --- a/pylib/tools/genbuildinfo.py +++ b/pylib/tools/genbuildinfo.py @@ -15,6 +15,5 @@ with open(buildhash_file, "r", encoding="utf8") as f: with open(outpath, "w", encoding="utf8") as f: # if we switch to uppercase we'll need to add legacy aliases - f.write("# pylint: disable=invalid-name\n") f.write(f"version = '{version}'\n") f.write(f"buildhash = '{buildhash}'\n") diff --git a/qt/aqt/browser/table/state.py b/qt/aqt/browser/table/state.py index 8054d2597..4faf88611 100644 --- a/qt/aqt/browser/table/state.py +++ b/qt/aqt/browser/table/state.py @@ -59,7 +59,7 @@ class ItemState(ABC): # abstractproperty is deprecated but used due to mypy limitations # (https://github.com/python/mypy/issues/1362) - @abstractproperty # pylint: disable=deprecated-decorator + @abstractproperty def active_columns(self) -> list[str]: """Return the saved or default columns for the state.""" diff --git a/qt/aqt/clayout.py b/qt/aqt/clayout.py index 3daa5352a..aec5326f4 100644 --- a/qt/aqt/clayout.py +++ b/qt/aqt/clayout.py @@ -790,7 +790,7 @@ class CardLayout(QDialog): assert a is not None qconnect( a.triggered, - lambda: self.on_restore_to_default(), # pylint: disable=unnecessary-lambda + lambda: self.on_restore_to_default(), ) if not self._isCloze(): diff --git a/qt/aqt/debug_console.py b/qt/aqt/debug_console.py index a37d14010..54fa8a17a 100644 --- a/qt/aqt/debug_console.py +++ b/qt/aqt/debug_console.py @@ -294,7 +294,6 @@ class DebugConsole(QDialog): } self._captureOutput(True) try: - # pylint: disable=exec-used exec(text, vars) except Exception: self._output += traceback.format_exc() diff --git a/qt/aqt/editor.py b/qt/aqt/editor.py index c74bad217..25c927fcd 100644 --- a/qt/aqt/editor.py +++ b/qt/aqt/editor.py @@ -343,7 +343,7 @@ require("anki/ui").loaded.then(() => require("anki/NoteEditor").instances[0].too gui_hooks.editor_did_init_shortcuts(cuts, self) for row in cuts: if len(row) == 2: - keys, fn = row # pylint: disable=unbalanced-tuple-unpacking + keys, fn = row fn = self._addFocusCheck(fn) else: keys, fn, _ = row diff --git a/qt/aqt/importing.py b/qt/aqt/importing.py index 1ad23c7df..282d15339 100644 --- a/qt/aqt/importing.py +++ b/qt/aqt/importing.py @@ -262,7 +262,7 @@ class ImportDialog(QDialog): self.mapwidget.setLayout(self.grid) self.grid.setContentsMargins(3, 3, 3, 3) self.grid.setSpacing(6) - for num in range(len(self.mapping)): # pylint: disable=consider-using-enumerate + for num in range(len(self.mapping)): text = tr.importing_field_of_file_is(val=num + 1) self.grid.addWidget(QLabel(text), num, 0) if self.mapping[num] == "_tags": diff --git a/qt/aqt/main.py b/qt/aqt/main.py index 82432a18b..4f19c6e89 100644 --- a/qt/aqt/main.py +++ b/qt/aqt/main.py @@ -772,7 +772,6 @@ class AnkiQt(QMainWindow): oldState = self.state cleanup = getattr(self, f"_{oldState}Cleanup", None) if cleanup: - # pylint: disable=not-callable cleanup(state) self.clearStateShortcuts() self.state = state diff --git a/qt/aqt/mpv.py b/qt/aqt/mpv.py index 389d37cbf..ac6a05b05 100644 --- a/qt/aqt/mpv.py +++ b/qt/aqt/mpv.py @@ -24,7 +24,7 @@ # # ------------------------------------------------------------------------------ -# pylint: disable=raise-missing-from + from __future__ import annotations import inspect @@ -66,7 +66,6 @@ class MPVTimeoutError(MPVError): if is_win: - # pylint: disable=import-error import pywintypes import win32file # pytype: disable=import-error import win32job @@ -146,7 +145,7 @@ class MPVBase: win32job.JobObjectExtendedLimitInformation, extended_info, ) - handle = self._proc._handle # pylint: disable=no-member + handle = self._proc._handle win32job.AssignProcessToJobObject(self._job, handle) def _stop_process(self): @@ -504,7 +503,6 @@ class MPV(MPVBase): # Simulate an init event when the process and all callbacks have been # completely set up. if hasattr(self, "on_init"): - # pylint: disable=no-member self.on_init() # diff --git a/qt/aqt/qt/__init__.py b/qt/aqt/qt/__init__.py index 52b639d13..730bc771b 100644 --- a/qt/aqt/qt/__init__.py +++ b/qt/aqt/qt/__init__.py @@ -23,7 +23,7 @@ def debug() -> None: from pdb import set_trace pyqtRemoveInputHook() - set_trace() # pylint: disable=forgotten-debug-statement + set_trace() if os.environ.get("DEBUG"): diff --git a/qt/aqt/sound.py b/qt/aqt/sound.py index 8ff49024f..d20365232 100644 --- a/qt/aqt/sound.py +++ b/qt/aqt/sound.py @@ -101,7 +101,7 @@ def is_audio_file(fname: str) -> bool: return ext in AUDIO_EXTENSIONS -class SoundOrVideoPlayer(Player): # pylint: disable=abstract-method +class SoundOrVideoPlayer(Player): default_rank = 0 def rank_for_tag(self, tag: AVTag) -> int | None: @@ -111,7 +111,7 @@ class SoundOrVideoPlayer(Player): # pylint: disable=abstract-method return None -class SoundPlayer(Player): # pylint: disable=abstract-method +class SoundPlayer(Player): default_rank = 0 def rank_for_tag(self, tag: AVTag) -> int | None: @@ -121,7 +121,7 @@ class SoundPlayer(Player): # pylint: disable=abstract-method return None -class VideoPlayer(Player): # pylint: disable=abstract-method +class VideoPlayer(Player): default_rank = 0 def rank_for_tag(self, tag: AVTag) -> int | None: @@ -324,7 +324,7 @@ def retryWait(proc: subprocess.Popen) -> int: ########################################################################## -class SimpleProcessPlayer(Player): # pylint: disable=abstract-method +class SimpleProcessPlayer(Player): "A player that invokes a new process for each tag to play." args: list[str] = [] diff --git a/qt/aqt/sync.py b/qt/aqt/sync.py index c562a235d..bedc05f8e 100644 --- a/qt/aqt/sync.py +++ b/qt/aqt/sync.py @@ -44,7 +44,7 @@ def get_sync_status( ) -> None: auth = mw.pm.sync_auth() if not auth: - callback(SyncStatus(required=SyncStatus.NO_CHANGES)) # pylint:disable=no-member + callback(SyncStatus(required=SyncStatus.NO_CHANGES)) return def on_future_done(fut: Future[SyncStatus]) -> None: diff --git a/qt/aqt/theme.py b/qt/aqt/theme.py index 48fa00ab8..6e91b2649 100644 --- a/qt/aqt/theme.py +++ b/qt/aqt/theme.py @@ -339,7 +339,7 @@ def get_windows_dark_mode() -> bool: if not is_win: return False - from winreg import ( # type: ignore[attr-defined] # pylint: disable=import-error + from winreg import ( # type: ignore[attr-defined] HKEY_CURRENT_USER, OpenKey, QueryValueEx, diff --git a/qt/aqt/tts.py b/qt/aqt/tts.py index 079a5e3de..d559fb41f 100644 --- a/qt/aqt/tts.py +++ b/qt/aqt/tts.py @@ -166,7 +166,6 @@ class MacVoice(TTSVoice): original_name: str -# pylint: disable=no-member class MacTTSPlayer(TTSProcessPlayer): "Invokes a process to play the audio in the background." @@ -487,7 +486,7 @@ if is_win: class WindowsTTSPlayer(TTSProcessPlayer): default_rank = -1 try: - import win32com.client # pylint: disable=import-error + import win32com.client speaker = win32com.client.Dispatch("SAPI.SpVoice") except Exception as exc: diff --git a/qt/aqt/utils.py b/qt/aqt/utils.py index cbd7ba658..df7613ef9 100644 --- a/qt/aqt/utils.py +++ b/qt/aqt/utils.py @@ -942,8 +942,8 @@ def show_in_folder(path: str) -> None: def _show_in_folder_win32(path: str) -> None: - import win32con # pylint: disable=import-error - import win32gui # pylint: disable=import-error + import win32con + import win32gui from aqt import mw @@ -1238,7 +1238,7 @@ def opengl_vendor() -> str | None: # Can't use versionFunctions there return None - vp = QOpenGLVersionProfile() # type: ignore # pylint: disable=undefined-variable + vp = QOpenGLVersionProfile() # type: ignore vp.setVersion(2, 0) try: diff --git a/rslib/proto/python.rs b/rslib/proto/python.rs index 0ca2c15ea..a0cf3fc9f 100644 --- a/rslib/proto/python.rs +++ b/rslib/proto/python.rs @@ -213,7 +213,6 @@ fn write_header(out: &mut impl Write) -> Result<()> { out.write_all( br#"# Copyright: Ankitects Pty Ltd and contributors # License: GNU AGPL, version 3 or later; https://www.gnu.org/licenses/agpl.html -# pylint: skip-file from __future__ import annotations