Skip to content

Commit b46f344

Browse files
authored
{Pylint} Fix superfluous-parens (#30361)
1 parent 22fa655 commit b46f344

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+117
-118
lines changed

pylintrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ disable=
4545
consider-using-enumerate,
4646
# These rules were added in Pylint >= 2.12, disable them to avoid making retroactive change
4747
missing-timeout,
48-
superfluous-parens,
4948
unnecessary-dunder-call,
5049
# These rules were added in Pylint >= 3.2
5150
possibly-used-before-assignment,

src/azure-cli-core/azure/cli/core/_profile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ def refresh_accounts(self):
691691
if user_name in refreshed_list:
692692
continue
693693
refreshed_list.add(user_name)
694-
is_service_principal = (s[_USER_ENTITY][_USER_TYPE] == _SERVICE_PRINCIPAL)
694+
is_service_principal = s[_USER_ENTITY][_USER_TYPE] == _SERVICE_PRINCIPAL
695695
tenant = s[_TENANT_ID]
696696
subscriptions = []
697697
try:

src/azure-cli-core/azure/cli/core/commands/arm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ def parse_ids_arguments(_, command, args):
258258
# ensure the required parameters are provided if --ids is not
259259
errors = [arg for arg in required_args if getattr(namespace, arg.name, None) is None]
260260
if errors:
261-
missing_required = ' '.join((arg.options_list[0] for arg in errors))
261+
missing_required = ' '.join(arg.options_list[0] for arg in errors)
262262
raise CLIError('({} | {}) are required'.format(missing_required, '--ids'))
263263
return
264264

src/azure-cli-core/azure/cli/core/extension/_homebrew_patch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515

1616
def is_homebrew():
17-
return any((p.startswith(HOMEBREW_CELLAR_PATH) for p in sys.path))
17+
return any(p.startswith(HOMEBREW_CELLAR_PATH) for p in sys.path)
1818

1919

2020
# A workaround for https://github.com/Azure/azure-cli/issues/4428

src/azure-cli-core/azure/cli/core/extension/_index.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def get_index(index_url=None, cli_ctx=None):
4444

4545
for try_number in range(TRIES):
4646
try:
47-
response = requests.get(index_url, verify=(not should_disable_connection_verify()))
47+
response = requests.get(index_url, verify=not should_disable_connection_verify())
4848
if response.status_code == 200:
4949
return response.json()
5050
msg = ERR_TMPL_NON_200.format(response.status_code, index_url)

src/azure-cli-core/azure/cli/core/extension/operations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def _whl_download_from_url(url_parse_result, ext_file):
6565
import requests
6666
from azure.cli.core.util import should_disable_connection_verify
6767
url = url_parse_result.geturl()
68-
r = requests.get(url, stream=True, verify=(not should_disable_connection_verify()))
68+
r = requests.get(url, stream=True, verify=not should_disable_connection_verify())
6969
if r.status_code != 200:
7070
raise CLIError("Request to {} failed with {}".format(url, r.status_code))
7171
with open(ext_file, 'wb') as f:

src/azure-cli-core/azure/cli/core/parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"To learn more about extensions, please visit "
3333
"'https://docs.microsoft.com/cli/azure/azure-cli-extensions-overview'")
3434

35-
OVERVIEW_REFERENCE = ("https://aka.ms/cli_ref")
35+
OVERVIEW_REFERENCE = "https://aka.ms/cli_ref"
3636

3737

3838
class IncorrectUsageError(CLIError):

