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

Function try_get_arcadia_root

library/python/find_root/__init__.py:23–42  ·  view source on GitHub ↗

Extended Arcadia root lookup: use various env vars :param start_path: initial path for lookup Obtain Arcadia root or **empty string** when arcadia root cannot be found.

(start_path=os.path.abspath(__file__))

Source from the content-addressed store, hash-verified

21
22
23def try_get_arcadia_root(start_path=os.path.abspath(__file__)):
24 """
25 Extended Arcadia root lookup: use various env vars
26 :param start_path: initial path for lookup
27 Obtain Arcadia root or **empty string** when arcadia root cannot be found.
28 """
29 env_root = os.getenv("ARCADIA_ROOT")
30 if env_root:
31 return env_root
32
33 path = start_path
34 while path != "/" and not os.path.exists(os.path.join(path, ".arcadia.root")):
35 path = os.path.dirname(path)
36
37 # if after all, we reached root, try to check up from ya path
38 # env variable "_" contains path to ya
39 if path == "/" and start_path == os.path.abspath(__file__):
40 path = try_get_arcadia_root(os.path.dirname(os.getenv("_")))
41
42 return path if path != "/" else ""
43
44
45def get_arcadia_root(start_path=os.path.abspath(__file__)):

Callers 1

get_arcadia_rootFunction · 0.85

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected