Enable arguments-renamed Pylint rule and fix warnings (#2842)

This commit is contained in:
correctmost 2024-11-16 19:03:18 -05:00 committed by GitHub
parent 0dc77f8e8a
commit f13f3d53b6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 15 additions and 16 deletions

View File

@ -52,11 +52,11 @@ class PartitioningList(ListManager):
display_actions = list(self._actions.values()) display_actions = list(self._actions.values())
super().__init__(prompt, device_partitions, display_actions[:2], display_actions[3:]) super().__init__(prompt, device_partitions, display_actions[:2], display_actions[3:])
def selected_action_display(self, partition: PartitionModification) -> str: def selected_action_display(self, selection: PartitionModification) -> str:
if partition.status == ModificationStatus.Create: if selection.status == ModificationStatus.Create:
return str(_('Partition - New')) return str(_('Partition - New'))
else: else:
return str(partition.dev_path) return str(selection.dev_path)
def filter_options(self, selection: PartitionModification, options: list[str]) -> list[str]: def filter_options(self, selection: PartitionModification, options: list[str]) -> list[str]:
not_filter = [] not_filter = []

View File

@ -22,8 +22,8 @@ class SubvolumeMenu(ListManager):
] ]
super().__init__(prompt, btrfs_subvols, [self._actions[0]], self._actions[1:]) super().__init__(prompt, btrfs_subvols, [self._actions[0]], self._actions[1:])
def selected_action_display(self, subvolume: SubvolumeModification) -> str: def selected_action_display(self, selection: SubvolumeModification) -> str:
return str(subvolume.name) return str(selection.name)
def _add_subvolume(self, preset: SubvolumeModification | None = None) -> SubvolumeModification | None: def _add_subvolume(self, preset: SubvolumeModification | None = None) -> SubvolumeModification | None:
result = EditMenu( result = EditMenu(

View File

@ -87,8 +87,8 @@ class JSON(json.JSONEncoder, json.JSONDecoder):
A safe JSON encoder that will omit private information in dicts (starting with !) A safe JSON encoder that will omit private information in dicts (starting with !)
""" """
def encode(self, obj: Any) -> str: def encode(self, o: Any) -> str:
return super().encode(jsonify(obj)) return super().encode(jsonify(o))
class UNSAFE_JSON(json.JSONEncoder, json.JSONDecoder): class UNSAFE_JSON(json.JSONEncoder, json.JSONDecoder):
@ -96,8 +96,8 @@ class UNSAFE_JSON(json.JSONEncoder, json.JSONDecoder):
UNSAFE_JSON will call/encode and keep private information in dicts (starting with !) UNSAFE_JSON will call/encode and keep private information in dicts (starting with !)
""" """
def encode(self, obj: Any) -> str: def encode(self, o: Any) -> str:
return super().encode(jsonify(obj, safe=False)) return super().encode(jsonify(o, safe=False))
class SysCommandWorker: class SysCommandWorker:

View File

@ -28,8 +28,8 @@ class UserList(ListManager):
] ]
super().__init__(prompt, lusers, [self._actions[0]], self._actions[1:]) super().__init__(prompt, lusers, [self._actions[0]], self._actions[1:])
def selected_action_display(self, user: User) -> str: def selected_action_display(self, selection: User) -> str:
return user.username return selection.username
def handle_action(self, action: str, entry: User | None, data: list[User]) -> list[User]: def handle_action(self, action: str, entry: User | None, data: list[User]) -> list[User]:
if action == self._actions[0]: # add if action == self._actions[0]: # add

View File

@ -26,8 +26,8 @@ class ManualNetworkConfig(ListManager):
] ]
super().__init__(prompt, preset, [self._actions[0]], self._actions[1:]) super().__init__(prompt, preset, [self._actions[0]], self._actions[1:])
def selected_action_display(self, nic: Nic) -> str: def selected_action_display(self, selection: Nic) -> str:
return nic.iface if nic.iface else '' return selection.iface if selection.iface else ''
def handle_action(self, action: str, entry: Nic | None, data: list[Nic]) -> list[Nic]: def handle_action(self, action: str, entry: Nic | None, data: list[Nic]) -> list[Nic]:
if action == self._actions[0]: # add if action == self._actions[0]: # add

View File

@ -137,8 +137,8 @@ class CustomMirrorList(ListManager):
self._actions[1:] self._actions[1:]
) )
def selected_action_display(self, mirror: CustomMirror) -> str: def selected_action_display(self, selection: CustomMirror) -> str:
return mirror.name return selection.name
def handle_action( def handle_action(
self, self,

View File

@ -134,7 +134,6 @@ max-line-length = 220
disable = [ disable = [
"C", "C",
"R", "R",
"arguments-renamed",
"attribute-defined-outside-init", "attribute-defined-outside-init",
"bad-indentation", "bad-indentation",
"bare-except", "bare-except",