From 5d5348899cc6f021af1895719567f597b660f68b Mon Sep 17 00:00:00 2001 From: Mads Jensen Date: Mon, 23 Dec 2024 12:20:05 +0100 Subject: [PATCH] {Pylint} Remove some invalid disable=unused-argument --- .../azure/cli/core/aaz/_arg_action.py | 2 +- .../azure/cli/command_modules/acs/custom.py | 7 +++--- .../azure/cli/command_modules/aro/custom.py | 22 +++++++++---------- .../command_modules/hdinsight/_completers.py | 2 +- .../cli/command_modules/keyvault/custom.py | 11 +++++----- .../operations/diagnostics_settings.py | 2 +- .../azure/cli/command_modules/redis/custom.py | 1 - .../cli/command_modules/role/_validators.py | 2 +- .../storage/operations/azcopy.py | 1 - .../vm/azure_stack/_validators.py | 10 ++++----- 10 files changed, 28 insertions(+), 32 deletions(-) diff --git a/src/azure-cli-core/azure/cli/core/aaz/_arg_action.py b/src/azure-cli-core/azure/cli/core/aaz/_arg_action.py index de5ab238963..a298acec789 100644 --- a/src/azure-cli-core/azure/cli/core/aaz/_arg_action.py +++ b/src/azure-cli-core/azure/cli/core/aaz/_arg_action.py @@ -233,7 +233,7 @@ def get_schema_by_key_items(key_items, schema): return tuple(valid_key_items), schema @classmethod - def _decode_value(cls, schema, value): # pylint: disable=unused-argument + def _decode_value(cls, schema, value): from ._arg import AAZSimpleTypeArg from azure.cli.core.util import get_file_json, shell_safe_json_parse, get_file_yaml diff --git a/src/azure-cli/azure/cli/command_modules/acs/custom.py b/src/azure-cli/azure/cli/command_modules/acs/custom.py index 83efd0624dc..afc46e97f59 100644 --- a/src/azure-cli/azure/cli/command_modules/acs/custom.py +++ b/src/azure-cli/azure/cli/command_modules/acs/custom.py @@ -2686,7 +2686,7 @@ def aks_agentpool_operation_abort(cmd, return sdk_no_wait(no_wait, client.begin_abort_latest_operation, resource_group_name, cluster_name, nodepool_name) -def aks_operation_abort(cmd, # pylint: disable=unused-argument +def aks_operation_abort(cmd, client, resource_group_name, name, @@ -2705,7 +2705,7 @@ def aks_operation_abort(cmd, # pylint: disable=unused-argument return sdk_no_wait(no_wait, client.begin_abort_latest_operation, resource_group_name, name) -def aks_agentpool_delete_machines(cmd, # pylint: disable=unused-argument +def aks_agentpool_delete_machines(cmd, client, resource_group_name, cluster_name, @@ -2805,7 +2805,7 @@ def aks_nodepool_snapshot_create(cmd, # pylint: disable=too-many-locals,too-m return client.create_or_update(resource_group_name, snapshot_name, snapshot, headers=aks_custom_headers) -def aks_nodepool_snapshot_update(cmd, client, resource_group_name, snapshot_name, tags): # pylint: disable=unused-argument +def aks_nodepool_snapshot_update(cmd, client, resource_group_name, snapshot_name, tags): TagsObject = cmd.get_models( "TagsObject", resource_type=ResourceType.MGMT_CONTAINERSERVICE, @@ -3266,7 +3266,6 @@ def aks_approuting_zone_list( raise CLIError('App routing addon is not enabled') -# pylint: disable=unused-argument def _aks_approuting_update( cmd, client, diff --git a/src/azure-cli/azure/cli/command_modules/aro/custom.py b/src/azure-cli/azure/cli/command_modules/aro/custom.py index 93a427b60c2..3b695e7c424 100644 --- a/src/azure-cli/azure/cli/command_modules/aro/custom.py +++ b/src/azure-cli/azure/cli/command_modules/aro/custom.py @@ -44,8 +44,8 @@ def aro_create(cmd, # pylint: disable=too-many-locals resource_name, master_subnet, worker_subnet, - vnet=None, # pylint: disable=unused-argument - vnet_resource_group_name=None, # pylint: disable=unused-argument + vnet=None, + vnet_resource_group_name=None, enable_preconfigured_nsg=False, location=None, pull_secret=None, @@ -301,21 +301,21 @@ def __init__(self, disk_encryption_id, master_subnet_id, worker_subnet_id, preco def aro_validate(cmd, # pylint: disable=too-many-locals,too-many-statements - client, # pylint: disable=unused-argument - resource_group_name, # pylint: disable=unused-argument - resource_name, # pylint: disable=unused-argument + client, + resource_group_name, + resource_name, master_subnet, worker_subnet, vnet=None, - cluster_resource_group=None, # pylint: disable=unused-argument + cluster_resource_group=None, client_id=None, - client_secret=None, # pylint: disable=unused-argument - vnet_resource_group_name=None, # pylint: disable=unused-argument + client_secret=None, + vnet_resource_group_name=None, disk_encryption_set=None, - location=None, # pylint: disable=unused-argument + location=None, version=None, - pod_cidr=None, # pylint: disable=unused-argument - service_cidr=None, # pylint: disable=unused-argument + pod_cidr=None, + service_cidr=None, ): validate(cmd, diff --git a/src/azure-cli/azure/cli/command_modules/hdinsight/_completers.py b/src/azure-cli/azure/cli/command_modules/hdinsight/_completers.py index bc6e21854bb..a165f6f672d 100644 --- a/src/azure-cli/azure/cli/command_modules/hdinsight/_completers.py +++ b/src/azure-cli/azure/cli/command_modules/hdinsight/_completers.py @@ -79,7 +79,7 @@ def __init__(self, worker=None, timeout=COMPLETION_TIME_OUT): self.timeout = timeout self.worker_result = [] - def complete(self, cmd, prefix, namespace): # pylint: disable=unused-argument + def complete(self, cmd, prefix, namespace): thread = threading.Thread(target=self.complete_worker, args=[self.worker, cmd, prefix, namespace]) thread.daemon = True thread.start() diff --git a/src/azure-cli/azure/cli/command_modules/keyvault/custom.py b/src/azure-cli/azure/cli/command_modules/keyvault/custom.py index 69e873a9849..fe4e4ba8ad7 100644 --- a/src/azure-cli/azure/cli/command_modules/keyvault/custom.py +++ b/src/azure-cli/azure/cli/command_modules/keyvault/custom.py @@ -229,7 +229,7 @@ def get_deleted_vault_or_hsm(cmd, client, location=None, vault_name=None, hsm_na return hsm_client.get_deleted(name=hsm_name, location=location) -def purge_vault_or_hsm(cmd, client, location=None, vault_name=None, hsm_name=None, # pylint: disable=unused-argument +def purge_vault_or_hsm(cmd, client, location=None, vault_name=None, hsm_name=None, no_wait=False): if is_azure_stack_profile(cmd) or vault_name: return sdk_no_wait( @@ -316,7 +316,7 @@ def _create_network_rule_set(cmd, bypass=None, default_action=None): # region KeyVault Vault -def get_default_policy(cmd, scaffold=False): # pylint: disable=unused-argument +def get_default_policy(cmd, scaffold=False): """ Get a default certificate policy to be used with `az keyvault certificate create` :param bool scaffold: create a fully formed policy structure with default values @@ -1475,7 +1475,7 @@ def update_key_rotation_policy(cmd, client, value, key_name=None): # region KeyVault Secret -def download_secret(client, file_path, name=None, encoding=None, version=''): # pylint: disable=unused-argument +def download_secret(client, file_path, name=None, encoding=None, version=''): """ Download a secret from a KeyVault. """ if os.path.isfile(file_path) or os.path.isdir(file_path): raise CLIError("File or directory named '{}' already exists.".format(file_path)) @@ -1506,7 +1506,7 @@ def download_secret(client, file_path, name=None, encoding=None, version=''): # raise ex -def backup_secret(client, file_path, name=None): # pylint: disable=unused-argument +def backup_secret(client, file_path, name=None): backup = client.backup_secret(name) with open(file_path, 'wb') as output: output.write(backup) @@ -1709,8 +1709,7 @@ def _update_private_endpoint_connection_status(cmd, client, resource_group_name, if no_wait: return retval - new_retval = \ - _wait_private_link_operation(client, resource_group_name, name, private_endpoint_connection_name) + new_retval = _wait_private_link_operation(client, resource_group_name, name, private_endpoint_connection_name) if new_retval: return new_retval diff --git a/src/azure-cli/azure/cli/command_modules/monitor/operations/diagnostics_settings.py b/src/azure-cli/azure/cli/command_modules/monitor/operations/diagnostics_settings.py index cc3c1322b3a..1da7345ccba 100644 --- a/src/azure-cli/azure/cli/command_modules/monitor/operations/diagnostics_settings.py +++ b/src/azure-cli/azure/cli/command_modules/monitor/operations/diagnostics_settings.py @@ -232,7 +232,7 @@ def pre_operations(self): update_resource_parameters(ctx) -# pylint: disable=unused-argument, line-too-long +# pylint: disable=line-too-long def create_diagnostics_settings(client, name, resource_uri, logs=None, metrics=None, diff --git a/src/azure-cli/azure/cli/command_modules/redis/custom.py b/src/azure-cli/azure/cli/command_modules/redis/custom.py index e0b28bf3eaa..5fc5b40412e 100644 --- a/src/azure-cli/azure/cli/command_modules/redis/custom.py +++ b/src/azure-cli/azure/cli/command_modules/redis/custom.py @@ -139,7 +139,6 @@ def get_key_value_pair(string): return result -# pylint: disable=unused-argument def cli_redis_create_server_link(cmd, client, resource_group_name, name, server_to_link, replication_role): redis_client = cf_redis(cmd.cli_ctx) from azure.cli.core.commands.client_factory import get_subscription_id diff --git a/src/azure-cli/azure/cli/command_modules/role/_validators.py b/src/azure-cli/azure/cli/command_modules/role/_validators.py index 80020c8c945..3228d55c578 100644 --- a/src/azure-cli/azure/cli/command_modules/role/_validators.py +++ b/src/azure-cli/azure/cli/command_modules/role/_validators.py @@ -74,7 +74,7 @@ def validate_cert(namespace): namespace.cert = x509 -def process_assignment_namespace(cmd, namespace): # pylint: disable=unused-argument +def process_assignment_namespace(cmd, namespace): # Make sure these arguments are non-empty strings. # When they are accidentally provided as an empty string "", they won't take effect when filtering the role # assignments, causing all matched role assignments to be listed/deleted. For example, diff --git a/src/azure-cli/azure/cli/command_modules/storage/operations/azcopy.py b/src/azure-cli/azure/cli/command_modules/storage/operations/azcopy.py index 936f3eb9988..1604481d605 100644 --- a/src/azure-cli/azure/cli/command_modules/storage/operations/azcopy.py +++ b/src/azure-cli/azure/cli/command_modules/storage/operations/azcopy.py @@ -78,7 +78,6 @@ def storage_remove(cmd, client, service, target, recursive=None, exclude_pattern azcopy.remove(_add_url_sas(target, sas_token), flags=flags) -# pylint: disable=unused-argument def storage_fs_directory_copy(cmd, source, destination, recursive=None, **kwargs): azcopy = AzCopy() if kwargs.get('token_credential'): diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/_validators.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/_validators.py index e63eece65dd..8ce86a44587 100644 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/_validators.py +++ b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/_validators.py @@ -1879,7 +1879,7 @@ def process_vmss_create_namespace(cmd, namespace): _validate_community_gallery_legal_agreement_acceptance(cmd, namespace) -def validate_vmss_update_namespace(cmd, namespace): # pylint: disable=unused-argument +def validate_vmss_update_namespace(cmd, namespace): if not namespace.instance_id: if namespace.protect_from_scale_in is not None or namespace.protect_from_scale_set_actions is not None: raise CLIError("usage error: protection policies can only be applied to VM instances within a VMSS." @@ -2202,7 +2202,7 @@ def process_remove_identity_namespace(cmd, namespace): 'Microsoft.ManagedIdentity') -def process_set_applications_namespace(cmd, namespace): # pylint: disable=unused-argument +def process_set_applications_namespace(cmd, namespace): _validate_vm_vmss_set_applications(cmd, namespace) @@ -2519,7 +2519,7 @@ def process_vm_vmss_stop(cmd, namespace): # pylint: disable=unused-argument "To deallocate a VM, run: az vm deallocate.") -def _validate_vmss_update_terminate_notification_related(cmd, namespace): # pylint: disable=unused-argument +def _validate_vmss_update_terminate_notification_related(cmd, namespace): """ Validate vmss update enable_terminate_notification and terminate_notification_time. If terminate_notification_time is specified, enable_terminate_notification should not be false @@ -2540,7 +2540,7 @@ def _validate_vmss_terminate_notification(cmd, namespace): # pylint: disable=un namespace.terminate_notification_time = 'PT' + namespace.terminate_notification_time + 'M' -def _validate_vmss_create_automatic_repairs(cmd, namespace): # pylint: disable=unused-argument +def _validate_vmss_create_automatic_repairs(cmd, namespace): if namespace.automatic_repairs_grace_period is not None or namespace.automatic_repairs_action is not None: if namespace.load_balancer is None or namespace.health_probe is None: raise ArgumentUsageError("usage error: --load-balancer and --health-probe are required " @@ -2548,7 +2548,7 @@ def _validate_vmss_create_automatic_repairs(cmd, namespace): # pylint: disable= _validate_vmss_automatic_repairs(cmd, namespace) -def _validate_vmss_update_automatic_repairs(cmd, namespace): # pylint: disable=unused-argument +def _validate_vmss_update_automatic_repairs(cmd, namespace): if namespace.enable_automatic_repairs is False and \ (namespace.automatic_repairs_grace_period is not None or namespace.automatic_repairs_action is not None): raise ArgumentUsageError("usage error: please enable --enable-automatic-repairs")