Enable the unused-variable pylint rule and fix warnings (#2978)

This commit is contained in:
correctmost 2024-12-01 01:41:34 -05:00 committed by GitHub
parent f578ac4ade
commit 760963f7a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 6 additions and 7 deletions

View File

@ -268,7 +268,7 @@ class SysCommandWorker:
if self.child_fd: if self.child_fd:
got_output = False got_output = False
for fileno, event in self.poll_object.poll(0.1): for _fileno, _event in self.poll_object.poll(0.1):
try: try:
output = os.read(self.child_fd, 8192) output = os.read(self.child_fd, 8192)
got_output = True got_output = True

View File

@ -181,7 +181,7 @@ def ask_additional_packages_to_install(preset: list[str] = []) -> list[str]:
# Verify packages that were given # Verify packages that were given
out = str(_("Verifying that additional packages exist (this might take a few seconds)")) out = str(_("Verifying that additional packages exist (this might take a few seconds)"))
Tui.print(out, 0) Tui.print(out, 0)
valid, invalid = validate_package_list(packages) _valid, invalid = validate_package_list(packages)
if invalid: if invalid:
return f'{_("Some packages could not be found in the repository")}: {invalid}' return f'{_("Some packages could not be found in the repository")}: {invalid}'

View File

@ -77,7 +77,7 @@ def get_hw_addr(ifname: str) -> str:
def list_interfaces(skip_loopback: bool = True) -> dict[str, str]: def list_interfaces(skip_loopback: bool = True) -> dict[str, str]:
interfaces = {} interfaces = {}
for index, iface in socket.if_nameindex(): for _index, iface in socket.if_nameindex():
if skip_loopback and iface == "lo": if skip_loopback and iface == "lo":
continue continue
@ -183,7 +183,7 @@ def ping(hostname, timeout=5) -> int:
# for a ICMP response or exit with no latency # for a ICMP response or exit with no latency
while latency == -1 and time.time() - started < timeout: while latency == -1 and time.time() - started < timeout:
try: try:
for fileno, event in watchdog.poll(0.1): for _fileno, _event in watchdog.poll(0.1):
response, _ = icmp_socket.recvfrom(1024) response, _ = icmp_socket.recvfrom(1024)
icmp_type = struct.unpack('!B', response[20:21])[0] icmp_type = struct.unpack('!B', response[20:21])[0]

View File

@ -278,7 +278,7 @@ class ProfileHandler:
Load all default_profiles defined in a module Load all default_profiles defined in a module
""" """
profiles = [] profiles = []
for k, v in module.__dict__.items(): for v in module.__dict__.values():
if isinstance(v, type) and v.__module__ == module.__name__: if isinstance(v, type) and v.__module__ == module.__name__:
bases = inspect.getmro(v) bases = inspect.getmro(v)

View File

@ -1175,7 +1175,7 @@ class SelectMenu(AbstractCurses):
items = self._get_visible_items() items = self._get_visible_items()
entries = [] entries = []
for row_idx, item in enumerate(items): for item in items:
item_text = '' item_text = ''
if self._multi and not item.is_empty(): if self._multi and not item.is_empty():

View File

@ -164,7 +164,6 @@ disable = [
"unreachable", "unreachable",
"unspecified-encoding", "unspecified-encoding",
"unused-argument", "unused-argument",
"unused-variable",
] ]
[tool.pylint.refactoring] [tool.pylint.refactoring]