twpasolver.basemodel module#

Custom overload of pydantic BaseModel.

pydantic model twpasolver.basemodel.BaseModel[source]#

Bases: BaseModel

Pydantic BaseModel that skips None fields when serializing and adds file I/O.

Show JSON schema
{
   "title": "BaseModel",
   "description": "Pydantic BaseModel that skips None fields when serializing and adds file I/O.",
   "type": "object",
   "properties": {}
}

model_dump(exclude_none: bool = True, mode: str = 'json', **kwargs) → dict[source]#

Serialize the model, by default in JSON mode and without None fields.

classmethod from_file(filename: str | PathLike)[source]#

Load a model instance from a JSON file.

dump_to_file(filename: str | PathLike) → None[source]#

Dump the model instance to a JSON file.