Files
chia-blockchain/chia/util/default_root.py
Matt HauffandGitHub 40db4635a8 [LABS-245] Enable PEP604 Ruff rules (#20269)
* Enable PEP604 Ruff rules

* Fix harcoded signature in test

* Hack CLVMStreamable test with note to fast follow
2025-11-18 12:34:00 -08:00

27 lines
779 B
Python

# Package: utils
from __future__ import annotations
import os
from pathlib import Path
DEFAULT_ROOT_PATH = Path(os.path.expanduser(os.getenv("CHIA_ROOT", "~/.chia/mainnet"))).resolve()
DEFAULT_KEYS_ROOT_PATH = Path(os.path.expanduser(os.getenv("CHIA_KEYS_ROOT", "~/.chia_keys"))).resolve()
SIMULATOR_ROOT_PATH = Path(os.path.expanduser(os.getenv("CHIA_SIMULATOR_ROOT", "~/.chia/simulator"))).resolve()
def resolve_root_path(*, override: Path | None) -> Path:
candidates = [
override,
os.environ.get("CHIA_ROOT"),
"~/.chia/mainnet",
]
for candidate in candidates:
if candidate is not None:
return Path(candidate).expanduser().resolve()
raise RuntimeError("unreachable: last candidate is hardcoded to be found")