Use human-friendly names in mypy and Pylint ignore directives (#2946)

This commit is contained in:
correctmost 2024-11-26 14:48:38 -05:00 committed by GitHub
parent 7bdef2f017
commit a28fb27a7a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 8 additions and 8 deletions

View File

@ -42,7 +42,7 @@ class Fido2:
error('fido2 support is most likely not installed') error('fido2 support is most likely not installed')
raise ValueError('HSM devices can not be detected, is libfido2 installed?') raise ValueError('HSM devices can not be detected, is libfido2 installed?')
fido_devices: str = clear_vt100_escape_codes(ret) # type: ignore fido_devices: str = clear_vt100_escape_codes(ret) # type: ignore[assignment]
manufacturer_pos = 0 manufacturer_pos = 0
product_pos = 0 product_pos = 0

View File

@ -156,7 +156,7 @@ class SysCommandWorker:
lines = filter(None, self._trace_log[self._trace_log_pos:last_line].splitlines()) lines = filter(None, self._trace_log[self._trace_log_pos:last_line].splitlines())
for line in lines: for line in lines:
if self.remove_vt100_escape_codes_from_lines: if self.remove_vt100_escape_codes_from_lines:
line = clear_vt100_escape_codes(line) # type: ignore line = clear_vt100_escape_codes(line) # type: ignore[assignment]
yield line + b'\n' yield line + b'\n'

View File

@ -133,7 +133,7 @@ class Journald:
@staticmethod @staticmethod
def log(message: str, level: int = logging.DEBUG) -> None: def log(message: str, level: int = logging.DEBUG) -> None:
try: try:
import systemd.journal # type: ignore import systemd.journal # type: ignore[import-not-found]
except ModuleNotFoundError: except ModuleNotFoundError:
return None return None

View File

@ -111,7 +111,7 @@ class TranslationHandler:
""" """
# this is a very naughty way of retrieving the data but # this is a very naughty way of retrieving the data but
# there's no alternative method exposed unfortunately # there's no alternative method exposed unfortunately
catalog = translation._catalog # type: ignore catalog = translation._catalog # type: ignore[attr-defined]
messages = {k: v for k, v in catalog.items() if k and v} messages = {k: v for k, v in catalog.items() if k and v}
return len(messages) return len(messages)
@ -205,7 +205,7 @@ class DeferredTranslation:
@classmethod @classmethod
def install(cls) -> None: def install(cls) -> None:
import builtins import builtins
builtins._ = cls # type: ignore builtins._ = cls # type: ignore[attr-defined]
translation_handler = TranslationHandler() translation_handler = TranslationHandler()

View File

@ -394,7 +394,7 @@ class EditViewport(AbstractViewport):
self._textbox = curses.textpad.Textbox(self._edit_win) self._textbox = curses.textpad.Textbox(self._edit_win)
self._main_win.refresh() self._main_win.refresh()
self._textbox.edit(self.process_key) # type: ignore self._textbox.edit(self.process_key) # type: ignore[arg-type]
@dataclass @dataclass
@ -1481,8 +1481,8 @@ class Tui:
return Tui.t()._main_loop(component) return Tui.t()._main_loop(component)
def _sig_win_resize(self, signum: int, frame: FrameType | None) -> None: def _sig_win_resize(self, signum: int, frame: FrameType | None) -> None:
if hasattr(self, '_component') and self._component is not None: # pylint: disable=E1101 if hasattr(self, '_component') and self._component is not None: # pylint: disable=no-member
self._component.resize_win() # pylint: disable=E1101 self._component.resize_win() # pylint: disable=no-member
def _main_loop(self, component: AbstractCurses) -> Result: def _main_loop(self, component: AbstractCurses) -> Result:
self._screen.refresh() self._screen.refresh()