Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
hauntsaninja committed Oct 16, 2024
1 parent 485be41 commit a9602be
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion mypy/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,14 @@ def is_sub_path(path: str, dir: str) -> bool:
"""Given two paths, return if path is a sub-path of dir."""
if not dir.endswith(os.sep):
dir += os.sep
return path.startswith(dir)
ret = path.startswith(dir)

import pathlib

if ret != (pathlib.Path(dir) in pathlib.Path(path).parents):
raise AssertionError(f"mismatch for {path!r} and {dir!r}")

return ret


if sys.platform == "linux" or sys.platform == "darwin":
Expand Down

0 comments on commit a9602be

Please sign in to comment.