зеркало из https://github.com/Azure/azure-cli.git
{Pylint} Fix consider-using-enumerate (#30343)
This commit is contained in:
Родитель
d9de029ea6
Коммит
818142fbc9
1
pylintrc
1
pylintrc
|
@ -39,7 +39,6 @@ disable=
|
||||||
consider-using-f-string,
|
consider-using-f-string,
|
||||||
unspecified-encoding,
|
unspecified-encoding,
|
||||||
consider-using-in,
|
consider-using-in,
|
||||||
consider-using-enumerate,
|
|
||||||
# These rules were added in Pylint >= 2.12, disable them to avoid making retroactive change
|
# These rules were added in Pylint >= 2.12, disable them to avoid making retroactive change
|
||||||
missing-timeout,
|
missing-timeout,
|
||||||
# These rules were added in Pylint >= 3.2
|
# These rules were added in Pylint >= 3.2
|
||||||
|
|
|
@ -500,8 +500,8 @@ def ensure_container_insights_for_monitoring(
|
||||||
extensionSettings["dataCollectionSettings"] = dataCollectionSettings
|
extensionSettings["dataCollectionSettings"] = dataCollectionSettings
|
||||||
|
|
||||||
if enable_high_log_scale_mode:
|
if enable_high_log_scale_mode:
|
||||||
for i in range(len(cistreams)):
|
for i, v in enumerate(cistreams):
|
||||||
if cistreams[i] == "Microsoft-ContainerLogV2":
|
if v == "Microsoft-ContainerLogV2":
|
||||||
cistreams[i] = "Microsoft-ContainerLogV2-HighScale"
|
cistreams[i] = "Microsoft-ContainerLogV2-HighScale"
|
||||||
# create the DCR
|
# create the DCR
|
||||||
dcr_creation_body_without_syslog = json.dumps(
|
dcr_creation_body_without_syslog = json.dumps(
|
||||||
|
|
|
@ -209,8 +209,8 @@ def fetch_tier_for_rp(rp):
|
||||||
setattr(rp, "tier_type", None)
|
setattr(rp, "tier_type", None)
|
||||||
return
|
return
|
||||||
|
|
||||||
for i in range(len(rp.properties.recovery_point_tier_details)):
|
for v in rp.properties.recovery_point_tier_details:
|
||||||
currRpTierDetails = rp.properties.recovery_point_tier_details[i]
|
currRpTierDetails = v
|
||||||
if (currRpTierDetails.type == RecoveryPointTierType.ARCHIVED_RP and
|
if (currRpTierDetails.type == RecoveryPointTierType.ARCHIVED_RP and
|
||||||
currRpTierDetails.status == RecoveryPointTierStatus.REHYDRATED):
|
currRpTierDetails.status == RecoveryPointTierStatus.REHYDRATED):
|
||||||
isRehydrated = True
|
isRehydrated = True
|
||||||
|
|
|
@ -564,9 +564,9 @@ def add_condition(client, resource_group_name, profile_name, endpoint_name,
|
||||||
endpoint = client.endpoints.get(resource_group_name, profile_name, endpoint_name)
|
endpoint = client.endpoints.get(resource_group_name, profile_name, endpoint_name)
|
||||||
policy = endpoint.delivery_policy
|
policy = endpoint.delivery_policy
|
||||||
condition = create_condition(match_variable, operator, match_values, selector, negate_condition, transform)
|
condition = create_condition(match_variable, operator, match_values, selector, negate_condition, transform)
|
||||||
for i in range(0, len(policy.rules)):
|
for v in policy.rules:
|
||||||
if policy.rules[i].name == rule_name:
|
if v.name == rule_name:
|
||||||
policy.rules[i].conditions.append(condition)
|
v.conditions.append(condition)
|
||||||
|
|
||||||
params = EndpointUpdateParameters(
|
params = EndpointUpdateParameters(
|
||||||
delivery_policy=policy
|
delivery_policy=policy
|
||||||
|
@ -589,9 +589,9 @@ def add_action(cmd, client, resource_group_name, profile_name, endpoint_name,
|
||||||
redirect_protocol, custom_hostname, custom_path, custom_querystring,
|
redirect_protocol, custom_hostname, custom_path, custom_querystring,
|
||||||
custom_fragment, source_pattern, destination, preserve_unmatched_path,
|
custom_fragment, source_pattern, destination, preserve_unmatched_path,
|
||||||
cmd, resource_group_name, profile_name, endpoint_name, origin_group)
|
cmd, resource_group_name, profile_name, endpoint_name, origin_group)
|
||||||
for i in range(0, len(policy.rules)):
|
for v in policy.rules:
|
||||||
if policy.rules[i].name == rule_name:
|
if v.name == rule_name:
|
||||||
policy.rules[i].actions.append(action)
|
v.actions.append(action)
|
||||||
|
|
||||||
params = EndpointUpdateParameters(
|
params = EndpointUpdateParameters(
|
||||||
delivery_policy=policy
|
delivery_policy=policy
|
||||||
|
@ -645,9 +645,9 @@ def remove_condition(client, resource_group_name, profile_name, endpoint_name, r
|
||||||
endpoint = client.endpoints.get(resource_group_name, profile_name, endpoint_name)
|
endpoint = client.endpoints.get(resource_group_name, profile_name, endpoint_name)
|
||||||
policy = endpoint.delivery_policy
|
policy = endpoint.delivery_policy
|
||||||
if policy is not None:
|
if policy is not None:
|
||||||
for i in range(0, len(policy.rules)):
|
for v in policy.rules:
|
||||||
if policy.rules[i].name == rule_name:
|
if v.name == rule_name:
|
||||||
policy.rules[i].conditions.pop(index)
|
v.conditions.pop(index)
|
||||||
else:
|
else:
|
||||||
logger.warning("rule cannot be found. This command will be skipped. Please check the rule name")
|
logger.warning("rule cannot be found. This command will be skipped. Please check the rule name")
|
||||||
|
|
||||||
|
@ -663,9 +663,9 @@ def remove_action(client, resource_group_name, profile_name, endpoint_name, rule
|
||||||
endpoint = client.endpoints.get(resource_group_name, profile_name, endpoint_name)
|
endpoint = client.endpoints.get(resource_group_name, profile_name, endpoint_name)
|
||||||
policy = endpoint.delivery_policy
|
policy = endpoint.delivery_policy
|
||||||
if policy is not None:
|
if policy is not None:
|
||||||
for i in range(0, len(policy.rules)):
|
for v in policy.rules:
|
||||||
if policy.rules[i].name == rule_name:
|
if v.name == rule_name:
|
||||||
policy.rules[i].actions.pop(index)
|
v.actions.pop(index)
|
||||||
else:
|
else:
|
||||||
logger.warning("rule cannot be found. This command will be skipped. Please check the rule name")
|
logger.warning("rule cannot be found. This command will be skipped. Please check the rule name")
|
||||||
|
|
||||||
|
|
|
@ -92,9 +92,9 @@ class AzCopy:
|
||||||
def run_command(self, args):
|
def run_command(self, args):
|
||||||
args = [self.executable] + args
|
args = [self.executable] + args
|
||||||
args_hides = args.copy()
|
args_hides = args.copy()
|
||||||
for i in range(len(args_hides)):
|
for i, v in enumerate(args_hides):
|
||||||
if args_hides[i].find('sig') > 0:
|
if v.find('sig') > 0:
|
||||||
args_hides[i] = args_hides[i][0:args_hides[i].index('sig') + 4]
|
args_hides[i] = v[0:v.index('sig') + 4]
|
||||||
logger.warning("Azcopy command: %s", args_hides)
|
logger.warning("Azcopy command: %s", args_hides)
|
||||||
env_kwargs = {}
|
env_kwargs = {}
|
||||||
if self.creds and self.creds.tenant_id:
|
if self.creds and self.creds.tenant_id:
|
||||||
|
|
|
@ -2176,9 +2176,9 @@ def process_assign_identity_namespace(cmd, namespace):
|
||||||
def process_remove_identity_namespace(cmd, namespace):
|
def process_remove_identity_namespace(cmd, namespace):
|
||||||
if namespace.identities:
|
if namespace.identities:
|
||||||
from ._vm_utils import MSI_LOCAL_ID
|
from ._vm_utils import MSI_LOCAL_ID
|
||||||
for i in range(len(namespace.identities)):
|
for i, identity in enumerate(namespace.identities):
|
||||||
if namespace.identities[i] != MSI_LOCAL_ID:
|
if identity != MSI_LOCAL_ID:
|
||||||
namespace.identities[i] = _get_resource_id(cmd.cli_ctx, namespace.identities[i],
|
namespace.identities[i] = _get_resource_id(cmd.cli_ctx, identity,
|
||||||
namespace.resource_group_name,
|
namespace.resource_group_name,
|
||||||
'userAssignedIdentities',
|
'userAssignedIdentities',
|
||||||
'Microsoft.ManagedIdentity')
|
'Microsoft.ManagedIdentity')
|
||||||
|
|
|
@ -2194,9 +2194,9 @@ def process_assign_identity_namespace(cmd, namespace):
|
||||||
def process_remove_identity_namespace(cmd, namespace):
|
def process_remove_identity_namespace(cmd, namespace):
|
||||||
if namespace.identities:
|
if namespace.identities:
|
||||||
from ._vm_utils import MSI_LOCAL_ID
|
from ._vm_utils import MSI_LOCAL_ID
|
||||||
for i in range(len(namespace.identities)):
|
for i, identity in enumerate(namespace.identities):
|
||||||
if namespace.identities[i] != MSI_LOCAL_ID:
|
if identity != MSI_LOCAL_ID:
|
||||||
namespace.identities[i] = _get_resource_id(cmd.cli_ctx, namespace.identities[i],
|
namespace.identities[i] = _get_resource_id(cmd.cli_ctx, identity,
|
||||||
namespace.resource_group_name,
|
namespace.resource_group_name,
|
||||||
'userAssignedIdentities',
|
'userAssignedIdentities',
|
||||||
'Microsoft.ManagedIdentity')
|
'Microsoft.ManagedIdentity')
|
||||||
|
|
|
@ -5046,9 +5046,9 @@ def get_image_version_to_update(cmd, resource_group_name, gallery_name, gallery_
|
||||||
if version.storage_profile.os_disk_image and version.storage_profile.os_disk_image.source:
|
if version.storage_profile.os_disk_image and version.storage_profile.os_disk_image.source:
|
||||||
version.storage_profile.os_disk_image.source = None
|
version.storage_profile.os_disk_image.source = None
|
||||||
if version.storage_profile.data_disk_images:
|
if version.storage_profile.data_disk_images:
|
||||||
for i in range(len(version.storage_profile.data_disk_images)):
|
for v in version.storage_profile.data_disk_images:
|
||||||
if version.storage_profile.data_disk_images[i].source:
|
if v.source:
|
||||||
version.storage_profile.data_disk_images[i].source = None
|
v.source = None
|
||||||
return version
|
return version
|
||||||
|
|
||||||
|
|
||||||
|
@ -5914,10 +5914,10 @@ def restore_point_create(client,
|
||||||
raise ArgumentUsageError(
|
raise ArgumentUsageError(
|
||||||
'Length of --source-data-disk-resource, --data-disk-restore-point-encryption-type must be same.')
|
'Length of --source-data-disk-resource, --data-disk-restore-point-encryption-type must be same.')
|
||||||
|
|
||||||
for i in range(len(source_data_disk_resource)):
|
for i, v in enumerate(source_data_disk_resource):
|
||||||
data_disks.append({
|
data_disks.append({
|
||||||
'managedDisk': {
|
'managedDisk': {
|
||||||
'id': source_data_disk_resource[i]
|
'id': v
|
||||||
},
|
},
|
||||||
'diskRestorePoint': {
|
'diskRestorePoint': {
|
||||||
'encryption': {
|
'encryption': {
|
||||||
|
@ -5977,11 +5977,11 @@ def restore_point_create(client,
|
||||||
raise ArgumentUsageError(
|
raise ArgumentUsageError(
|
||||||
'Length of --source-data-disk-resource, --data-disk-restore-point-encryption-type must be same.')
|
'Length of --source-data-disk-resource, --data-disk-restore-point-encryption-type must be same.')
|
||||||
|
|
||||||
for i in range(len(source_data_disk_resource)):
|
for i, v in enumerate(source_data_disk_resource):
|
||||||
data_disks.append({
|
data_disks.append({
|
||||||
'diskRestorePoint': {
|
'diskRestorePoint': {
|
||||||
'sourceDiskRestorePoint': {
|
'sourceDiskRestorePoint': {
|
||||||
'id': source_data_disk_resource[i]
|
'id': v
|
||||||
},
|
},
|
||||||
'encryption': {
|
'encryption': {
|
||||||
'disk_encryption_set': {
|
'disk_encryption_set': {
|
||||||
|
|
|
@ -5002,9 +5002,9 @@ def get_image_version_to_update(cmd, resource_group_name, gallery_name, gallery_
|
||||||
if version.storage_profile.os_disk_image and version.storage_profile.os_disk_image.source:
|
if version.storage_profile.os_disk_image and version.storage_profile.os_disk_image.source:
|
||||||
version.storage_profile.os_disk_image.source = None
|
version.storage_profile.os_disk_image.source = None
|
||||||
if version.storage_profile.data_disk_images:
|
if version.storage_profile.data_disk_images:
|
||||||
for i in range(len(version.storage_profile.data_disk_images)):
|
for v in version.storage_profile.data_disk_images:
|
||||||
if version.storage_profile.data_disk_images[i].source:
|
if v.source:
|
||||||
version.storage_profile.data_disk_images[i].source = None
|
v.source = None
|
||||||
return version
|
return version
|
||||||
|
|
||||||
|
|
||||||
|
@ -5835,10 +5835,10 @@ def restore_point_create(client,
|
||||||
if data_disk_restore_point_encryption_type is not None and (len(source_data_disk_resource) != len(data_disk_restore_point_encryption_type)):
|
if data_disk_restore_point_encryption_type is not None and (len(source_data_disk_resource) != len(data_disk_restore_point_encryption_type)):
|
||||||
raise ArgumentUsageError('Length of --source-data-disk-resource, --data-disk-restore-point-encryption-type must be same.')
|
raise ArgumentUsageError('Length of --source-data-disk-resource, --data-disk-restore-point-encryption-type must be same.')
|
||||||
|
|
||||||
for i in range(len(source_data_disk_resource)):
|
for i, v in enumerate(source_data_disk_resource):
|
||||||
data_disks.append({
|
data_disks.append({
|
||||||
'managedDisk': {
|
'managedDisk': {
|
||||||
'id': source_data_disk_resource[i]
|
'id': v
|
||||||
},
|
},
|
||||||
'diskRestorePoint': {
|
'diskRestorePoint': {
|
||||||
'encryption': {
|
'encryption': {
|
||||||
|
@ -5890,11 +5890,11 @@ def restore_point_create(client,
|
||||||
if data_disk_restore_point_encryption_type is not None and (len(source_data_disk_resource) != len(data_disk_restore_point_encryption_type)):
|
if data_disk_restore_point_encryption_type is not None and (len(source_data_disk_resource) != len(data_disk_restore_point_encryption_type)):
|
||||||
raise ArgumentUsageError('Length of --source-data-disk-resource, --data-disk-restore-point-encryption-type must be same.')
|
raise ArgumentUsageError('Length of --source-data-disk-resource, --data-disk-restore-point-encryption-type must be same.')
|
||||||
|
|
||||||
for i in range(len(source_data_disk_resource)):
|
for i, v in enumerate(source_data_disk_resource):
|
||||||
data_disks.append({
|
data_disks.append({
|
||||||
'diskRestorePoint': {
|
'diskRestorePoint': {
|
||||||
'sourceDiskRestorePoint': {
|
'sourceDiskRestorePoint': {
|
||||||
'id': source_data_disk_resource[i]
|
'id': v
|
||||||
},
|
},
|
||||||
'encryption': {
|
'encryption': {
|
||||||
'disk_encryption_set': {
|
'disk_encryption_set': {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче