[BugFix] - Fix pylint possibly-used-before-assignment (#6484)

* fix: comply w/ possibly used before assignment

* remove disabe from .pylintrc

* remove reset test

* remove reset test

* fix: update missing keys message
This commit is contained in:
montezdesousa
2024-06-05 16:40:24 +01:00
committed by GitHub
parent e0be8cdacf
commit a52b24c16b
25 changed files with 56 additions and 63 deletions

View File

@@ -59,9 +59,12 @@ def get_argument_optional_choices(parser: ArgumentParser, argument_name: str) ->
"""Get the optional_choices attribute of an argument from an ArgumentParser."""
for action in parser._actions: # pylint: disable=protected-access
opts = action.option_strings
if (opts and opts[0] == argument_name) or action.dest == argument_name:
if hasattr(action, "optional_choices"):
return action.optional_choices
if (
(opts and opts[0] == argument_name)
or action.dest == argument_name
and hasattr(action, "optional_choices")
):
return action.optional_choices
return False