leaf_focus/pdf/info/item.py
def load_json(cls, path: Path) -> "Item":
        """Read an info item from a file."""
        if not path:
            raise ValueError("Must provide path.")
        if path.suffix.lower() != ".json":
            raise ValueError("Must be a json file.")

        with open(path, "rt") as f:
            item_dict = json.load(f)
            return Item(
                pdf_path=Path(item_dict["pdf_path"]),
                entries=item_dict["entries"],
            )
Read an info item from a file.
Read an info item from a file.
Read an info item from a file .
def load_json(cls, path: Path) -> "Item":
        if not path:
            raise ValueError("Must provide path.")
        if path.suffix.lower() != ".json":
            raise ValueError("Must be a json file.")
        with open(path, "rt") as f:
            item_dict = json.load(f)
            return Item(
                pdf_path=Path(item_dict["pdf_path"]),
                entries=item_dict["entries"],
            )
def load_json ( cls , path : Path ) -> "Item" : if not path : raise ValueError ( "Must provide path." ) if path . suffix . lower ( ) != ".json" : raise ValueError ( "Must be a json file." ) with open ( path , "rt" ) as f : item_dict = json . load ( f ) return Item ( pdf_path = Path ( item_dict [ "pdf_path" ] ) , entries = item_dict [ "entries" ] , )
Read an info item from a file.
Read an info item from a file .
"""Read an info item from a file."""
cls
path
Path