erc7730.model.base module
Base model for library, using pydantic.
- pydantic model erc7730.model.base.Model[source]View on GitHub
Bases:
BaseModel
Base model for library, using pydantic.
- classmethod load(path: Path) Self [source]View on GitHub
Load a model from a JSON file.
- Parameters:
path – file path
- Returns:
validated in-memory representation of model
- Raises:
Exception – if the file does not exist or has validation errors
- classmethod load_or_none(path: Path) Self | None [source]View on GitHub
Load a model from a JSON file.
- Parameters:
path – file path
- Returns:
validated in-memory representation of descriptor, or None if file does not exist
- Raises:
Exception – if the file has validation errors
- save(path: Path) None [source]View on GitHub
Write a model to a JSON file, creating parent directories as needed.
- to_json_string() str [source]View on GitHub
Serialize the model to a JSON string.
- Returns:
JSON representation of model, serialized as a string