leaf_focus/support/config.py
def load(cls, path: Path):
        """Load config from a file."""
        with open(path, "rt", encoding="utf8") as f:
            data = yaml.safe_load(f)
            directories = data["directories"]
            xpdf = data["xpdf"]
            settings = data["settings"]
            return Config(
                feed_dir=Path(directories["feed"]),
                cache_dir=Path(directories["cache"]),
                processing_dir=Path(directories["processing"]),
                report_dir=Path(directories["report"]),
                pdf_info=Path(xpdf["info"]),
                pdf_text=Path(xpdf["text"]),
                pdf_image=Path(xpdf["image"]),
                prepare_image_threshold=settings["imagethreshold"],
                allowed_domains=data["allowed_domains"],
                urls=data["urls"],
            )
Load config from a file.
Load config from a file.
Load config from a file .
def load(cls, path: Path):
        with open(path, "rt", encoding="utf8") as f:
            data = yaml.safe_load(f)
            directories = data["directories"]
            xpdf = data["xpdf"]
            settings = data["settings"]
            return Config(
                feed_dir=Path(directories["feed"]),
                cache_dir=Path(directories["cache"]),
                processing_dir=Path(directories["processing"]),
                report_dir=Path(directories["report"]),
                pdf_info=Path(xpdf["info"]),
                pdf_text=Path(xpdf["text"]),
                pdf_image=Path(xpdf["image"]),
                prepare_image_threshold=settings["imagethreshold"],
                allowed_domains=data["allowed_domains"],
                urls=data["urls"],
            )
def load ( cls , path : Path ) : with open ( path , "rt" , encoding = "utf8" ) as f : data = yaml . safe_load ( f ) directories = data [ "directories" ] xpdf = data [ "xpdf" ] settings = data [ "settings" ] return Config ( feed_dir = Path ( directories [ "feed" ] ) , cache_dir = Path ( directories [ "cache" ] ) , processing_dir = Path ( directories [ "processing" ] ) , report_dir = Path ( directories [ "report" ] ) , pdf_info = Path ( xpdf [ "info" ] ) , pdf_text = Path ( xpdf [ "text" ] ) , pdf_image = Path ( xpdf [ "image" ] ) , prepare_image_threshold = settings [ "imagethreshold" ] , allowed_domains = data [ "allowed_domains" ] , urls = data [ "urls" ] , )
Load config from a file.
Load config from a file .
"""Load config from a file."""
cls
path
Path