MCPcopy Create free account
hub / github.com/python/mypy / strip_py

Function strip_py

mypy/find_sources.py:249–257  ·  view source on GitHub ↗

Strip a trailing .py or .pyi suffix. Return None if no such suffix is found.

(arg: str)

Source from the content-addressed store, hash-verified

247
248
249def strip_py(arg: str) -> str | None:
250 """Strip a trailing .py or .pyi suffix.
251
252 Return None if no such suffix is found.
253 """
254 for ext in PY_EXTENSIONS:
255 if arg.endswith(ext):
256 return arg[: -len(ext)]
257 return None

Callers 1

crawl_upMethod · 0.85

Calls 2

lenFunction · 0.85
endswithMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…