-
Notifications
You must be signed in to change notification settings - Fork 98
Declare support for Python 3.11 and drop support for Python 3.7 #275
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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): | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The removal of |
||
| """ Get the CLI Version. Override this to define how to get the CLI version | ||
|
|
||
| :return: The CLI version | ||
| :rtype: str | ||
| """ | ||
| return '' | ||
|
|
||
| def get_runtime_version(self): # pylint: disable=no-self-use | ||
| def get_runtime_version(self): | ||
| """ Get the runtime information. | ||
|
|
||
| :return: Runtime information | ||
|
|
@@ -169,7 +169,7 @@ def raise_event(self, event_name, **kwargs): | |
| for func in handlers: | ||
| func(self, **kwargs) | ||
|
|
||
| def exception_handler(self, ex): # pylint: disable=no-self-use | ||
| def exception_handler(self, ex): | ||
| """ The default exception handler """ | ||
| if isinstance(ex, CLIError): | ||
| logger.error(ex) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -94,12 +94,10 @@ def _default_get_message(self): | |
| message_func=message_func or _default_get_message | ||
| ) | ||
|
|
||
| # pylint: disable=no-self-use | ||
| def _version_less_than_or_equal_to(self, v1, v2): | ||
| """ Returns true if v1 <= v2. """ | ||
| # pylint: disable=no-name-in-module, import-error | ||
| from distutils.version import LooseVersion | ||
| return LooseVersion(v1) <= LooseVersion(v2) | ||
| from packaging.version import parse | ||
| return parse(v1) <= parse(v2) | ||
|
Comment on lines
+99
to
+100
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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:
|
||
|
|
||
| def expired(self): | ||
| if self.expiration: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -67,45 +67,23 @@ def extract_args_from_signature(operation, excluded_params=None): | |
| """ Extracts basic argument data from an operation's signature and docstring | ||
| excluded_params: List of params to ignore and not extract. By default we ignore ['self', 'kwargs']. | ||
| """ | ||
| args = [] | ||
| try: | ||
| # only supported in python3 - falling back to argspec if not available | ||
| sig = inspect.signature(operation) | ||
| args = sig.parameters | ||
| except AttributeError: | ||
| sig = inspect.getargspec(operation) # pylint: disable=deprecated-method, useless-suppression | ||
| args = sig.args | ||
| sig = inspect.signature(operation) | ||
| args = sig.parameters | ||
|
Comment on lines
+70
to
+71
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Given we have dropped Python 2 long ago (#233), it's time to drop the usage of |
||
|
|
||
| arg_docstring_help = option_descriptions(operation) | ||
| excluded_params = excluded_params or ['self', 'kwargs'] | ||
|
|
||
| for arg_name in [a for a in args if a not in excluded_params]: | ||
| try: | ||
| # this works in python3 | ||
| default = args[arg_name].default | ||
| required = default == inspect.Parameter.empty # pylint: disable=no-member, useless-suppression | ||
| except TypeError: | ||
| arg_defaults = (dict(zip(sig.args[-len(sig.defaults):], sig.defaults)) | ||
| if sig.defaults | ||
| else {}) | ||
| default = arg_defaults.get(arg_name) | ||
| required = arg_name not in arg_defaults | ||
|
|
||
| default = args[arg_name].default | ||
| required = default == inspect.Parameter.empty | ||
| action = 'store_' + str(not default).lower() if isinstance(default, bool) else None | ||
|
|
||
| try: | ||
| default = (default | ||
| if default != inspect._empty # pylint: disable=protected-access | ||
| else None) | ||
| except AttributeError: | ||
| pass | ||
|
|
||
| command_argument_default = default if default != inspect.Parameter.empty else None | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The original code reuses the variable name |
||
| options_list = ['--' + arg_name.replace('_', '-')] | ||
| help_str = arg_docstring_help.get(arg_name) | ||
|
|
||
| yield (arg_name, CLICommandArgument(arg_name, | ||
| options_list=options_list, | ||
| required=required, | ||
| default=default, | ||
| default=command_argument_default, | ||
| help=help_str, | ||
| action=action)) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,7 +33,7 @@ def __init__(self, cli, method_name): | |
| def cmd(self, command, checks=None, expect_failure=False): | ||
| return ExecutionResult(self.cli, command, expect_failure=expect_failure).assert_with_checks(checks) | ||
|
|
||
| def create_random_name(self, prefix, length): # pylint: disable=no-self-use | ||
| def create_random_name(self, prefix, length): | ||
| return create_random_name(prefix=prefix, length=length) | ||
|
|
||
| def create_temp_file(self, size_kb, full_random=False): | ||
|
|
@@ -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 | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| self.addCleanup(cm.__exit__) | ||
|
|
||
| if not self.in_recording: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,10 @@ | ||
| argcomplete==1.12.2 | ||
| flake8==4.0.1 | ||
| jmespath==0.10.0 | ||
| Pygments==2.8.1 | ||
| pylint==2.11.1 | ||
| pytest==6.2.5 | ||
| argcomplete==3.1.1 | ||
| flake8==6.0.0 | ||
| jmespath==1.0.1 | ||
| packaging==23.1 | ||
| Pygments==2.15.1 | ||
| pylint==2.17.4 | ||
| pytest==7.4.0 | ||
| PyYAML | ||
| tabulate==0.8.9 | ||
| vcrpy==4.1.1 | ||
| tabulate==0.9.0 | ||
| vcrpy==5.0.0 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,10 @@ | ||
| [tox] | ||
| envlist = py36,py37,py38,py39,py310 | ||
| envlist = py38,py39,py310,py311 | ||
| [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 | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
|
||
| pytest | ||
| python ./examples/test_exapp | ||
Uh oh!
There was an error while loading. Please reload this page.
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.
Using the default
displayNameis sufficient - it is the same as what we are specifying here.