MCPcopy Index your code
hub / github.com/python/mypy / remove_path_prefix

Function remove_path_prefix

mypy/errors.py:1314–1321  ·  view source on GitHub ↗

If path starts with prefix, return copy of path with the prefix removed. Otherwise, return path. If path is None, return None.

(path: str, prefix: str | None)

Source from the content-addressed store, hash-verified

1312
1313
1314def remove_path_prefix(path: str, prefix: str | None) -> str:
1315 """If path starts with prefix, return copy of path with the prefix removed.
1316 Otherwise, return path. If path is None, return None.
1317 """
1318 if prefix is not None and path.startswith(prefix):
1319 return path[len(prefix) :]
1320 else:
1321 return path
1322
1323
1324def report_internal_error(

Callers 2

simplify_pathMethod · 0.85
render_messagesMethod · 0.85

Calls 2

lenFunction · 0.85
startswithMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…