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

Function resolve

library/python/cores/__init__.py:47–60  ·  view source on GitHub ↗
(text)

Source from the content-addressed store, hash-verified

45
46 def resolve_core_mask(core_mask):
47 def resolve(text):
48 if text == "%p":
49 return str(pid)
50 elif text == "%e":
51 # https://github.com/torvalds/linux/blob/7876320f88802b22d4e2daf7eb027dd14175a0f8/include/linux/sched.h#L847
52 # https://github.com/torvalds/linux/blob/7876320f88802b22d4e2daf7eb027dd14175a0f8/fs/coredump.c#L278
53 return os.path.basename(binary_path)[:15]
54 elif text == "%E":
55 return binary_path.replace("/", "!")
56 elif text == "%%":
57 return "%"
58 elif text.startswith("%"):
59 return "*"
60 return text
61
62 parts = filter(None, re.split(r"(%.)", core_mask))
63 return "".join([resolve(p) for p in parts])

Callers 6

resolve_core_maskFunction · 0.85
execProcessFunction · 0.85
compileBuildScriptsFunction · 0.85
runScriptFunction · 0.85
downloadFileFunction · 0.85
checkMkdirFunction · 0.85

Calls 2

strClass · 0.50
replaceMethod · 0.45

Tested by

no test coverage detected