Datasets:
Download code/robohome/src/tools/asset_curation/curation_paths.py from RoboParty/RoboHome: direct link, hf CLI and curl.
- Browser
- Download file 1.78 kB
-
https://huggingface.co/datasets/RoboParty/RoboHome/resolve/main/code/robohome/src/tools/asset_curation/curation_paths.py
- Command line
-
hf download hf://datasets/RoboParty/RoboHome/code/robohome/src/tools/asset_curation/curation_paths.py
-
curl -L -o curation_paths.py https://huggingface.co/datasets/RoboParty/RoboHome/resolve/main/code/robohome/src/tools/asset_curation/curation_paths.py
1.78 kB
| """Locations used by the asset curation tools. | |
| Every location comes from an environment variable and there are no machine-specific defaults: an unset variable stops the script and | |
| names the variable to set (see site.example.env). `S` is the root of this repository and needs no setting. | |
| """ | |
| import os | |
| import sys | |
| from pathlib import Path | |
| S = str(Path(__file__).resolve().parents[2]) # tools/asset_curation/curation_paths.py -> repository root | |
| VARIABLES = { | |
| 'R': ('RHG_WORK_ROOT', 'working root that holds the retrieval, audit and release directories'), | |
| 'W': ('RHG_CURATION_WORK', 'working directory of the curation run (releases, decisions, e2e runs)'), | |
| 'A': ('RHG_ASSET_AUDIT', 'output directory of the asset audit'), | |
| 'AUDIT_SCRIPTS': ('RHG_ASSET_AUDIT_SCRIPTS', 'helper scripts of the asset audit'), | |
| 'L': ('RHG_RETRIEVAL_DIR', 'directory with the retrieval sqlite files'), | |
| 'B': ('RHG_HSSD_ROOT', 'root of the HSSD asset library (contains semantics/ and scenes/)'), | |
| 'PARENT_RELEASE': ('RHG_PARENT_RELEASE', 'attribute_releases.json that publish_art.py replaces'), | |
| } | |
| def __getattr__(name): | |
| """Resolve a location when it is first used, so a script only needs the variables it really reads.""" | |
| if name in VARIABLES: | |
| variable, meaning = VARIABLES[name] | |
| value = os.environ.get(variable) | |
| if not value: | |
| raise SystemExit('%s is not set: %s. Set it (see tools/asset_curation/site.example.env).' % (variable, meaning)) | |
| return value | |
| raise AttributeError(name) | |
| def add_usd_site(): | |
| """Put the directory with the `pxr` (usd-core) package on sys.path when RHG_USD_SITE names one.""" | |
| site = os.environ.get('RHG_USD_SITE') | |
| if site and site not in sys.path: | |
| sys.path.insert(0, site) | |