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:
Eric N. Vander Weele 2019-07-28 10:39:27 -04:00
parent a0cd55fd6d
commit 1ba56b9056
3 changed files with 9 additions and 12 deletions

View file

@ -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):