ZipLime's picture
Update the security master
72eadef verified
Raw
History Blame Contribute Delete
1.11 kB
"""Runtime configuration."""
from __future__ import annotations
import os
from dataclasses import dataclass
from pathlib import Path
DEFAULT_HF_REPO = "ZipLime/corporate-actions"
# Everything here is derived from one sibling dataset. No new source is
# fetched: the dividends were already parsed out of XBRL, and the splits are
# recovered from the restatement history that dataset keeps precisely because
# it never overwrites what a filing said.
SOURCE_REPO = "ZipLime/company-fundamentals"
SIBLING_DIR = "Company_fundamentals"
@dataclass(frozen=True, slots=True)
class Settings:
data_dir: Path = Path("data")
hf_repo: str = DEFAULT_HF_REPO
siblings_dir: Path | None = None
@classmethod
def from_env(cls, **overrides) -> Settings:
siblings = os.environ.get("CORPORATE_ACTIONS_SIBLINGS")
return cls(
data_dir=Path(overrides.get("data_dir") or os.environ.get("DATA_DIR", "data")),
hf_repo=overrides.get("hf_repo") or os.environ.get("HF_DATASET_REPO", DEFAULT_HF_REPO),
siblings_dir=Path(siblings) if siblings else None,
)