From e50fbd41133cf21db61eff1a8aa360dd23e86598 Mon Sep 17 00:00:00 2001 From: jiasli <4003950+jiasli@users.noreply.github.com> Date: Fri, 7 May 2021 16:08:24 +0800 Subject: [PATCH] fix no-else-break --- pylintrc | 1 - .../azure/cli/core/commands/arm.py | 7 +++--- .../appservice/_create_util.py | 2 +- .../cli/command_modules/cdn/custom/custom.py | 2 +- .../cli/command_modules/resource/custom.py | 22 +++++++++---------- 5 files changed, 16 insertions(+), 18 deletions(-) diff --git a/pylintrc b/pylintrc index 1b7461be51c..80fe34da010 100644 --- a/pylintrc +++ b/pylintrc @@ -23,7 +23,6 @@ disable= locally-disabled, missing-docstring, missing-kwoa, - no-else-break, no-else-continue, no-member, no-value-for-parameter, diff --git a/src/azure-cli-core/azure/cli/core/commands/arm.py b/src/azure-cli-core/azure/cli/core/commands/arm.py index a48078aafc5..21531044ad8 100644 --- a/src/azure-cli-core/azure/cli/core/commands/arm.py +++ b/src/azure-cli-core/azure/cli/core/commands/arm.py @@ -442,7 +442,7 @@ def _find_split(): # keys done the rest is value value = chars break - elif c == '[': + if c == '[': brackets = True key += c elif c == ']' and brackets: @@ -728,13 +728,12 @@ def assign_identity(cli_ctx, getter, setter, identity_role=None, identity_scope= if 'role assignment already exists' in ex.message: logger.info('Role assignment already exists') break - elif retry_time < retry_times and ' does not exist in the directory ' in ex.message: + if retry_time < retry_times and ' does not exist in the directory ' in ex.message: time.sleep(5) logger.warning('Retrying role assignment creation: %s/%s', retry_time + 1, retry_times) continue - else: - raise + raise return resource diff --git a/src/azure-cli/azure/cli/command_modules/appservice/_create_util.py b/src/azure-cli/azure/cli/command_modules/appservice/_create_util.py index de91f91a3b3..be45b5bb0ac 100644 --- a/src/azure-cli/azure/cli/command_modules/appservice/_create_util.py +++ b/src/azure-cli/azure/cli/command_modules/appservice/_create_util.py @@ -155,7 +155,7 @@ def get_lang_from_content(src_path, html=False): fnmatch.fnmatch(file, "*shtml.")): static_html_file = os.path.join(src_path, file) break - elif fnmatch.fnmatch(file, "*.csproj"): + if fnmatch.fnmatch(file, "*.csproj"): package_netcore_file = os.path.join(src_path, file) break diff --git a/src/azure-cli/azure/cli/command_modules/cdn/custom/custom.py b/src/azure-cli/azure/cli/command_modules/cdn/custom/custom.py index fedc7ae373b..827c8d0c6bc 100644 --- a/src/azure-cli/azure/cli/command_modules/cdn/custom/custom.py +++ b/src/azure-cli/azure/cli/command_modules/cdn/custom/custom.py @@ -461,7 +461,7 @@ def remove_rule(client, resource_group_name, profile_name, endpoint_name, rule_n if rule_name is not None and rule.name == rule_name: pop_index = idx break - elif order is not None and rule.order == order: + if order is not None and rule.order == order: pop_index = idx break diff --git a/src/azure-cli/azure/cli/command_modules/resource/custom.py b/src/azure-cli/azure/cli/command_modules/resource/custom.py index be2eaeb5925..7c6e183fad7 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/custom.py +++ b/src/azure-cli/azure/cli/command_modules/resource/custom.py @@ -195,7 +195,7 @@ def _prompt_for_parameters(missing_parameters, fail_on_no_tty=True): # pylint: result[param_name] = None no_tty = True break - elif param_type == 'securestring': + if param_type == 'securestring': try: value = prompt_pass(prompt_str, help_string=description) except NoTTYException: @@ -203,7 +203,7 @@ def _prompt_for_parameters(missing_parameters, fail_on_no_tty=True): # pylint: no_tty = True result[param_name] = value break - elif param_type == 'int': + if param_type == 'int': try: int_value = prompt_int(prompt_str, help_string=description) result[param_name] = int_value @@ -211,7 +211,7 @@ def _prompt_for_parameters(missing_parameters, fail_on_no_tty=True): # pylint: result[param_name] = 0 no_tty = True break - elif param_type == 'bool': + if param_type == 'bool': try: value = prompt_t_f(prompt_str, help_string=description) result[param_name] = value @@ -219,7 +219,7 @@ def _prompt_for_parameters(missing_parameters, fail_on_no_tty=True): # pylint: result[param_name] = False no_tty = True break - elif param_type in ['object', 'array']: + if param_type in ['object', 'array']: try: value = prompt(prompt_str, help_string=description) except NoTTYException: @@ -236,13 +236,13 @@ def _prompt_for_parameters(missing_parameters, fail_on_no_tty=True): # pylint: continue result[param_name] = value break - else: - try: - result[param_name] = prompt(prompt_str, help_string=description) - except NoTTYException: - result[param_name] = None - no_tty = True - break + + try: + result[param_name] = prompt(prompt_str, help_string=description) + except NoTTYException: + result[param_name] = None + no_tty = True + break if no_tty and fail_on_no_tty: raise NoTTYException return result