Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

{Pylint} Fix implicit-str-concat #30363

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ disable=
# These rules were added in Pylint >= 2.12, disable them to avoid making retroactive change
missing-timeout,
superfluous-parens,
implicit-str-concat,
unnecessary-dunder-call,
# These rules were added in Pylint >= 3.2
possibly-used-before-assignment,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ def ensure_cluster_identity_permission_on_kubelet_identity(cmd, cluster_identity
if use_shared_identity():
return
raise UnauthorizedError(
"Could not grant Managed Identity Operator " "permission to cluster identity at scope {}".format(scope)
"Could not grant Managed Identity Operator permission to cluster identity at scope {}".format(scope)
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ def load_arguments(self, _):
c.argument('dapr_enable_api_logging', options_list=['--dapr-enable-api-logging', '--dal'], help="Enable/Disable API logging for the Dapr sidecar.", arg_type=get_three_state_flag(return_label=True))
c.argument('workload_profile_name', help="The name of the workload profile to run the app on.", is_preview=True)
c.argument('cpu', type=float, help="Required CPU in cores from 0.5 to 2.0.", is_preview=True)
c.argument('memory', help="Required momory from 1.0 to 4.0 ending with ""Gi"" e.g. 1.0Gi, ", is_preview=True)
c.argument('memory', help="Required momory from 1.0 to 4.0 ending with Gi e.g. 1.0Gi, ", is_preview=True)

with self.argument_context('functionapp runtime config') as c:
c.argument('runtime_version', help='The version of the functions runtime stack. Use "az functionapp list-flexconsumption-runtimes" to check supported runtimes and versions', is_preview=True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def load_arguments(self, _):
"invoice_name",
options_list=["--name", "-n", "--invoice-name"],
type=str,
help="The ID that " "uniquely identifies an invoice.",
help="The ID that uniquely identifies an invoice.",
)
c.argument(
"by_subscription",
Expand Down Expand Up @@ -129,7 +129,7 @@ def load_arguments(self, _):
"name",
options_list=["--name", "-n"],
type=str,
help="The ID that uniquely identifies a role " "assignment.",
help="The ID that uniquely identifies a role assignment.",
)
c.argument(
"profile_name",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ def create_action(action_name, cache_behavior=None, cache_duration=None, header_
action = {
"cache_key_query_string": {
"parameters": {
"type_name" "DeliveryRuleCacheKeyQueryStringBehaviorActionParameters"
"type_nameDeliveryRuleCacheKeyQueryStringBehaviorActionParameters"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This original code seems to be wrong.

Suggested change
"type_nameDeliveryRuleCacheKeyQueryStringBehaviorActionParameters"
"type_name": "DeliveryRuleCacheKeyQueryStringBehaviorActionParameters"

Copy link
Contributor Author

@bebound bebound Nov 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also missing , at the end of file.

Previously, type_nameDeliveryRuleCacheKeyQueryStringBehaviorActionParametersquery_string_behavior was the first key of paramieters

"query_string_behavior": query_string_behavior,
"query_parameters": query_parameters
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@ def load_arguments(self, _):
'namespace',
completer=get_providers_completion_list,
arg_group='Resource ID',
help='Provider namespace (Ex: ''Microsoft.Provider'').')
help='Provider namespace (Ex: Microsoft.Provider).')
c.argument(
'resource_type_parent',
options_list=['--parent'],
arg_group='Resource ID',
help='The parent path (Ex: ''resourceTypeA/nameA/resourceTypeB/nameB'').')
help='The parent path (Ex: resourceTypeA/nameA/resourceTypeB/nameB).')
c.argument(
'resource_type',
completer=get_resource_types_completion_list,
arg_group='Resource ID',
help='Resource type (Ex: ''resourceTypeC'').')
help='Resource type (Ex: resourceTypeC).')

for scope in ['state', 'event']:
with self.argument_context('policy {}'.format(scope)) as c:
Expand Down Expand Up @@ -137,7 +137,7 @@ def load_arguments(self, _):
'location_filters',
options_list='--location-filters',
nargs='+',
help='Space separated list of resource locations that should be remediated (Ex: ''centralus westeurope'').') # pylint: disable=line-too-long
help='Space separated list of resource locations that should be remediated (Ex: centralus westeurope).') # pylint: disable=line-too-long
c.argument(
'policy_assignment',
options_list=['--policy-assignment', '-a'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def test_relay_hyco(self, resource_group):
'loc': 'westus2',
'rg': resource_group,
'namespacename': self.create_random_name(prefix='relay-nscli', length=20),
'tags': 'tag1=value1' 'tag2=value2',
'tags': 'tag1=value1tag2=value2',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'tags': 'tag1=value1tag2=value2',
'tags': 'tag1=value1 tag2=value2',

'authoname': self.create_random_name(prefix='cliAutho', length=20),
'defaultauthorizationrule': 'RootManageSharedAccessKey',
'accessrights': 'Listen',
Expand Down Expand Up @@ -185,7 +185,7 @@ def test_relay_wcfrelay(self, resource_group):
'rg': resource_group,
'relaytype': 'Http',
'namespacename': self.create_random_name(prefix='relay-nscli', length=20),
'tags': 'tag1=value1' 'tag2=value2',
'tags': 'tag1=value1tag2=value2',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'tags': 'tag1=value1tag2=value2',
'tags': 'tag1=value1 tag2=value2',

'authoname': self.create_random_name(prefix='cliAutho', length=20),
'defaultauthorizationrule': 'RootManageSharedAccessKey',
'accessrights': 'Send',
Expand Down
8 changes: 4 additions & 4 deletions src/azure-cli/azure/cli/command_modules/search/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def pre_operations(self):

if args.hosting_mode == "highDensity" and args.sku != "standard3":
raise UnrecognizedArgumentError(
"SearchService.HostingMode: ""highDensity"" is only allowed when sku is ""standard3""")
"SearchService.HostingMode: highDensity is only allowed when sku is standard3")

if has_value(args.ip_rules):
ip_rules = re.split(';|,', args.ip_rules.to_serialized_data())
Expand Down Expand Up @@ -173,7 +173,7 @@ def update_search_service(instance, partition_count=0, replica_count=0, public_n
if public_network_access:
if (public_network_access.lower() not in ["enabled", "disabled"]):
raise UnrecognizedArgumentError(
"SearchService.PublicNetworkAccess: only [""enabled"", ""disabled""] are allowed")
"SearchService.PublicNetworkAccess: only [enabled, disabled] are allowed")
instance.public_network_access = public_network_access
if ip_rules:
_ip_rules = []
Expand Down Expand Up @@ -318,12 +318,12 @@ def setup_search_auth(instance, disable_local_auth, auth_options, aad_auth_failu
# Done by argument define
if (auth_options is not None and auth_options not in ["aadOrApiKey", "apiKeyOnly"]):
raise UnrecognizedArgumentError(
"SearchService.AuthOptions: only [""aadOrApiKey"", ""apiKeyOnly""] are allowed")
"SearchService.AuthOptions: only [aadOrApiKey, apiKeyOnly] are allowed")
# Done in aaz by default
if (aad_auth_failure_mode is not None and aad_auth_failure_mode not in ["http401WithBearerChallenge", "http403"]):
raise UnrecognizedArgumentError(
"SearchService.AuthOptions.AadAuthFailureMode: only "
"[""http401WithBearerChallenge"", ""http403""] are allowed")
"[http401WithBearerChallenge, http403] are allowed")

# Done in pre_operations
if disable_local_auth and auth_options:
Expand Down
4 changes: 2 additions & 2 deletions src/azure-cli/azure/cli/command_modules/sql/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ def _find_edition_capability(sku, supported_editions):
return next(e for e in supported_editions if e.name == sku.tier)
except StopIteration:
candidate_editions = [e.name for e in supported_editions]
raise CLIError('Could not find tier ''{}''. Supported tiers are: {}'.format(
raise CLIError('Could not find tier {}. Supported tiers are: {}'.format(
sku.tier, candidate_editions
))
else:
Expand All @@ -304,7 +304,7 @@ def _find_family_capability(sku, supported_families):
return next(f for f in supported_families if f.name == sku.family)
except StopIteration:
candidate_families = [e.name for e in supported_families]
raise CLIError('Could not find family ''{}''. Supported families are: {}'.format(
raise CLIError('Could not find family {}. Supported families are: {}'.format(
sku.family, candidate_families
))
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ def get_custom_sdk(custom_module, client_factory, resource_type=ResourceType.DAT
g.storage_custom_command_oauth('generate-sas', 'generate_sas_blob_uri')

blob_service_sdk = CliCommandType(
operations_tmpl='azure.multiapi.storagev2.blob._blob_service_client#' 'BlobServiceClient.{}',
operations_tmpl='azure.multiapi.storagev2.blob._blob_service_client#BlobServiceClient.{}',
client_factory=cf_blob_service,
resource_type=ResourceType.DATA_STORAGE_BLOB
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def load_arguments(self, _):
c.argument('sql_admin_login_password', options_list=['--sql-admin-login-password', '-p'],
help='The sql administrator login password.')
c.argument('tags', arg_type=tags_type)
c.argument('allowed_aad_tenant_ids', options_list=['--allowed-tenant-ids'], nargs='+', help="The approved Azure AD tenants which outbound data traffic allowed to. The Azure AD tenant of the current user will be included by default. Use ""(\'""\' in PowerShell) to disable all allowed tenant ids.")
c.argument('allowed_aad_tenant_ids', options_list=['--allowed-tenant-ids'], nargs='+', help="The approved Azure AD tenants which outbound data traffic allowed to. The Azure AD tenant of the current user will be included by default. Use (\'\' in PowerShell) to disable all allowed tenant ids.")
c.argument('key_name', help='The workspace customer-managed key display name. All existing keys can be found using "az synapse workspace key list" cmdlet.')
c.argument('repository_type', arg_group=repository_arg_group, arg_type=get_enum_type(['AzureDevOpsGit', 'GitHub']), validator=validate_repository_type, help='The repository configuration type.')
c.argument('host_name', arg_group=repository_arg_group, help='If using github Enterprise Server, provide sever URL. Do not use this option with GitHub Enterprise Cloud.')
Expand Down
2 changes: 1 addition & 1 deletion src/azure-cli/azure/cli/command_modules/vm/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -1136,7 +1136,7 @@ def load_arguments(self, _):
c.argument('subnet_address_prefix', help='The subnet IP address prefix to use when creating a new VNet in CIDR format.')
c.argument('nics', nargs='+', help='Names or IDs of existing NICs to attach to the VM. The first NIC will be designated as primary. If omitted, a new NIC will be created. If an existing NIC is specified, do not specify subnet, VNet, public IP or NSG.')
c.argument('private_ip_address', help='Static private IP address (e.g. 10.0.0.5).')
c.argument('public_ip_address', help='Name of the public IP address when creating one (default) or referencing an existing one. Can also reference an existing public IP by ID or specify "" for None (\'""\' in Azure CLI using PowerShell or --% operator). For Azure CLI using powershell core edition 7.3.4, specify '' or "" (--public-ip-address '' or --public-ip-address "")')
c.argument('public_ip_address', help='Name of the public IP address when creating one (default) or referencing an existing one. Can also reference an existing public IP by ID or specify "" for None (\'""\' in Azure CLI using PowerShell or --% operator). For Azure CLI using powershell core edition 7.3.4, specify or "" (--public-ip-address or --public-ip-address "")')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
c.argument('public_ip_address', help='Name of the public IP address when creating one (default) or referencing an existing one. Can also reference an existing public IP by ID or specify "" for None (\'""\' in Azure CLI using PowerShell or --% operator). For Azure CLI using powershell core edition 7.3.4, specify or "" (--public-ip-address or --public-ip-address "")')
c.argument('public_ip_address', help='Name of the public IP address when creating one (default) or referencing an existing one. Can also reference an existing public IP by ID or specify "" for None (\'""\' in Azure CLI using PowerShell or --% operator). For Azure CLI using powershell core edition 7.3.4, specify or "" (--public-ip-address or --public-ip-address "")')

Copy link
Contributor Author

@bebound bebound Nov 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ' character is missing. The help message is also not correct. In powershell, the empty string shoule be represented as '""'.

c.argument('public_ip_address_allocation', help=None, default=None, arg_type=get_enum_type(['dynamic', 'static']))
c.argument('public_ip_address_dns_name', help='Globally unique DNS name for a newly created public IP.')

Expand Down