diff --git a/.github/scripts/requirements.txt b/.github/scripts/requirements.txt index 9e48e20d..13880c9c 100644 --- a/.github/scripts/requirements.txt +++ b/.github/scripts/requirements.txt @@ -1,10 +1,13 @@ -setuptools <65.7.0 -pip <23.0 +setuptools <65.7.0 ; python_version == '2.7' +setuptools <=69.1.1 ; python_version >= '3.8' +pip <23.0 ; python_version == '2.7' +pip ; python_version >= '3.5' pylint <2.15.10 pytest <=7.2.1 pytest-pylint <=1.1.2 pytest-runner <6.0.0 termcolor <2.2.0 hypothesis <6.62.0 -python-Levenshtein <0.20.9 -mock <5.0.0 \ No newline at end of file +python-Levenshtein <0.20.9 ; python_version == '2.7' +levenshtein <=0.25.0 ; python_version >= '3.5' +mock <5.0.0 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9864ae98..eb510f03 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - python-version: ["3.5", "3.7", "3.8", "3.9", "3.10"] + python-version: ["3.5", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] steps: # Checkout the repo. diff --git a/fire/__init__.py b/fire/__init__.py index 4cc76210..fae18489 100644 --- a/fire/__init__.py +++ b/fire/__init__.py @@ -21,4 +21,4 @@ from fire.core import Fire __all__ = ['Fire'] -__version__ = '0.5.0' +__version__ = '0.6.0' diff --git a/fire/__main__.py b/fire/__main__.py index 2ad217d6..9d8227ad 100644 --- a/fire/__main__.py +++ b/fire/__main__.py @@ -80,7 +80,7 @@ def import_from_file_path(path): spec.loader.exec_module(module) # pytype: disable=attribute-error else: - import imp # pylint: disable=g-import-not-at-top,import-outside-toplevel,deprecated-module + import imp # pylint: disable=g-import-not-at-top,import-outside-toplevel,deprecated-module,import-error module = imp.load_source(module_name, path) return module, module_name diff --git a/fire/console/encoding.py b/fire/console/encoding.py index 780e5a28..41bda634 100644 --- a/fire/console/encoding.py +++ b/fire/console/encoding.py @@ -86,7 +86,7 @@ def Decode(data, encoding=None): try: # Just return the string if its pure ASCII. - return string.decode('ascii') + return string.decode('ascii') # pytype: disable=attribute-error except UnicodeError: # The string is not ASCII encoded. pass @@ -94,7 +94,7 @@ def Decode(data, encoding=None): # Try the suggested encoding if specified. if encoding: try: - return string.decode(encoding) + return string.decode(encoding) # pytype: disable=attribute-error except UnicodeError: # Bad suggestion. pass @@ -103,21 +103,21 @@ def Decode(data, encoding=None): # be exceptional if a valid extended ascii encoding with extended chars # were also a valid UITF-8 encoding. try: - return string.decode('utf8') + return string.decode('utf8') # pytype: disable=attribute-error except UnicodeError: # Not a UTF-8 encoding. pass # Try the filesystem encoding. try: - return string.decode(sys.getfilesystemencoding()) + return string.decode(sys.getfilesystemencoding()) # pytype: disable=attribute-error except UnicodeError: # string is not encoded for filesystem paths. pass # Try the system default encoding. try: - return string.decode(sys.getdefaultencoding()) + return string.decode(sys.getdefaultencoding()) # pytype: disable=attribute-error except UnicodeError: # string is not encoded using the default encoding. pass @@ -137,7 +137,7 @@ def Decode(data, encoding=None): # string = '\xdc' # string = string.decode('iso-8859-1') # string = string.encode('ascii', 'backslashreplace') - return string.decode('iso-8859-1') + return string.decode('iso-8859-1') # pytype: disable=attribute-error def GetEncodedValue(env, name, default=None): diff --git a/fire/formatting_windows.py b/fire/formatting_windows.py index 4bcf82e0..ce0f677d 100644 --- a/fire/formatting_windows.py +++ b/fire/formatting_windows.py @@ -35,7 +35,9 @@ def initialize_or_disable(): """Enables ANSI processing on Windows or disables it as needed.""" if HAS_COLORAMA: wrap = True - if hasattr(sys.stdout, "isatty") and sys.stdout.isatty() and platform.release() == '10': + if (hasattr(sys.stdout, "isatty") + and sys.stdout.isatty() + and platform.release() == '10'): # Enables native ANSI sequences in console. # Windows 10, 2016, and 2019 only. diff --git a/fire/inspectutils.py b/fire/inspectutils.py index 0fa8e7d3..15f32f91 100644 --- a/fire/inspectutils.py +++ b/fire/inspectutils.py @@ -98,10 +98,10 @@ class with an __init__ method. def Py2GetArgSpec(fn): """A wrapper around getargspec that tries both fn and fn.__call__.""" try: - return inspect.getargspec(fn) # pylint: disable=deprecated-method + return inspect.getargspec(fn) # pylint: disable=deprecated-method,no-member except TypeError: if hasattr(fn, '__call__'): - return inspect.getargspec(fn.__call__) # pylint: disable=deprecated-method + return inspect.getargspec(fn.__call__) # pylint: disable=deprecated-method,no-member raise diff --git a/fire/testutils.py b/fire/testutils.py index ea410e82..5f875147 100644 --- a/fire/testutils.py +++ b/fire/testutils.py @@ -74,7 +74,7 @@ def assertOutputMatches(self, stdout='.*', stderr='.*', capture=True): def assertRaisesRegex(self, *args, **kwargs): # pylint: disable=arguments-differ if sys.version_info.major == 2: - return super(BaseTestCase, self).assertRaisesRegexp(*args, **kwargs) # pylint: disable=deprecated-method + return super(BaseTestCase, self).assertRaisesRegexp(*args, **kwargs) # pylint: disable=deprecated-method,no-member else: return super(BaseTestCase, self).assertRaisesRegex(*args, **kwargs) # pylint: disable=no-member diff --git a/pylintrc b/pylintrc index b89b16d1..558d3ba2 100644 --- a/pylintrc +++ b/pylintrc @@ -32,7 +32,7 @@ enable=indexing-exception,old-raise-syntax # Disable the message, report, category or checker with the given id(s). You # can either give multiple identifier separated by comma (,) or put this option # multiple time. -disable=design,similarities,no-self-use,attribute-defined-outside-init,locally-disabled,star-args,pointless-except,bad-option-value,global-statement,fixme,suppressed-message,useless-suppression,locally-enabled,file-ignored,wrong-import-order,useless-object-inheritance,no-else-return,super-with-arguments,raise-missing-from,consider-using-f-string,unspecified-encoding,unnecessary-lambda-assignment +disable=design,similarities,no-self-use,attribute-defined-outside-init,locally-disabled,star-args,pointless-except,bad-option-value,global-statement,fixme,suppressed-message,useless-suppression,locally-enabled,file-ignored,wrong-import-order,useless-object-inheritance,no-else-return,super-with-arguments,raise-missing-from,consider-using-f-string,unspecified-encoding,unnecessary-lambda-assignment,wrong-import-position,ungrouped-imports,deprecated-module [REPORTS] diff --git a/setup.py b/setup.py index 8e95f414..24e0e325 100644 --- a/setup.py +++ b/setup.py @@ -40,7 +40,7 @@ 'python-Levenshtein', ] -VERSION = '0.5.0' +VERSION = '0.6.0' URL = 'https://github.com/google/python-fire' setup( @@ -72,6 +72,8 @@ 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', 'Operating System :: OS Independent', 'Operating System :: POSIX',