diff --git a/fire/console/encoding.py b/fire/console/encoding.py index 0a7fedfc..3ce30cb5 100644 --- a/fire/console/encoding.py +++ b/fire/console/encoding.py @@ -33,6 +33,7 @@ def Encode(string, encoding=None): Returns: str, The binary string. """ + del encoding # Unused. return string diff --git a/fire/decorators.py b/fire/decorators.py index eb5b0d20..2758b0aa 100644 --- a/fire/decorators.py +++ b/fire/decorators.py @@ -107,5 +107,5 @@ def GetMetadata(fn): def GetParseFns(fn): # type: (...) -> dict metadata = GetMetadata(fn) - default = {"default": None, "positional": [], "named": {}} + default = {'default': None, 'positional': [], 'named': {}} return metadata.get(FIRE_PARSE_FNS, default) diff --git a/fire/formatting_windows.py b/fire/formatting_windows.py index f8241eaa..cee6f393 100644 --- a/fire/formatting_windows.py +++ b/fire/formatting_windows.py @@ -31,7 +31,7 @@ def initialize_or_disable(): """Enables ANSI processing on Windows or disables it as needed.""" if HAS_COLORAMA: wrap = True - if (hasattr(sys.stdout, "isatty") + if (hasattr(sys.stdout, 'isatty') and sys.stdout.isatty() and platform.release() == '10'): # Enables native ANSI sequences in console. diff --git a/fire/helptext.py b/fire/helptext.py index 9b578fac..318d6276 100644 --- a/fire/helptext.py +++ b/fire/helptext.py @@ -475,7 +475,7 @@ def _CreateFlagItem(flag, docstring_info, spec, required=False, description = _GetArgDescription(flag, docstring_info) if not flag_string: - flag_name_upper=formatting.Underline(flag.upper()) + flag_name_upper = formatting.Underline(flag.upper()) flag_string = f'--{flag}={flag_name_upper}' if required: flag_string += ' (required)' diff --git a/fire/helptext_test.py b/fire/helptext_test.py index d1a3f368..aeff5240 100644 --- a/fire/helptext_test.py +++ b/fire/helptext_test.py @@ -428,7 +428,6 @@ def testHelpTextMultipleKeywoardArgumentsWithShortArgs(self): self.assertIn('\n --late', help_screen) - class UsageTest(testutils.BaseTestCase): def testUsageOutput(self): diff --git a/fire/test_components.py b/fire/test_components.py index 2dc4e0cc..887a0dc6 100644 --- a/fire/test_components.py +++ b/fire/test_components.py @@ -554,7 +554,7 @@ def fn_with_kwarg_and_defaults(arg1, arg2, opt=True, **kwargs): """ del arg1, arg2, opt return kwargs.get('arg3') -# pylint: enable=g-doc-args,g-doc-return-or-yield + def fn_with_multiple_defaults(first='first', last='last', late='late'): """Function with kwarg and defaults. @@ -565,3 +565,4 @@ def fn_with_multiple_defaults(first='first', last='last', late='late'): """ del last, late return first +# pylint: enable=g-doc-args,g-doc-return-or-yield diff --git a/fire/trace.py b/fire/trace.py index 3a75cc9c..4a6d4776 100644 --- a/fire/trace.py +++ b/fire/trace.py @@ -77,7 +77,7 @@ def GetLastHealthyElement(self): for element in reversed(self.elements): if not element.HasError(): return element - return None + return self.elements[0] # The initial element is always healthy. def HasError(self): """Returns whether the Fire execution encountered a Fire usage error."""