src/azure-cli/azure/cli/command_modules/acr/_docker_utils.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def _handle_challenge_phase(login_server,
100100

101101
request_url = 'https://' + login_server + '/v2/'
102102
logger.debug(add_timestamp("Sending a HTTP Get request to {}".format(request_url)))
103-
challenge = requests.get(request_url, verify=(not should_disable_connection_verify()))
103+
challenge = requests.get(request_url, verify=not should_disable_connection_verify())
104104

105105
if challenge.status_code != 401 or 'WWW-Authenticate' not in challenge.headers:
106106
from ._errors import CONNECTIVITY_CHALLENGE_ERROR
@@ -164,7 +164,7 @@ def _get_aad_token_after_challenge(cli_ctx,
164164

165165
logger.debug(add_timestamp("Sending a HTTP Post request to {}".format(authhost)))
166166
response = requests.post(authhost, urlencode(content), headers=headers,
167-
verify=(not should_disable_connection_verify()))
167+
verify=not should_disable_connection_verify())
168168

169169
if response.status_code == 429:
170170
if is_diagnostics_context:
@@ -200,7 +200,7 @@ def _get_aad_token_after_challenge(cli_ctx,
200200

201201
logger.debug(add_timestamp("Sending a HTTP Post request to {}".format(authhost)))
202202
response = requests.post(authhost, urlencode(content), headers=headers,
203-
verify=(not should_disable_connection_verify()))
203+
verify=not should_disable_connection_verify())
204204

205205
if response.status_code not in [200]:
206206
from ._errors import CONNECTIVITY_ACCESS_TOKEN_ERROR
@@ -301,7 +301,7 @@ def _get_token_with_username_and_password(login_server,
301301

302302
logger.debug(add_timestamp("Sending a HTTP Post request to {}".format(authhost)))
303303
response = requests.post(authhost, urlencode(content), headers=headers,
304-
verify=(not should_disable_connection_verify()))
304+
verify=not should_disable_connection_verify())
305305

306306
if response.status_code != 200:
307307
from ._errors import CONNECTIVITY_ACCESS_TOKEN_ERROR
@@ -365,7 +365,7 @@ def _get_credentials(cmd, # pylint: disable=too-many-statements
365365
url = 'https://' + login_server + '/v2/'
366366
try:
367367
logger.debug(add_timestamp("Sending a HTTP Get request to {}".format(url)))
368-
challenge = requests.get(url, verify=(not should_disable_connection_verify()))
368+
challenge = requests.get(url, verify=not should_disable_connection_verify())
369369
if challenge.status_code == 403:
370370
raise CLIError("Looks like you don't have access to registry '{}'. "
371371
"To see configured firewall rules, run 'az acr show --query networkRuleSet --name {}'. "

src/azure-cli/azure/cli/command_modules/acr/check_health.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ def _get_registry_status(login_server, registry_name, ignore_errors):
234234
try:
235235
request_url = 'https://' + login_server + '/v2/'
236236
logger.debug(add_timestamp("Sending a HTTP GET request to {}".format(request_url)))
237-
challenge = requests.get(request_url, verify=(not should_disable_connection_verify()))
237+
challenge = requests.get(request_url, verify=not should_disable_connection_verify())
238238
except SSLError:
239239
from ._errors import CONNECTIVITY_SSL_ERROR
240240
_handle_error(CONNECTIVITY_SSL_ERROR.format_error_message(login_server), ignore_errors)
@@ -334,7 +334,7 @@ def _check_registry_health(cmd, registry_name, ignore_errors):
334334
if v.client_id == client_id:
335335
from azure.core.exceptions import HttpResponseError
336336
try:
337-
valid_identity = (resolve_identity_client_id(cmd.cli_ctx, k) == client_id)
337+
valid_identity = resolve_identity_client_id(cmd.cli_ctx, k) == client_id
338338
except HttpResponseError:
339339
pass
340340
if not valid_identity:

src/azure-cli/azure/cli/command_modules/acr/pack.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def acr_pack_build(cmd, # pylint: disable=too-many-locals
6363

6464
registry_prefixes = '$Registry/', registry.login_server + '/'
6565
# If the image name doesn't have any required prefix, add it
66-
if all((not image_name.startswith(prefix) for prefix in registry_prefixes)):
66+
if all(not image_name.startswith(prefix) for prefix in registry_prefixes):
6767
original_image_name = image_name
6868
image_name = registry_prefixes[0] + image_name
6969
logger.debug('Modified image name from %s to %s', original_image_name, image_name)

0 commit comments

Comments
 (0)