ProtoModel
- pydantic model qcelemental.models.v2.ProtoModel[source]
QCSchema extension of pydantic.BaseModel.
Show JSON schema
{ "title": "ProtoModel", "description": "QCSchema extension of pydantic.BaseModel.", "type": "object", "properties": {}, "additionalProperties": false }
- compare(other, **kwargs)[source]
Compares the current object to the provided object recursively.
- Parameters:
other (ProtoModel | BaseModel) – The model to compare to.
**kwargs – Additional kwargs to pass to
compare_recursive().
- Returns:
True if the objects match.
- Return type:
- model_dump(**kwargs)[source]
- !!! abstract “Usage Documentation”
[model_dump](../concepts/serialization.md#python-mode)
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- Parameters:
mode – The mode in which to_python should run. If mode is ‘json’, the output will only contain JSON serializable types. If mode is ‘python’, the output may contain non-JSON-serializable Python objects.
include – A set of fields to include in the output.
exclude – A set of fields to exclude from the output.
context – Additional context to pass to the serializer.
by_alias – Whether to use the field’s alias in the dictionary key if defined.
exclude_unset – Whether to exclude fields that have not been explicitly set.
exclude_defaults – Whether to exclude fields that are set to their default value.
exclude_none – Whether to exclude fields that have a value of None.
exclude_computed_fields – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicated round_trip parameter instead.
round_trip – If True, dumped values should be valid as input for non-idempotent types such as Json[T].
warnings – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].
fallback – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.
serialize_as_any – Whether to serialize fields with duck-typing serialization behavior.
- Returns:
A dictionary representation of the model.
- Return type:
- model_dump_json(**kwargs)[source]
- !!! abstract “Usage Documentation”
[model_dump_json](../concepts/serialization.md#json-mode)
Generates a JSON representation of the model using Pydantic’s to_json method.
- Parameters:
indent – Indentation to use in the JSON output. If None is passed, the output will be compact.
ensure_ascii – If True, the output is guaranteed to have all incoming non-ASCII characters escaped. If False (the default), these characters will be output as-is.
include – Field(s) to include in the JSON output.
exclude – Field(s) to exclude from the JSON output.
context – Additional context to pass to the serializer.
by_alias – Whether to serialize using field aliases.
exclude_unset – Whether to exclude fields that have not been explicitly set.
exclude_defaults – Whether to exclude fields that are set to their default value.
exclude_none – Whether to exclude fields that have a value of None.
exclude_computed_fields – Whether to exclude computed fields. While this can be useful for round-tripping, it is usually recommended to use the dedicated round_trip parameter instead.
round_trip – If True, dumped values should be valid as input for non-idempotent types such as Json[T].
warnings – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].
fallback – A function to call when an unknown value is encountered. If not provided, a [PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised.
serialize_as_any – Whether to serialize fields with duck-typing serialization behavior.
- Returns:
A JSON string representation of the model.
- classmethod parse_file(path, *, encoding=None)[source]
Parses a file into a Model object.
This overwrites the deprecated parse_file of v2 Pydantic to eventually call parse_model or parse_model_json, but is kept to preserve our own API
May also be deprecated from QCElemental in time
- Parameters:
- Returns:
The requested model from a serialized format.
- Return type:
- classmethod parse_raw(data, *, encoding=None)[source]
Parses raw string or bytes into a Model object.
This overwrites the deprecated parse_file of v2 Pydantic to eventually call parse_model or parse_model_json, but is kept to preserve our own API
May also be deprecated from QCElemental in time
- serialize(encoding, *, include=None, exclude=None, exclude_unset=None, exclude_defaults=None, exclude_none=None)[source]
Generates a serialized representation of the model
- Parameters:
encoding (str) – The serialization type, available types are: {‘json’, ‘json-ext’, ‘msgpack-ext’}
include (Set[str] | None) – Fields to be included in the serialization.
exclude (Set[str] | None) – Fields to be excluded in the serialization.
exclude_unset (bool | None) – If True, skips fields that have default values provided.
exclude_defaults (bool | None) – If True, skips fields that have set or defaulted values equal to the default.
exclude_none (bool | None) – If True, skips fields that have value
None.
- Returns:
The serialized model.
- Return type: