mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-05 04:36:52 +00:00
utils: Change normalize_paths() contract
The `normalize_paths()` utility was doing too much — parsing unstructured configuration path data and dispatching the scrubbed paths to be normalized. Towards moving the parsing of unstructured configuration path data closer towards were configuration occurs, have the utility accept only structured input for normalizing paths.
This commit is contained in:
parent
a0cd55fd6d
commit
1ba56b9056
3 changed files with 9 additions and 12 deletions
|
|
@ -160,8 +160,8 @@ def parse_files_to_codes_mapping(value_): # noqa: C901
|
|||
|
||||
|
||||
def normalize_paths(paths, parent=os.curdir):
|
||||
# type: (Union[Sequence[str], str], str) -> List[str]
|
||||
"""Parse a comma-separated list of paths.
|
||||
# type: (Sequence[str], str) -> List[str]
|
||||
"""Normalize a list of paths relative to a parent directory.
|
||||
|
||||
:returns:
|
||||
The normalized paths.
|
||||
|
|
@ -169,9 +169,7 @@ def normalize_paths(paths, parent=os.curdir):
|
|||
[str]
|
||||
"""
|
||||
assert isinstance(paths, list), paths # nosec (for bandit)
|
||||
return [
|
||||
normalize_path(p, parent) for p in parse_comma_separated_list(paths)
|
||||
]
|
||||
return [normalize_path(p, parent) for p in paths]
|
||||
|
||||
|
||||
def normalize_path(path, parent=os.curdir):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue