mirror of
https://github.com/PyCQA/flake8.git
synced 2026-03-30 02:46:52 +00:00
Simplify normalize_paths
This commit is contained in:
parent
ec26d46dff
commit
237a35fe88
2 changed files with 2 additions and 8 deletions
|
|
@ -167,7 +167,6 @@ def _normalize_option(options, option):
|
|||
if option.comma_separated_list:
|
||||
normalize = utils.normalize_paths
|
||||
setattr(options, dest, normalize(old_value))
|
||||
|
||||
elif option.comma_separated_list:
|
||||
old_value = getattr(options, dest)
|
||||
setattr(options, dest,
|
||||
|
|
|
|||
|
|
@ -29,12 +29,7 @@ def normalize_paths(paths, parent=os.curdir):
|
|||
:rtype:
|
||||
[str]
|
||||
"""
|
||||
paths = []
|
||||
for path in parse_comma_separated_list(paths):
|
||||
if '/' in path:
|
||||
path = os.path.abspath(os.path.join(parent, path))
|
||||
paths.append(path.rstrip('/'))
|
||||
return paths
|
||||
return [normalize_path(p) for p in parse_comma_separated_list(paths)]
|
||||
|
||||
|
||||
def normalize_path(path, parent=os.curdir):
|
||||
|
|
@ -47,4 +42,4 @@ def normalize_path(path, parent=os.curdir):
|
|||
"""
|
||||
if '/' in path:
|
||||
path = os.path.abspath(os.path.join(parent, path))
|
||||
return path
|
||||
return path.rstrip('/')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue