chore(keyringctl): avoid shadowing convert function

This commit is contained in:
Levente Polyak 2021-10-19 18:23:08 +02:00
parent 77b1eab89e
commit 0bd10b9b4f
No known key found for this signature in database
GPG Key ID: FC1B547C8D8172C8

View File

@ -70,7 +70,7 @@ def natural_sort_path(_list: Iterable[Path]) -> Iterable[Path]:
An Iterable of paths that are naturally sorted An Iterable of paths that are naturally sorted
""" """
def convert(text: str) -> Union[int, str]: def convert_text_chunk(text: str) -> Union[int, str]:
"""Convert input text to int or str """Convert input text to int or str
Parameters Parameters
@ -100,7 +100,7 @@ def natural_sort_path(_list: Iterable[Path]) -> Iterable[Path]:
A list of either int or str objects that may serve as 'key' argument for sorted() A list of either int or str objects that may serve as 'key' argument for sorted()
""" """
return [convert(c) for c in split("([0-9]+)", str(key.name))] return [convert_text_chunk(c) for c in split("([0-9]+)", str(key.name))]
return sorted(_list, key=alphanum_key) return sorted(_list, key=alphanum_key)