mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-13 08:04:18 +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:
|
if option.comma_separated_list:
|
||||||
normalize = utils.normalize_paths
|
normalize = utils.normalize_paths
|
||||||
setattr(options, dest, normalize(old_value))
|
setattr(options, dest, normalize(old_value))
|
||||||
|
|
||||||
elif option.comma_separated_list:
|
elif option.comma_separated_list:
|
||||||
old_value = getattr(options, dest)
|
old_value = getattr(options, dest)
|
||||||
setattr(options, dest,
|
setattr(options, dest,
|
||||||
|
|
|
||||||
|
|
@ -29,12 +29,7 @@ def normalize_paths(paths, parent=os.curdir):
|
||||||
:rtype:
|
:rtype:
|
||||||
[str]
|
[str]
|
||||||
"""
|
"""
|
||||||
paths = []
|
return [normalize_path(p) for p in parse_comma_separated_list(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
|
|
||||||
|
|
||||||
|
|
||||||
def normalize_path(path, parent=os.curdir):
|
def normalize_path(path, parent=os.curdir):
|
||||||
|
|
@ -47,4 +42,4 @@ def normalize_path(path, parent=os.curdir):
|
||||||
"""
|
"""
|
||||||
if '/' in path:
|
if '/' in path:
|
||||||
path = os.path.abspath(os.path.join(parent, 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