MCPcopy Index your code
hub / github.com/pre-commit/pre-commit / _find_by_py_launcher

Function _find_by_py_launcher

pre_commit/languages/python.py:64–75  ·  view source on GitHub ↗
(
        version: str,
)

Source from the content-addressed store, hash-verified

62
63
64def _find_by_py_launcher(
65 version: str,
66) -> str | None: # pragma: no cover (windows only)
67 if version.startswith('python'):
68 num = version.removeprefix('python')
69 cmd = ('py', f'-{num}', '-c', 'import sys; print(sys.executable)')
70 env = dict(os.environ, PYTHONIOENCODING='UTF-8')
71 try:
72 return cmd_output(*cmd, env=env)[1].strip()
73 except CalledProcessError:
74 pass
75 return None
76
77
78def _impl_exe_name() -> str:

Callers 2

get_default_versionFunction · 0.85
norm_versionFunction · 0.85

Calls 1

cmd_outputFunction · 0.90

Tested by

no test coverage detected