зеркало из 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,
|
||||
unspecified-encoding,
|
||||
consider-using-in,
|
||||
consider-using-enumerate,
|
||||
# These rules were added in Pylint >= 2.12, disable them to avoid making retroactive change
|
||||
missing-timeout,
|
||||
# These rules were added in Pylint >= 3.2
|
||||
|
|
|
@ -500,8 +500,8 @@ def ensure_container_insights_for_monitoring(
|
|||
extensionSettings["dataCollectionSettings"] = dataCollectionSettings
|
||||
|
||||
if enable_high_log_scale_mode:
|
||||
for i in range(len(cistreams)):
|
||||
if cistreams[i] == "Microsoft-ContainerLogV2":
|
||||
for i, v in enumerate(cistreams):
|
||||
if v == "Microsoft-ContainerLogV2":
|
||||
cistreams[i] = "Microsoft-ContainerLogV2-HighScale"
|
||||
# create the DCR
|
||||
dcr_creation_body_without_syslog = json.dumps(
|
||||
|
|
|
@ -209,8 +209,8 @@ def fetch_tier_for_rp(rp):
|
|||
setattr(rp, "tier_type", None)
|
||||
return
|
||||
|
||||
for i in range(len(rp.properties.recovery_point_tier_details)):
|
||||
currRpTierDetails = rp.properties.recovery_point_tier_details[i]
|
||||
for v in rp.properties.recovery_point_tier_details:
|
||||
currRpTierDetails = v
|
||||
if (currRpTierDetails.type == RecoveryPointTierType.ARCHIVED_RP and
|
||||
currRpTierDetails.status == RecoveryPointTierStatus.REHYDRATED):
|
||||
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)
|
||||
policy = endpoint.delivery_policy
|
||||
condition = create_condition(match_variable, operator, match_values, selector, negate_condition, transform)
|
||||
for i in range(0, len(policy.rules)):
|
||||
if policy.rules[i].name == rule_name:
|
||||
policy.rules[i].conditions.append(condition)
|
||||
for v in policy.rules:
|
||||
if v.name == rule_name:
|
||||
v.conditions.append(condition)
|
||||
|
||||
params = EndpointUpdateParameters(
|
||||
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,
|
||||
custom_fragment, source_pattern, destination, preserve_unmatched_path,
|
||||
cmd, resource_group_name, profile_name, endpoint_name, origin_group)
|
||||
for i in range(0, len(policy.rules)):
|
||||
if policy.rules[i].name == rule_name:
|
||||
policy.rules[i].actions.append(action)
|
||||
for v in policy.rules:
|
||||
if v.name == rule_name:
|
||||
v.actions.append(action)
|
||||
|
||||
params = EndpointUpdateParameters(
|
||||
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)
|
||||
policy = endpoint.delivery_policy
|
||||
if policy is not None:
|
||||
for i in range(0, len(policy.rules)):
|
||||
if policy.rules[i].name == rule_name:
|
||||
policy.rules[i].conditions.pop(index)
|
||||
for v in policy.rules:
|
||||
if v.name == rule_name:
|
||||
v.conditions.pop(index)
|
||||
else:
|
||||
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)
|
||||
policy = endpoint.delivery_policy
|
||||
if policy is not None:
|
||||
for i in range(0, len(policy.rules)):
|
||||
if policy.rules[i].name == rule_name:
|
||||
policy.rules[i].actions.pop(index)
|
||||
for v in policy.rules:
|
||||
if v.name == rule_name:
|
||||
v.actions.pop(index)
|
||||
else:
|
||||
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):
|
||||
args = [self.executable] + args
|
||||
args_hides = args.copy()
|
||||
for i in range(len(args_hides)):
|
||||
if args_hides[i].find('sig') > 0:
|
||||
args_hides[i] = args_hides[i][0:args_hides[i].index('sig') + 4]
|
||||
for i, v in enumerate(args_hides):
|
||||
if v.find('sig') > 0:
|
||||
args_hides[i] = v[0:v.index('sig') + 4]
|
||||
logger.warning("Azcopy command: %s", args_hides)
|
||||
env_kwargs = {}
|
||||
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):
|
||||
if namespace.identities:
|
||||
from ._vm_utils import MSI_LOCAL_ID
|
||||
for i in range(len(namespace.identities)):
|
||||
if namespace.identities[i] != MSI_LOCAL_ID:
|
||||
namespace.identities[i] = _get_resource_id(cmd.cli_ctx, namespace.identities[i],
|
||||
for i, identity in enumerate(namespace.identities):
|
||||
if identity != MSI_LOCAL_ID:
|
||||
namespace.identities[i] = _get_resource_id(cmd.cli_ctx, identity,
|
||||
namespace.resource_group_name,
|
||||
'userAssignedIdentities',
|
||||
'Microsoft.ManagedIdentity')
|
||||
|
|
|
@ -2194,9 +2194,9 @@ def process_assign_identity_namespace(cmd, namespace):
|
|||
def process_remove_identity_namespace(cmd, namespace):
|
||||
if namespace.identities:
|
||||
from ._vm_utils import MSI_LOCAL_ID
|
||||
for i in range(len(namespace.identities)):
|
||||
if namespace.identities[i] != MSI_LOCAL_ID:
|
||||
namespace.identities[i] = _get_resource_id(cmd.cli_ctx, namespace.identities[i],
|
||||
for i, identity in enumerate(namespace.identities):
|
||||
if identity != MSI_LOCAL_ID:
|
||||
namespace.identities[i] = _get_resource_id(cmd.cli_ctx, identity,
|
||||
namespace.resource_group_name,
|
||||
'userAssignedIdentities',
|
||||
'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:
|
||||
version.storage_profile.os_disk_image.source = None
|
||||
if version.storage_profile.data_disk_images:
|
||||
for i in range(len(version.storage_profile.data_disk_images)):
|
||||
if version.storage_profile.data_disk_images[i].source:
|
||||
version.storage_profile.data_disk_images[i].source = None
|
||||
for v in version.storage_profile.data_disk_images:
|
||||
if v.source:
|
||||
v.source = None
|
||||
return version
|
||||
|
||||
|
||||
|
@ -5914,10 +5914,10 @@ def restore_point_create(client,
|
|||
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({
|
||||
'managedDisk': {
|
||||
'id': source_data_disk_resource[i]
|
||||
'id': v
|
||||
},
|
||||
'diskRestorePoint': {
|
||||
'encryption': {
|
||||
|
@ -5977,11 +5977,11 @@ def restore_point_create(client,
|
|||
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({
|
||||
'diskRestorePoint': {
|
||||
'sourceDiskRestorePoint': {
|
||||
'id': source_data_disk_resource[i]
|
||||
'id': v
|
||||
},
|
||||
'encryption': {
|
||||
'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:
|
||||
version.storage_profile.os_disk_image.source = None
|
||||
if version.storage_profile.data_disk_images:
|
||||
for i in range(len(version.storage_profile.data_disk_images)):
|
||||
if version.storage_profile.data_disk_images[i].source:
|
||||
version.storage_profile.data_disk_images[i].source = None
|
||||
for v in version.storage_profile.data_disk_images:
|
||||
if v.source:
|
||||
v.source = None
|
||||
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)):
|
||||
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({
|
||||
'managedDisk': {
|
||||
'id': source_data_disk_resource[i]
|
||||
'id': v
|
||||
},
|
||||
'diskRestorePoint': {
|
||||
'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)):
|
||||
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({
|
||||
'diskRestorePoint': {
|
||||
'sourceDiskRestorePoint': {
|
||||
'id': source_data_disk_resource[i]
|
||||
'id': v
|
||||
},
|
||||
'encryption': {
|
||||
'disk_encryption_set': {
|
||||
|
|
Загрузка…
Ссылка в новой задаче