Merge pull request #10550 from danschef/use_os_sep
Use os.sep instead of os.path.sep.
This commit is contained in:
commit
eca93db05b
|
@ -78,15 +78,15 @@ class FastFilesCompleter:
|
||||||
|
|
||||||
def __call__(self, prefix: str, **kwargs: Any) -> List[str]:
|
def __call__(self, prefix: str, **kwargs: Any) -> List[str]:
|
||||||
# Only called on non option completions.
|
# Only called on non option completions.
|
||||||
if os.path.sep in prefix[1:]:
|
if os.sep in prefix[1:]:
|
||||||
prefix_dir = len(os.path.dirname(prefix) + os.path.sep)
|
prefix_dir = len(os.path.dirname(prefix) + os.sep)
|
||||||
else:
|
else:
|
||||||
prefix_dir = 0
|
prefix_dir = 0
|
||||||
completion = []
|
completion = []
|
||||||
globbed = []
|
globbed = []
|
||||||
if "*" not in prefix and "?" not in prefix:
|
if "*" not in prefix and "?" not in prefix:
|
||||||
# We are on unix, otherwise no bash.
|
# We are on unix, otherwise no bash.
|
||||||
if not prefix or prefix[-1] == os.path.sep:
|
if not prefix or prefix[-1] == os.sep:
|
||||||
globbed.extend(glob(prefix + ".*"))
|
globbed.extend(glob(prefix + ".*"))
|
||||||
prefix += "*"
|
prefix += "*"
|
||||||
globbed.extend(glob(prefix))
|
globbed.extend(glob(prefix))
|
||||||
|
|
|
@ -796,7 +796,7 @@ class LocalPath:
|
||||||
kw = {"exists": 1}
|
kw = {"exists": 1}
|
||||||
return Checkers(self)._evaluate(kw)
|
return Checkers(self)._evaluate(kw)
|
||||||
|
|
||||||
_patternchars = set("*?[" + os.path.sep)
|
_patternchars = set("*?[" + os.sep)
|
||||||
|
|
||||||
def listdir(self, fil=None, sort=None):
|
def listdir(self, fil=None, sort=None):
|
||||||
"""List directory contents, possibly filter by the given fil func
|
"""List directory contents, possibly filter by the given fil func
|
||||||
|
@ -1128,7 +1128,7 @@ class LocalPath:
|
||||||
modfile = modfile[:-1]
|
modfile = modfile[:-1]
|
||||||
elif modfile.endswith("$py.class"):
|
elif modfile.endswith("$py.class"):
|
||||||
modfile = modfile[:-9] + ".py"
|
modfile = modfile[:-9] + ".py"
|
||||||
if modfile.endswith(os.path.sep + "__init__.py"):
|
if modfile.endswith(os.sep + "__init__.py"):
|
||||||
if self.basename != "__init__.py":
|
if self.basename != "__init__.py":
|
||||||
modfile = modfile[:-12]
|
modfile = modfile[:-12]
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -180,7 +180,7 @@ class AssertionRewritingHook(importlib.abc.MetaPathFinder, importlib.abc.Loader)
|
||||||
for initial_path in self.session._initialpaths:
|
for initial_path in self.session._initialpaths:
|
||||||
# Make something as c:/projects/my_project/path.py ->
|
# Make something as c:/projects/my_project/path.py ->
|
||||||
# ['c:', 'projects', 'my_project', 'path.py']
|
# ['c:', 'projects', 'my_project', 'path.py']
|
||||||
parts = str(initial_path).split(os.path.sep)
|
parts = str(initial_path).split(os.sep)
|
||||||
# add 'path' to basenames to be checked.
|
# add 'path' to basenames to be checked.
|
||||||
self._basenames_to_check_rewrite.add(os.path.splitext(parts[-1])[0])
|
self._basenames_to_check_rewrite.add(os.path.splitext(parts[-1])[0])
|
||||||
|
|
||||||
|
|
|
@ -557,8 +557,8 @@ def import_path(
|
||||||
|
|
||||||
if module_file.endswith((".pyc", ".pyo")):
|
if module_file.endswith((".pyc", ".pyo")):
|
||||||
module_file = module_file[:-1]
|
module_file = module_file[:-1]
|
||||||
if module_file.endswith(os.path.sep + "__init__.py"):
|
if module_file.endswith(os.sep + "__init__.py"):
|
||||||
module_file = module_file[: -(len(os.path.sep + "__init__.py"))]
|
module_file = module_file[: -(len(os.sep + "__init__.py"))]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
is_same = _is_same(str(path), module_file)
|
is_same = _is_same(str(path), module_file)
|
||||||
|
|
Loading…
Reference in New Issue