-
Notifications
You must be signed in to change notification settings - Fork 3.3k
{Misc.} Improve code style and prepare for pylint 2.17 #26685
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 1 commit
64611ad
4dd2919
517cf57
1a063a6
ef0890b
bcbfd36
7b96219
0b63899
ba3ed38
b9d38d5
014a7ec
901308c
f7117f2
9ba55d8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -122,7 +122,7 @@ def items(self): | |
| return self.__store.items() | ||
|
|
||
| def __format_count(self): | ||
| untouched_keys = [x for x in self.__store.keys() if x not in self.__count.keys()] | ||
| untouched_keys = [x for x in self.__store if x not in self.__count] | ||
|
Contributor
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.
|
||
| for k in untouched_keys: | ||
| self.__count[k] = 0 | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -285,7 +285,7 @@ def _validate_ip_address_existence(cmd, namespace): | |
| scm_site = namespace.scm_site | ||
| configs = _generic_site_operation(cmd.cli_ctx, resource_group_name, name, 'get_configuration', slot) | ||
| access_rules = configs.scm_ip_security_restrictions if scm_site else configs.ip_security_restrictions | ||
| ip_exists = [(lambda x: x.ip_address == namespace.ip_address)(x) for x in access_rules] | ||
| ip_exists = [x.ip_address == namespace.ip_address for x in access_rules] | ||
|
Contributor
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.
|
||
| if True in ip_exists: | ||
| raise ArgumentUsageError('IP address: ' + namespace.ip_address + ' already exists. ' | ||
| 'Cannot add duplicate IP address values.') | ||
|
|
@@ -521,11 +521,11 @@ def validate_registry_user(namespace): | |
| if namespace.environment and namespace.registry_username: | ||
| if not namespace.registry_server or (not namespace.registry_password and ACR_IMAGE_SUFFIX not in namespace.registry_server): # pylint: disable=line-too-long | ||
| raise RequiredArgumentMissingError("Usage error: --registry-server, --registry-password and" | ||
| " --registry-username are required together if not using Azure Container Registry") | ||
| " --registry-username are required together if not using Azure Container Registry") # pylint: disable=line-too-long | ||
|
|
||
|
|
||
| def validate_registry_pass(namespace): | ||
| if namespace.environment and namespace.registry_password: | ||
| if not namespace.registry_server or (not namespace.registry_username and ACR_IMAGE_SUFFIX not in namespace.registry_server): # pylint: disable=line-too-long | ||
| raise RequiredArgumentMissingError("Usage error: --registry-server, --registry-password and" | ||
| " --registry-username are required together if not using Azure Container Registry") | ||
| " --registry-username are required together if not using Azure Container Registry") # pylint: disable=line-too-long | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -520,7 +520,7 @@ def delete_staticsite(cmd, name, resource_group_name=None, no_wait=False): | |
|
|
||
| def _parse_pair(pair, delimiter): | ||
| if delimiter not in pair: | ||
| InvalidArgumentValueError("invalid format of pair {0}".format(pair)) | ||
| raise InvalidArgumentValueError("invalid format of pair {0}".format(pair)) | ||
|
Contributor
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. This line makes no sense without
|
||
|
|
||
| index = pair.index(delimiter) | ||
| return pair[:index], pair[1 + index:] | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -294,9 +294,8 @@ def deserialize_json(self, kwargs, json_obj): | |
| except DeserializationError as error: | ||
| message += f": {error}" | ||
| raise ValueError(message.format(self._request_param['model'])) | ||
| else: | ||
| if kwargs[self._request_param['name']] is None: | ||
| raise ValueError(message.format(self._request_param['model'])) | ||
| if kwargs[self._request_param['name']] is None: | ||
| raise ValueError(message.format(self._request_param['model'])) | ||
|
Contributor
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.
|
||
|
|
||
| def queue_argument(self, name=None, path=None, root=None, | ||
| options=None, type=None, # pylint: disable=redefined-builtin | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -461,7 +461,7 @@ def _get_scale_settings(initial_count, min_count, max_count): | |
| if not initial_count and not min_count and not max_count: | ||
| # Get from the config file | ||
| return None | ||
| if sum([1 if v is not None else 0 for v in (min_count, max_count)]) == 1: | ||
| if sum(1 if v is not None else 0 for v in (min_count, max_count)) == 1: | ||
|
Contributor
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.
|
||
| raise CLIError('You need to either provide both min and max node counts or not provide any of them') | ||
| if min_count is not None and max_count is not None and min_count > max_count: | ||
| raise CLIError('Maximum nodes count must be greater or equal to minimum nodes count') | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -437,7 +437,7 @@ def replace_memory_optimized_tier(result): | |
| for capability_idx, capability in enumerate(result): | ||
| for edition_idx, edition in enumerate(capability.supported_flexible_server_editions): | ||
| if edition.name == 'MemoryOptimized': | ||
| result[capability_idx].supported_flexible_server_editions[edition_idx].name = 'BusinessCritical' | ||
| capability.supported_flexible_server_editions[edition_idx].name = 'BusinessCritical' | ||
|
Contributor
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.
|
||
|
|
||
| return result | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,7 +56,7 @@ def list_tables(client, num_results=None, marker=None, show_next_marker=None): | |
|
|
||
| def exists(client, table_name): | ||
| generator = client.query_tables("TableName eq '{}'".format(table_name)) | ||
| return list(next(generator.by_page())) != [] | ||
| return bool(list(next(generator.by_page()))) | ||
|
Contributor
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.
|
||
|
|
||
|
|
||
| # pylint: disable=redefined-builtin | ||
|
|
||
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.