mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2026-08-29 10:06:27 -05:00
* Enable PEP604 Ruff rules * Fix harcoded signature in test * Hack CLVMStreamable test with note to fast follow
27 lines
779 B
Python
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")
|