Skip to content

Commit

Permalink
use-maxsplit-arg
Browse files Browse the repository at this point in the history
  • Loading branch information
jiasli committed Dec 9, 2024
1 parent 025ac6c commit 64c49d5
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 8 deletions.
1 change: 0 additions & 1 deletion pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ disable=
wrong-import-order,
consider-using-f-string,
unspecified-encoding,
use-maxsplit-arg,
consider-using-in,
consider-using-dict-items,
consider-using-enumerate,
Expand Down
2 changes: 1 addition & 1 deletion src/azure-cli-core/azure/cli/core/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ def _check_value(self, action, value):
if candidates:
# use the most likely candidate to replace the misspelled command
args_inferred = [item if item != value else candidates[0] for item in args]
command_name_inferred = ' '.join(args_inferred).split('-')[0]
command_name_inferred = ' '.join(args_inferred).split('-', maxsplit=1)[0]
else:
# `command_source` indicates command values have been parsed, value is an argument
parameter = action.option_strings[0] if action.option_strings else action.dest
Expand Down
2 changes: 1 addition & 1 deletion src/azure-cli/azure/cli/command_modules/acr/_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ def _token_format_group(item):
scope_map_id = _get_value(item, 'scopeMapId')
output = OrderedDict([
('NAME', _get_value(item, 'name')),
('SCOPE MAP', scope_map_id.split('/')[-1]),
('SCOPE MAP', scope_map_id.rsplit('/', maxsplit=1)[-1]),
('PASSWORD1 EXPIRY', ''),
('PASSWORD2 EXPIRY', ''),
('STATUS', _get_value(item, 'status').title()),
Expand Down
2 changes: 1 addition & 1 deletion src/azure-cli/azure/cli/command_modules/acs/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def _aks_browse(
raise ResourceNotFoundError('Could not find dashboard pod: {} Command output: {}'.format(err, err.output))
if dashboard_pod:
# remove any "pods/" or "pod/" prefix from the name
dashboard_pod = str(dashboard_pod).split('/')[-1].strip()
dashboard_pod = str(dashboard_pod).rsplit('/', maxsplit=1)[-1].strip()
else:
raise ResourceNotFoundError("Couldn't find the Kubernetes dashboard pod.")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5409,7 +5409,7 @@ def _get_content_share_name(app_name):
# content share name should be up to 63 characters long, lowercase letter and digits, and random
# so take the first 50 characters of the app name and add the last 12 digits of a random uuid
share_name = app_name[0:50]
suffix = str(uuid.uuid4()).split('-')[-1]
suffix = str(uuid.uuid4()).rsplit('-', maxsplit=1)[-1]
return share_name.lower() + suffix


Expand Down
4 changes: 2 additions & 2 deletions src/azure-cli/azure/cli/command_modules/vm/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -1973,7 +1973,7 @@ def set_diagnostics_extension(
vm_extension_name = _LINUX_DIAG_EXT if is_linux_os else _WINDOWS_DIAG_EXT
if is_linux_os: # check incompatible version
exts = vm.instance_view.extensions or []
major_ver = extension_mappings[_LINUX_DIAG_EXT]['version'].split('.')[0]
major_ver = extension_mappings[_LINUX_DIAG_EXT]['version'].split('.', maxsplit=1)[0]
if next((e for e in exts if e.name == vm_extension_name and
not e.type_handler_version.startswith(major_ver + '.')), None):
logger.warning('There is an incompatible version of diagnostics extension installed. '
Expand Down Expand Up @@ -4265,7 +4265,7 @@ def set_vmss_diagnostics_extension(
vm_extension_name = _LINUX_DIAG_EXT if is_linux_os else _WINDOWS_DIAG_EXT
if is_linux_os and vmss.virtual_machine_profile.extension_profile: # check incompatibles
exts = vmss.virtual_machine_profile.extension_profile.extensions or []
major_ver = extension_mappings[_LINUX_DIAG_EXT]['version'].split('.')[0]
major_ver = extension_mappings[_LINUX_DIAG_EXT]['version'].split('.', maxsplit=1)[0]
# For VMSS, we don't do auto-removal like VM because there is no reliable API to wait for
# the removal done before we can install the newer one
if next((e for e in exts if e.name == _LINUX_DIAG_EXT and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def _detect_ade_status(vm):
ade = _find_existing_ade(vm, ade_ext_info=ade_ext_info)
if ade is None:
return False, False
if ade.type_handler_version.split('.')[0] == ade_ext_info['legacy_version'].split('.')[0]:
if ade.type_handler_version.split('.')[0] == ade_ext_info['legacy_version'].split('.', maxsplit=1)[0]:
return False, True

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

0 comments on commit 64c49d5

Please sign in to comment.