Use platform independent path separator

When normalizing paths in flake8.utils, we use the os.path.sep constant
to determine if the item is intended to be a path. If Windows users then
have a path like

    foo\bar

Specified, they will get the same behaviour as a *nix user with

    foo/bar
This commit is contained in:
Ian Cordasco 2016-06-03 07:44:41 -05:00
parent ba2d94888c
commit 250005b100

View file

@ -48,9 +48,12 @@ def normalize_path(path, parent=os.curdir):
:rtype:
str
"""
if '/' in path:
# NOTE(sigmavirus24): Using os.path.sep allows for Windows paths to
# be specified and work appropriately.
separator = os.path.sep
if separator in path:
path = os.path.abspath(os.path.join(parent, path))
return path.rstrip('/')
return path.rstrip(separator)
def stdin_get_value():