MCPcopy Create free account
hub / github.com/catboost/catboost / _probe

Function _probe

library/python/runtime_py3/__res.py:39–53  ·  view source on GitHub ↗

Probe bytes and str variants for environ. This is because in python3: * _os (nt) on windows returns str, * _os (posix) on linux return bytes For more information check: * https://github.com/python/cpython/blob/main/Lib/importlib/_bootstrap_external.py#L34 * YA-1700

(environ_dict, key, default_value=None)

Source from the content-addressed store, hash-verified

37executable = sys.executable or 'Y_PYTHON'
38
39def _probe(environ_dict, key, default_value=None):
40 """ Probe bytes and str variants for environ.
41 This is because in python3:
42 * _os (nt) on windows returns str,
43 * _os (posix) on linux return bytes
44 For more information check:
45 * https://github.com/python/cpython/blob/main/Lib/importlib/_bootstrap_external.py#L34
46 * YA-1700
47 """
48 keys = [_b(key), _s(key)]
49 for key in keys:
50 if key in environ_dict:
51 return _b(environ_dict[key])
52
53 return _b(default_value) if isinstance(default_value, str) else default_value
54
55# This is the prefix in contrib/tools/python3/Lib/ya.make.
56py_prefix = b'py/'

Callers 3

__res.pyFile · 0.85
_get_source_rootFunction · 0.85
_guess_pycache_prefixFunction · 0.85

Calls 1

isinstanceFunction · 0.85

Tested by

no test coverage detected