Skip to content

Commit ceba141

Browse files
authored
{Pylint} Fix use-maxsplit-arg (#30344)
1 parent e8aa309 commit ceba141

File tree

9 files changed

+10
-11
lines changed

9 files changed

+10
-11
lines changed

pylintrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ disable=
3838
wrong-import-order,
3939
consider-using-f-string,
4040
unspecified-encoding,
41-
use-maxsplit-arg,
4241
consider-using-in,
4342
consider-using-enumerate,
4443
# These rules were added in Pylint >= 2.12, disable them to avoid making retroactive change

src/azure-cli-core/azure/cli/core/parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ def _check_value(self, action, value):
305305
if candidates:
306306
# use the most likely candidate to replace the misspelled command
307307
args_inferred = [item if item != value else candidates[0] for item in args]
308-
command_name_inferred = ' '.join(args_inferred).split('-')[0]
308+
command_name_inferred = ' '.join(args_inferred).split('-', maxsplit=1)[0]
309309
else:
310310
# `command_source` indicates command values have been parsed, value is an argument
311311
parameter = action.option_strings[0] if action.option_strings else action.dest

src/azure-cli/azure/cli/command_modules/acr/_format.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ def _token_format_group(item):
399399
scope_map_id = _get_value(item, 'scopeMapId')
400400
output = OrderedDict([
401401
('NAME', _get_value(item, 'name')),
402-
('SCOPE MAP', scope_map_id.split('/')[-1]),
402+
('SCOPE MAP', scope_map_id.rsplit('/', maxsplit=1)[-1]),
403403
('PASSWORD1 EXPIRY', ''),
404404
('PASSWORD2 EXPIRY', ''),
405405
('STATUS', _get_value(item, 'status').title()),

src/azure-cli/azure/cli/command_modules/acs/custom.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ def _aks_browse(
217217
raise ResourceNotFoundError('Could not find dashboard pod: {} Command output: {}'.format(err, err.output))
218218
if dashboard_pod:
219219
# remove any "pods/" or "pod/" prefix from the name
220-
dashboard_pod = str(dashboard_pod).split('/')[-1].strip()
220+
dashboard_pod = str(dashboard_pod).rsplit('/', maxsplit=1)[-1].strip()
221221
else:
222222
raise ResourceNotFoundError("Couldn't find the Kubernetes dashboard pod.")
223223

src/azure-cli/azure/cli/command_modules/appservice/custom.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5409,7 +5409,7 @@ def _get_content_share_name(app_name):
54095409
# content share name should be up to 63 characters long, lowercase letter and digits, and random
54105410
# so take the first 50 characters of the app name and add the last 12 digits of a random uuid
54115411
share_name = app_name[0:50]
5412-
suffix = str(uuid.uuid4()).split('-')[-1]
5412+
suffix = str(uuid.uuid4()).rsplit('-', maxsplit=1)[-1]
54135413
return share_name.lower() + suffix
54145414

54155415

src/azure-cli/azure/cli/command_modules/vm/azure_stack/custom.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1931,7 +1931,7 @@ def set_diagnostics_extension(
19311931
vm_extension_name = _LINUX_DIAG_EXT if is_linux_os else _WINDOWS_DIAG_EXT
19321932
if is_linux_os: # check incompatible version
19331933
exts = vm.instance_view.extensions or []
1934-
major_ver = extension_mappings[_LINUX_DIAG_EXT]['version'].split('.')[0]
1934+
major_ver = extension_mappings[_LINUX_DIAG_EXT]['version'].split('.', maxsplit=1)[0]
19351935
if next((e for e in exts if e.name == vm_extension_name and
19361936
not e.type_handler_version.startswith(major_ver + '.')), None):
19371937
logger.warning('There is an incompatible version of diagnostics extension installed. '
@@ -4251,7 +4251,7 @@ def set_vmss_diagnostics_extension(
42514251
vm_extension_name = _LINUX_DIAG_EXT if is_linux_os else _WINDOWS_DIAG_EXT
42524252
if is_linux_os and vmss.virtual_machine_profile.extension_profile: # check incompatibles
42534253
exts = vmss.virtual_machine_profile.extension_profile.extensions or []
4254-
major_ver = extension_mappings[_LINUX_DIAG_EXT]['version'].split('.')[0]
4254+
major_ver = extension_mappings[_LINUX_DIAG_EXT]['version'].split('.', maxsplit=1)[0]
42554255
# For VMSS, we don't do auto-removal like VM because there is no reliable API to wait for
42564256
# the removal done before we can install the newer one
42574257
if next((e for e in exts if e.name == _LINUX_DIAG_EXT and

src/azure-cli/azure/cli/command_modules/vm/azure_stack/disk_encryption.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def _detect_ade_status(vm):
5555
ade = _find_existing_ade(vm, ade_ext_info=ade_ext_info)
5656
if ade is None:
5757
return False, False
58-
if ade.type_handler_version.split('.')[0] == ade_ext_info['legacy_version'].split('.')[0]:
58+
if ade.type_handler_version.split('.')[0] == ade_ext_info['legacy_version'].split('.', maxsplit=1)[0]:
5959
return False, True
6060

6161
return True, False # we believe impossible to have both old & new ADE

src/azure-cli/azure/cli/command_modules/vm/custom.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1927,7 +1927,7 @@ def set_diagnostics_extension(
19271927
vm_extension_name = _LINUX_DIAG_EXT if is_linux_os else _WINDOWS_DIAG_EXT
19281928
if is_linux_os: # check incompatible version
19291929
exts = vm.instance_view.extensions or []
1930-
major_ver = extension_mappings[_LINUX_DIAG_EXT]['version'].split('.')[0]
1930+
major_ver = extension_mappings[_LINUX_DIAG_EXT]['version'].split('.', maxsplit=1)[0]
19311931
if next((e for e in exts if e.name == vm_extension_name and
19321932
not e.type_handler_version.startswith(major_ver + '.')), None):
19331933
logger.warning('There is an incompatible version of diagnostics extension installed. '
@@ -4219,7 +4219,7 @@ def set_vmss_diagnostics_extension(
42194219
vm_extension_name = _LINUX_DIAG_EXT if is_linux_os else _WINDOWS_DIAG_EXT
42204220
if is_linux_os and vmss.virtual_machine_profile.extension_profile: # check incompatibles
42214221
exts = vmss.virtual_machine_profile.extension_profile.extensions or []
4222-
major_ver = extension_mappings[_LINUX_DIAG_EXT]['version'].split('.')[0]
4222+
major_ver = extension_mappings[_LINUX_DIAG_EXT]['version'].split('.', maxsplit=1)[0]
42234223
# For VMSS, we don't do auto-removal like VM because there is no reliable API to wait for
42244224
# the removal done before we can install the newer one
42254225
if next((e for e in exts if e.name == _LINUX_DIAG_EXT and

src/azure-cli/azure/cli/command_modules/vm/disk_encryption.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def _detect_ade_status(vm):
5555
ade = _find_existing_ade(vm, ade_ext_info=ade_ext_info)
5656
if ade is None:
5757
return False, False
58-
if ade.type_handler_version.split('.')[0] == ade_ext_info['legacy_version'].split('.')[0]:
58+
if ade.type_handler_version.split('.')[0] == ade_ext_info['legacy_version'].split('.', maxsplit=1)[0]:
5959
return False, True
6060

6161
return True, False # we believe impossible to have both old & new ADE

0 commit comments

Comments
 (0)