mirror of
https://github.com/PyCQA/flake8.git
synced 2026-03-30 18:56:53 +00:00
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:
parent
ba2d94888c
commit
250005b100
1 changed files with 5 additions and 2 deletions
|
|
@ -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():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue