-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Declare support for Python 3.11 and drop support for Python 3.7 #275
Conversation
@@ -117,7 +117,7 @@ def setUp(self): | |||
|
|||
# set up cassette | |||
cm = self.vcr.use_cassette(self.recording_file) | |||
self.cassette = cm.__enter__() | |||
self.cassette = cm.__enter__() # pylint: disable=unnecessary-dunder-call |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cm.__exit__
is not called immediately in this method to release self.cassette
, but registered in self.addCleanup
, so this dunder call is not unnecessary.
except AttributeError: | ||
pass | ||
|
||
command_argument_default = default if default != inspect.Parameter.empty else None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original code reuses the variable name default
to denote different things, which is a bad practice. We rename it to command_argument_default
to distinguish command argument default from function argument default.
sig = inspect.signature(operation) | ||
args = sig.parameters |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inspect.getargspec
is removed in Python 3.11 and replaced by inspect.getfullargspec
. However, inspect.getfullargspec
is retained only to maintain backward compatibility. The recommendation is to use inspect.signature
:
Note that signature() and Signature Object provide the recommended API for callable introspection, and support additional behaviours (like positional-only arguments) that are sometimes encountered in extension module APIs. This function is retained primarily for use in code that needs to maintain compatibility with the Python 2 inspect module API.
-- https://docs.python.org/3.11/library/inspect.html#inspect.getfullargspec
Given we have dropped Python 2 long ago (#233), it's time to drop the usage of inspect.getargspec
too.
@@ -53,9 +53,8 @@ jobs: | |||
name: 'pool-ubuntu-2004' | |||
steps: | |||
- task: UsePythonVersion@0 | |||
displayName: Use Python 3.10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[testenv] | ||
deps = -rrequirements.txt | ||
commands= | ||
python ./scripts/license_verify.py | ||
flake8 --statistics --append-config=.flake8 knack | ||
pylint knack --rcfile=.pylintrc -r n -d I0013 | ||
pylint knack --rcfile=.pylintrc --reports n --disable I0013 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use arguments' full name for clarity.
It's very likely we need to remove --disable I0013
in the near future, as pylint 3.0.0b1 disables it by default:
This message is disabled by default. To enable it, add file-ignored to the enable option.
-- https://pylint.pycqa.org/en/latest/user_guide/messages/information/file-ignored.html
from packaging.version import parse | ||
return parse(v1) <= parse(v2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar changes were previously made in Azure/azure-cli#17667.
PEP 632 mentions:
distutils.version
— use thepackaging
package
@@ -104,15 +104,15 @@ def __init__(self, | |||
def _should_show_version(args): | |||
return args and (args[0] == '--version' or args[0] == '-v') | |||
|
|||
def get_cli_version(self): # pylint: disable=no-self-use | |||
def get_cli_version(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The removal of # pylint: disable=no-self-use
is explained in Azure/azure-cli-dev-tools#359 (comment)
Declare support for Python 3.11 and drop support for Python 3.7.
Corresponding Azure CLI issues: