MCPcopy
hub / github.com/python/mypy / exists_in_version

Function exists_in_version

mypy/stubtest.py:2240–2248  ·  view source on GitHub ↗
(module: str)

Source from the content-addressed store, hash-verified

2238 version_info = sys.version_info[0:2]
2239
2240 def exists_in_version(module: str) -> bool:
2241 assert version_info is not None
2242 parts = module.split(".")
2243 for i in range(len(parts), 0, -1):
2244 current_module = ".".join(parts[:i])
2245 if current_module in stdlib_py_versions:
2246 minver, maxver = stdlib_py_versions[current_module]
2247 return version_info >= minver and (maxver is None or version_info <= maxver)
2248 return False
2249
2250 if custom_typeshed_dir:
2251 typeshed_dir = Path(custom_typeshed_dir)

Callers 1

Calls 4

rangeClass · 0.85
lenFunction · 0.85
splitMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…