-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
{Pylint} Fix arguments-renamed #30345
Merged
+31
−32
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -365,8 +365,7 @@ def _ignore_if_not_registered(self, dest): | |||||
if not match: | ||||||
super().argument(dest, arg_type=ignore_type) | ||||||
|
||||||
# pylint: disable=arguments-differ | ||||||
def argument(self, dest, arg_type=None, **kwargs): | ||||||
def argument(self, argument_dest, arg_type=None, **kwargs): | ||||||
self._check_stale() | ||||||
if not self._applicable(): | ||||||
return | ||||||
|
@@ -384,11 +383,11 @@ def argument(self, dest, arg_type=None, **kwargs): | |||||
min_api=min_api, | ||||||
max_api=max_api, | ||||||
operation_group=operation_group): | ||||||
super().argument(dest, **merged_kwargs) | ||||||
super().argument(argument_dest, **merged_kwargs) | ||||||
else: | ||||||
self._ignore_if_not_registered(dest) | ||||||
self._ignore_if_not_registered(argument_dest) | ||||||
|
||||||
def positional(self, dest, arg_type=None, **kwargs): | ||||||
def positional(self, argument_dest, arg_type=None, **kwargs): | ||||||
self._check_stale() | ||||||
if not self._applicable(): | ||||||
return | ||||||
|
@@ -405,9 +404,9 @@ def positional(self, dest, arg_type=None, **kwargs): | |||||
min_api=min_api, | ||||||
max_api=max_api, | ||||||
operation_group=operation_group): | ||||||
super().positional(dest, **merged_kwargs) | ||||||
super().positional(argument_dest, **merged_kwargs) | ||||||
else: | ||||||
self._ignore_if_not_registered(dest) | ||||||
self._ignore_if_not_registered(argument_dest) | ||||||
|
||||||
def expand(self, dest, model_type, group_name=None, patches=None): | ||||||
# TODO: | ||||||
|
@@ -467,15 +466,17 @@ def _expansion_validator_impl(namespace): | |||||
options_list=dest_option, | ||||||
validator=get_complex_argument_processor(expanded_arguments, dest, model_type)) | ||||||
|
||||||
def ignore(self, *args): | ||||||
def ignore(self, *args): # pylint: disable=arguments-differ | ||||||
# It is expected that this method's signature differs from its base class, as it can be used to ignore | ||||||
# multiple arguments in one method call. | ||||||
Comment on lines
+469
to
+471
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. Some examples:
|
||||||
self._check_stale() | ||||||
if not self._applicable(): | ||||||
return | ||||||
|
||||||
for arg in args: | ||||||
super().ignore(arg) | ||||||
|
||||||
def extra(self, dest, arg_type=None, **kwargs): | ||||||
def extra(self, argument_dest, arg_type=None, **kwargs): | ||||||
|
||||||
merged_kwargs = self._flatten_kwargs(kwargs, arg_type) | ||||||
resource_type = merged_kwargs.get('resource_type', None) | ||||||
|
@@ -487,8 +488,8 @@ def extra(self, dest, arg_type=None, **kwargs): | |||||
max_api=max_api, | ||||||
operation_group=operation_group): | ||||||
# Restore when knack #132 is fixed | ||||||
# merged_kwargs.pop('dest', None) | ||||||
# super(AzArgumentContext, self).extra(dest, **merged_kwargs) | ||||||
# merged_kwargs.pop('argument_dest', None) | ||||||
# super(AzArgumentContext, self).extra(argument_dest, **merged_kwargs) | ||||||
from knack.arguments import CLICommandArgument | ||||||
self._check_stale() | ||||||
if not self._applicable(): | ||||||
|
@@ -497,11 +498,11 @@ def extra(self, dest, arg_type=None, **kwargs): | |||||
if self.command_scope in self.command_loader.command_group_table: | ||||||
raise ValueError("command authoring error: extra argument '{}' cannot be registered to a group-level " | ||||||
"scope '{}'. It must be registered to a specific command.".format( | ||||||
dest, self.command_scope)) | ||||||
argument_dest, self.command_scope)) | ||||||
|
||||||
deprecate_action = self._handle_deprecations(dest, **merged_kwargs) | ||||||
deprecate_action = self._handle_deprecations(argument_dest, **merged_kwargs) | ||||||
if deprecate_action: | ||||||
merged_kwargs['action'] = deprecate_action | ||||||
merged_kwargs.pop('dest', None) | ||||||
self.command_loader.extra_argument_registry[self.command_scope][dest] = CLICommandArgument( | ||||||
dest, **merged_kwargs) | ||||||
self.command_loader.extra_argument_registry[self.command_scope][argument_dest] = CLICommandArgument( | ||||||
argument_dest, **merged_kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,22 +60,22 @@ class JsonBytearrayEncoder(json.JSONEncoder): | |
DATE_FORMAT = "%Y-%m-%d" | ||
TIME_FORMAT = "%H:%M:%S" | ||
|
||
def default(self, obj): # pylint: disable=E0202,W0221 | ||
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.
|
||
if isinstance(obj, datetime): | ||
return obj.strftime("%s %s" % (self.DATE_FORMAT, self.TIME_FORMAT)) | ||
def default(self, o): # pylint: disable=E0202 | ||
if isinstance(o, datetime): | ||
return o.strftime("%s %s" % (self.DATE_FORMAT, self.TIME_FORMAT)) | ||
|
||
if isinstance(obj, bytearray): | ||
return bytes(obj).decode('utf-8', 'ignore') | ||
if isinstance(o, bytearray): | ||
return bytes(o).decode('utf-8', 'ignore') | ||
|
||
try: | ||
return obj.toJSON() | ||
return o.toJSON() | ||
except Exception: # pylint: disable=W0703 | ||
obj = vars(obj) | ||
obj.pop('additional_properties', None) | ||
keys = list(obj.keys()) | ||
o = vars(o) | ||
o.pop('additional_properties', None) | ||
keys = list(o.keys()) | ||
for key in keys: | ||
obj[snake_to_camel_case(key)] = obj.pop(key) | ||
return obj | ||
o[snake_to_camel_case(key)] = o.pop(key) | ||
return o | ||
|
||
|
||
def create_ip_range(resource_name, ip): | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Putting
# pylint: disable=arguments-differ
here is incorrect as it disables allarguments-differ
s below, includingignore()
, not only forargument()
.