diff --git a/pylintrc b/pylintrc index 1304d55a09b..7e48385dfad 100644 --- a/pylintrc +++ b/pylintrc @@ -32,7 +32,6 @@ disable= too-many-arguments, too-many-function-args, too-many-lines, - unnecessary-comprehension, use-a-generator, using-constant-test, wrong-import-order, diff --git a/src/azure-cli-core/azure/cli/core/commands/command_operation.py b/src/azure-cli-core/azure/cli/core/commands/command_operation.py index 27f2cc77570..cda0f25c1e4 100644 --- a/src/azure-cli-core/azure/cli/core/commands/command_operation.py +++ b/src/azure-cli-core/azure/cli/core/commands/command_operation.py @@ -312,7 +312,7 @@ def arguments_loader(self): 'force_string', action='store_true', arg_group=group_name, help="When using 'set' or 'add', preserve string literals instead of attempting to convert to JSON." ) - return [(k, v) for k, v in arguments.items()] + return list(arguments.items()) def load_setter_op_arguments(self): op = self.get_op_handler(self.setter_op_path) @@ -365,7 +365,7 @@ def handler(self, command_args): def arguments_loader(self): """ Callback function of CLICommand arguments_loader """ cmd_args = self.load_getter_op_arguments(self.op_path) - return [(k, v) for k, v in cmd_args.items()] + return list(cmd_args.items()) def description_loader(self): """ Callback function of CLICommand description_loader """ @@ -503,7 +503,7 @@ def arguments_loader(self): "provisioningState!='InProgress', " "instanceView.statuses[?code=='PowerState/running']" ) - return [(k, v) for k, v in cmd_args.items()] + return list(cmd_args.items()) def description_loader(self): """ Callback function of CLICommand description_loader """ diff --git a/src/azure-cli-core/azure/cli/core/extension/__init__.py b/src/azure-cli-core/azure/cli/core/extension/__init__.py index 50bdea534f7..a5e7054ec36 100644 --- a/src/azure-cli-core/azure/cli/core/extension/__init__.py +++ b/src/azure-cli-core/azure/cli/core/extension/__init__.py @@ -330,7 +330,7 @@ def get_extensions(ext_type=None): elif not isinstance(ext_type, list): ext_type = [ext_type] for t in ext_type: - extensions.extend([ext for ext in t.get_all()]) + extensions.extend(t.get_all()) return extensions diff --git a/src/azure-cli/azure/cli/command_modules/hdinsight/custom.py b/src/azure-cli/azure/cli/command_modules/hdinsight/custom.py index e435a7178f5..f9bdbffa0d2 100644 --- a/src/azure-cli/azure/cli/command_modules/hdinsight/custom.py +++ b/src/azure-cli/azure/cli/command_modules/hdinsight/custom.py @@ -68,7 +68,7 @@ def create_cluster(cmd, client, cluster_name, resource_group_name, cluster_type, if component_version: # See validator - component_version = {c: v for c, v in [version.split('=') for version in component_version]} + component_version = dict([version.split('=') for version in component_version]) # Validate whether HTTP credentials were provided if 'gateway' in cluster_configurations: diff --git a/src/azure-cli/azure/cli/command_modules/iot/custom.py b/src/azure-cli/azure/cli/command_modules/iot/custom.py index 35b6f551ce9..2016a037834 100644 --- a/src/azure-cli/azure/cli/command_modules/iot/custom.py +++ b/src/azure-cli/azure/cli/command_modules/iot/custom.py @@ -1321,7 +1321,7 @@ def _build_identity(system=False, identities=None): return ArmIdentity(type=identity_type) if system: identity_type = IdentityType.system_assigned.value - user_identities = [i for i in identities] if identities else None + user_identities = list(identities) if identities else None if user_identities and identity_type == IdentityType.system_assigned.value: identity_type = IdentityType.system_assigned_user_assigned.value elif user_identities: diff --git a/src/azure-cli/azure/cli/command_modules/keyvault/_transformers.py b/src/azure-cli/azure/cli/command_modules/keyvault/_transformers.py index fc4b302c4a2..b1d1e13823b 100644 --- a/src/azure-cli/azure/cli/command_modules/keyvault/_transformers.py +++ b/src/azure-cli/azure/cli/command_modules/keyvault/_transformers.py @@ -17,7 +17,7 @@ def _multi_transformers(output, **command_args): def keep_max_results(output, **command_args): maxresults = command_args.get('maxresults', None) if maxresults: - return [_ for _ in output][:maxresults] + return list(output)[:maxresults] return output 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 d563c9dc67b..97d7a081d17 100644 --- a/src/azure-cli/azure/cli/command_modules/keyvault/custom.py +++ b/src/azure-cli/azure/cli/command_modules/keyvault/custom.py @@ -880,7 +880,7 @@ def _object_id_args_helper(cli_ctx, object_id, spn, upn): def _permissions_distinct(permissions): if permissions: - return [_ for _ in {p for p in permissions}] + return list(set(permissions)) return permissions diff --git a/src/azure-cli/azure/cli/command_modules/network/_params.py b/src/azure-cli/azure/cli/command_modules/network/_params.py index 8673a14fd84..12331de3e90 100644 --- a/src/azure-cli/azure/cli/command_modules/network/_params.py +++ b/src/azure-cli/azure/cli/command_modules/network/_params.py @@ -554,7 +554,7 @@ def load_arguments(self, _): nargs='+', help='Space-separated list of transforms to apply when matching.') if WebApplicationFirewallMatchVariable: - waf_custom_rule_match_variables = [x for x in WebApplicationFirewallMatchVariable] + waf_custom_rule_match_variables = list(WebApplicationFirewallMatchVariable) help_string = 'Space-separated list of variables to use when matching. ' \ 'Variable values: {}'.format(', '.join(waf_custom_rule_match_variables)) c.argument('match_variables', nargs='+', help=help_string, validator=validate_match_variables) diff --git a/src/azure-cli/azure/cli/command_modules/storage/_validators.py b/src/azure-cli/azure/cli/command_modules/storage/_validators.py index e26851b3a00..f2bcc219a44 100644 --- a/src/azure-cli/azure/cli/command_modules/storage/_validators.py +++ b/src/azure-cli/azure/cli/command_modules/storage/_validators.py @@ -860,7 +860,7 @@ def process_blob_upload_batch_parameters(cmd, namespace): # 3. collect the files to be uploaded namespace.source = os.path.realpath(namespace.source) - namespace.source_files = [c for c in glob_files_locally(namespace.source, namespace.pattern)] + namespace.source_files = list(glob_files_locally(namespace.source, namespace.pattern)) # 4. determine blob type if namespace.blob_type is None: diff --git a/src/azure-cli/azure/cli/command_modules/storage/_validators_azure_stack.py b/src/azure-cli/azure/cli/command_modules/storage/_validators_azure_stack.py index 3ad3f6833db..0b97945cf99 100644 --- a/src/azure-cli/azure/cli/command_modules/storage/_validators_azure_stack.py +++ b/src/azure-cli/azure/cli/command_modules/storage/_validators_azure_stack.py @@ -811,7 +811,7 @@ def process_blob_upload_batch_parameters(cmd, namespace): # 3. collect the files to be uploaded namespace.source = os.path.realpath(namespace.source) - namespace.source_files = [c for c in glob_files_locally(namespace.source, namespace.pattern)] + namespace.source_files = list(glob_files_locally(namespace.source, namespace.pattern)) # 4. determine blob type if namespace.blob_type is None: diff --git a/src/azure-cli/azure/cli/command_modules/storage/operations/file.py b/src/azure-cli/azure/cli/command_modules/storage/operations/file.py index 1ebd8273aeb..71298b5fb88 100644 --- a/src/azure-cli/azure/cli/command_modules/storage/operations/file.py +++ b/src/azure-cli/azure/cli/command_modules/storage/operations/file.py @@ -136,7 +136,7 @@ def storage_file_upload_batch(cmd, client, destination, source, destination_path from azure.cli.command_modules.storage.util import glob_files_locally, normalize_blob_file_path - source_files = [c for c in glob_files_locally(source, pattern)] + source_files = list(glob_files_locally(source, pattern)) logger = get_logger(__name__) settings_class = cmd.get_models('file.models#ContentSettings') diff --git a/src/azure-cli/azure/cli/command_modules/storage/operations/file_azure_stack.py b/src/azure-cli/azure/cli/command_modules/storage/operations/file_azure_stack.py index 12c004f5daa..b4bf86d1a43 100644 --- a/src/azure-cli/azure/cli/command_modules/storage/operations/file_azure_stack.py +++ b/src/azure-cli/azure/cli/command_modules/storage/operations/file_azure_stack.py @@ -87,7 +87,7 @@ def storage_file_upload_batch(cmd, client, destination, source, destination_path from azure.cli.command_modules.storage.util import glob_files_locally, normalize_blob_file_path - source_files = [c for c in glob_files_locally(source, pattern)] + source_files = list(glob_files_locally(source, pattern)) logger = get_logger(__name__) settings_class = cmd.get_models('file.models#ContentSettings') diff --git a/src/azure-cli/azure/cli/command_modules/vm/custom.py b/src/azure-cli/azure/cli/command_modules/vm/custom.py index 86ea0b4f6ac..e3876ee9649 100644 --- a/src/azure-cli/azure/cli/command_modules/vm/custom.py +++ b/src/azure-cli/azure/cli/command_modules/vm/custom.py @@ -3428,7 +3428,7 @@ def create_image_version(cmd, resource_group_name, gallery_name, gallery_image_n if data_snapshot_luns and len(data_snapshots) != len(data_snapshot_luns): raise CLIError('usage error: Length of --data-snapshots and --data-snapshot-luns should be equal.') if not data_snapshot_luns: - data_snapshot_luns = [i for i in range(len(data_snapshots))] + data_snapshot_luns = list(range(len(data_snapshots))) data_disk_images = [] for i, s in enumerate(data_snapshots): data_disk_images.append(GalleryDataDiskImage(source=GalleryArtifactVersionSource(id=s), @@ -3456,7 +3456,7 @@ def create_image_version(cmd, resource_group_name, gallery_name, gallery_image_n # Generate LUNs if data_vhds_luns is None: # 0, 1, 2, ... - data_vhds_luns = [i for i in range(len(data_vhds_uris))] + data_vhds_luns = list(range(len(data_vhds_uris))) # Check length len_data_vhds_uris = len(data_vhds_uris) len_data_vhds_luns = len(data_vhds_luns)