Skip to content

Commit

Permalink
{Pylint} Remove some invalid disable=unused-argument
Browse files Browse the repository at this point in the history
  • Loading branch information
atombrella committed Dec 23, 2024
1 parent ec666ca commit 96fe70b
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 33 deletions.
2 changes: 1 addition & 1 deletion src/azure-cli-core/azure/cli/core/aaz/_arg_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 3 additions & 4 deletions src/azure-cli/azure/cli/command_modules/acs/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
22 changes: 11 additions & 11 deletions src/azure-cli/azure/cli/command_modules/aro/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
11 changes: 5 additions & 6 deletions src/azure-cli/azure/cli/command_modules/keyvault/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion src/azure-cli/azure/cli/command_modules/redis/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/azure-cli/azure/cli/command_modules/role/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -1138,7 +1138,7 @@ def reset_service_principal_credential(cmd, client, identifier, create_cert=Fals
return result


def delete_service_principal_credential(cmd, client, # pylint: disable=unused-argument
def delete_service_principal_credential(cmd, client,
identifier, key_id, cert=False):
sp = show_service_principal(client, identifier)
_delete_credential(sp, client.service_principal_remove_password, client.service_principal_update,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down Expand Up @@ -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)


Expand Down Expand Up @@ -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
Expand All @@ -2540,15 +2540,15 @@ 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 "
"when creating vmss with automatic repairs")
_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")
Expand Down

0 comments on commit 96fe70b

Please sign in to comment.