MCPcopy Create free account
hub / github.com/dmlc/xgboost / demo_dir

Function demo_dir

python-package/xgboost/testing/__init__.py:716–726  ·  view source on GitHub ↗

Look for the demo directory based on the test file name.

(path: str)

Source from the content-addressed store, hash-verified

714
715
716def demo_dir(path: str) -> str:
717 """Look for the demo directory based on the test file name."""
718 path = normpath(os.path.dirname(path))
719 while True:
720 subdirs = [f.path for f in os.scandir(path) if f.is_dir()]
721 subdirs = [os.path.basename(d) for d in subdirs]
722 if "demo" in subdirs:
723 return os.path.join(path, "demo")
724 new_path = normpath(os.path.join(path, os.path.pardir))
725 assert new_path != path
726 path = new_path
727
728
729def normpath(path: str) -> str:

Callers 2

data_dirFunction · 0.85
project_rootFunction · 0.85

Calls 1

normpathFunction · 0.70

Tested by

no test coverage detected