aiida_mlip.data package¶
Submodules¶
aiida_mlip.data.config module¶
Define Model Data type in AiiDA.
- class aiida_mlip.data.config.JanusConfigfile(file: str | Path, filename: str | None = None, **kwargs: Any)[source]¶
Bases:
SinglefileDataDefine config file type in AiiDA in yaml.
- Parameters:
- filestr | Path
Absolute path to the file.
- filenamestr | None
Name to be used for the file. Default is the name of provided file.
- Attributes:
filepathstrReturn the filepath.
Methods
set_file(file, filename=None, architecture=None, **kwargs)
Set the file for the node.
read_yaml()
Reads the config file from yaml format.
store_content(store_all: bool = False, skip: list = None) -> dict:
Converts keys in dictionary to nodes and store them
as_dictionary(self) -> dict
Returns the config file as a dictionary.
- Other Parameters:
- **kwargsAny
Additional keyword arguments.
- class AttributesModel(**data: Any)¶
Bases:
AttributesModelMethods
model_post_init(context, /)This function is meant to behave like a BaseModel method to initialize private attributes.
- __abstractmethods__ = frozenset({})¶
- __annotations__ = {'_AIIDA_MINIMAL_MODEL': 'type[OrmModel] | None', '__class_vars__': 'ClassVar[set[str]]', '__private_attributes__': 'ClassVar[Dict[str, ModelPrivateAttr]]', '__pydantic_complete__': 'ClassVar[bool]', '__pydantic_computed_fields__': 'ClassVar[Dict[str, ComputedFieldInfo]]', '__pydantic_core_schema__': 'ClassVar[CoreSchema]', '__pydantic_custom_init__': 'ClassVar[bool]', '__pydantic_decorators__': 'ClassVar[_decorators.DecoratorInfos]', '__pydantic_extra__': 'Dict[str, Any] | None', '__pydantic_extra_info__': 'ClassVar[PydanticExtraInfo | None]', '__pydantic_fields__': 'ClassVar[Dict[str, FieldInfo]]', '__pydantic_fields_set__': 'set[str]', '__pydantic_generic_metadata__': 'ClassVar[_generics.PydanticGenericMetadata]', '__pydantic_parent_namespace__': 'ClassVar[Dict[str, Any] | None]', '__pydantic_post_init__': "ClassVar[None | Literal['model_post_init']]", '__pydantic_private__': 'Dict[str, Any] | None', '__pydantic_root_model__': 'ClassVar[bool]', '__pydantic_serializer__': 'ClassVar[SchemaSerializer]', '__pydantic_setattr_handlers__': 'ClassVar[Dict[str, Callable[[BaseModel, str, Any], None]]]', '__pydantic_validator__': 'ClassVar[SchemaValidator | PluggableSchemaValidator]', '__signature__': 'ClassVar[Signature]', 'filename': 'str', 'model_config': 'ClassVar[ConfigDict]', 'source': 'dict | None'}¶
- __dict__¶
- __module__ = 'aiida_mlip.data.config'¶
- __private_attributes__: ClassVar[Dict[str, ModelPrivateAttr]] = {'_AIIDA_MINIMAL_MODEL': ModelPrivateAttr()}¶
Metadata about the private attributes of the model.
- __pydantic_complete__: ClassVar[bool] = True¶
Whether model building is completed, or if there are still undefined fields.
- __pydantic_computed_fields__: ClassVar[Dict[str, ComputedFieldInfo]] = {}¶
A dictionary of computed field names and their corresponding [ComputedFieldInfo][pydantic.fields.ComputedFieldInfo] objects.
- __pydantic_core_schema__: ClassVar[CoreSchema] = {'cls': <class 'aiida_mlip.data.config.JanusConfigfile.AttributesModel'>, 'config': {'extra_fields_behavior': 'forbid', 'serialize_by_alias': True, 'title': 'JanusConfigfileAttributesModel', 'validate_by_alias': True, 'validate_by_name': True}, 'custom_init': False, 'metadata': {'pydantic_js_functions': [<bound method BaseModel.__get_pydantic_json_schema__ of <class 'aiida_mlip.data.config.JanusConfigfile.AttributesModel'>>]}, 'post_init': 'model_post_init', 'ref': 'aiida_mlip.data.config.JanusConfigfile.AttributesModel:383171200', 'root_model': False, 'schema': {'computed_fields': [], 'fields': {'filename': {'metadata': {'pydantic_js_extra': {'readOnly': True}, 'pydantic_js_updates': {'description': 'The name of the stored file'}}, 'schema': {'type': 'str'}, 'type': 'model-field'}, 'source': {'metadata': {'pydantic_js_extra': {}, 'pydantic_js_updates': {'description': 'Source of the data'}}, 'schema': {'default': None, 'schema': {'schema': {'keys_schema': {'type': 'any'}, 'type': 'dict', 'values_schema': {'type': 'any'}}, 'type': 'nullable'}, 'type': 'default'}, 'type': 'model-field'}}, 'model_name': 'AttributesModel', 'type': 'model-fields'}, 'type': 'model'}¶
The core schema of the model.
- __pydantic_decorators__: ClassVar[_decorators.DecoratorInfos] = DecoratorInfos(validators={}, field_validators={}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})¶
Metadata containing the decorators defined on the model. This replaces Model.__validators__ and Model.__root_validators__ from Pydantic V1.
- __pydantic_extra__: Dict[str, Any] | None¶
A dictionary containing extra values, if [extra][pydantic.config.ConfigDict.extra] is set to ‘allow’.
- __pydantic_extra_info__: ClassVar[PydanticExtraInfo | None] = None¶
A wrapper around the __pydantic_extra__ annotation, if explicitly annotated on a model.
This is a private attribute, not meant to be used outside Pydantic.
- __pydantic_fields__: ClassVar[Dict[str, FieldInfo]] = {'filename': FieldInfo(annotation=str, required=True, description='The name of the stored file', json_schema_extra={'readOnly': True}, metadata=[{'priority': 0}, {'read_only': True}, {'write_only': False}, {'may_be_large': False}, {'orm_to_model': <function SinglefileData.AttributesModel.<lambda>>}]), 'source': FieldInfo(annotation=Union[dict, NoneType], required=False, default=None, description='Source of the data', json_schema_extra={}, metadata=[{'priority': 0}, {'read_only': False}, {'write_only': False}, {'may_be_large': False}])}¶
A dictionary of field names and their corresponding [FieldInfo][pydantic.fields.FieldInfo] objects. This replaces Model.__fields__ from Pydantic V1.
- __pydantic_generic_metadata__: ClassVar[_generics.PydanticGenericMetadata] = {'args': (), 'origin': None, 'parameters': ()}¶
A dictionary containing metadata about generic Pydantic models.
The origin and args items map to the [__origin__][genericalias.__origin__] and [__args__][genericalias.__args__] attributes of [generic aliases][types-genericalias], and the parameter item maps to the __parameter__ attribute of generic classes.
- __pydantic_post_init__: ClassVar[None | Literal['model_post_init']] = 'model_post_init'¶
The name of the post-init method for the model, if defined.
- __pydantic_private__: Dict[str, Any] | None¶
Values of private attributes set on the model instance.
- __pydantic_serializer__: ClassVar[SchemaSerializer] = SchemaSerializer(serializer=PolymorphismTrampoline( PolymorphismTrampoline { class: Py( 0x0000000016d6ba80, ), serializer: PolymorphismTrampoline( PolymorphismTrampoline { class: Py( 0x0000000016d6ba80, ), serializer: Model( ModelSerializer { class: Py( 0x0000000016d6ba80, ), serializer: Fields( GeneralFieldsSerializer { fields: { "source": SerField { key: "source", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x0000000000a408a0, ), ), serializer: Nullable( NullableSerializer { serializer: Dict( DictSerializer { key_serializer: Any( AnySerializer, ), value_serializer: Any( AnySerializer, ), filter: SchemaFilter { include: None, exclude: None, }, name: "dict[any, any]", }, ), }, ), }, ), ), required: true, serialize_by_alias: Some( true, ), serialization_exclude_if: None, }, "filename": SerField { key: "filename", alias: None, serializer: Some( Str( StrSerializer, ), ), required: true, serialize_by_alias: Some( true, ), serialization_exclude_if: None, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 2, }, ), has_extra: false, root_model: false, name: "AttributesModel", }, ), enabled_from_config: false, }, ), enabled_from_config: false, }, ), definitions=[])¶
The pydantic-core SchemaSerializer used to dump instances of the model.
- __pydantic_setattr_handlers__: ClassVar[Dict[str, Callable[[BaseModel, str, Any], None]]] = {}¶
__setattr__ handlers. Memoizing the handlers leads to a dramatic performance improvement in __setattr__
- __pydantic_validator__: ClassVar[SchemaValidator | PluggableSchemaValidator] = SchemaValidator(title="JanusConfigfileAttributesModel", validator=Model( ModelValidator { revalidate: Never, validator: ModelFields( ModelFieldsValidator { fields: [ Field { name: "source", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "source", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x0000000000a408a0, ), ), on_error: Raise, validator: Nullable( NullableValidator { validator: Dict( DictValidator { strict: false, key_validator: Any( AnyValidator, ), value_validator: Any( AnyValidator, ), min_length: None, max_length: None, fail_fast: false, name: "dict[any,any]", }, ), name: "nullable[dict[any,any]]", }, ), validate_default: false, copy_default: false, name: "default[nullable[dict[any,any]]]", undefined: Py( 0x00007f1102f788b0, ), }, ), frozen: false, }, Field { name: "filename", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "filename", ), rest: [], }, by_alias: [], }, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), frozen: false, }, ], model_name: "AttributesModel", extra_behavior: Forbid, extras_validator: None, extras_keys_validator: None, strict: false, from_attributes: false, loc_by_alias: true, lookup: LookupTree { inner: { PathItemString( "filename", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 1, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "source", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 0, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, }, }, validate_by_alias: Some( true, ), validate_by_name: Some( true, ), }, ), class: Py( 0x0000000016d6ba80, ), generic_origin: None, post_init: Some( Py( 0x00007f1101d1c530, ), ), frozen: false, custom_init: false, root_model: false, undefined: Py( 0x00007f1102f788b0, ), name: "AttributesModel", }, ), definitions=[], cache_strings=True)¶
The pydantic-core SchemaValidator used to validate instances of the model.
- _abc_impl = <_abc._abc_data object>¶
- model_config: ClassVar[ConfigDict] = {'defer_build': True, 'extra': 'forbid', 'json_encoders': {<class 'datetime.datetime'>: <function OrmModel.<lambda>>}, 'serialize_by_alias': True, 'title': 'JanusConfigfileAttributesModel', 'validate_by_alias': True, 'validate_by_name': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class ReadModel(**data: Any)¶
Bases:
ReadModelMethods
model_post_init(context, /)This function is meant to behave like a BaseModel method to initialize private attributes.
- __abstractmethods__ = frozenset({})¶
- __annotations__ = {'_AIIDA_MINIMAL_MODEL': 'type[OrmModel] | None', '__class_vars__': 'ClassVar[set[str]]', '__private_attributes__': 'ClassVar[Dict[str, ModelPrivateAttr]]', '__pydantic_complete__': 'ClassVar[bool]', '__pydantic_computed_fields__': 'ClassVar[Dict[str, ComputedFieldInfo]]', '__pydantic_core_schema__': 'ClassVar[CoreSchema]', '__pydantic_custom_init__': 'ClassVar[bool]', '__pydantic_decorators__': 'ClassVar[_decorators.DecoratorInfos]', '__pydantic_extra__': 'Dict[str, Any] | None', '__pydantic_extra_info__': 'ClassVar[PydanticExtraInfo | None]', '__pydantic_fields__': 'ClassVar[Dict[str, FieldInfo]]', '__pydantic_fields_set__': 'set[str]', '__pydantic_generic_metadata__': 'ClassVar[_generics.PydanticGenericMetadata]', '__pydantic_parent_namespace__': 'ClassVar[Dict[str, Any] | None]', '__pydantic_post_init__': "ClassVar[None | Literal['model_post_init']]", '__pydantic_private__': 'Dict[str, Any] | None', '__pydantic_root_model__': 'ClassVar[bool]', '__pydantic_serializer__': 'ClassVar[SchemaSerializer]', '__pydantic_setattr_handlers__': 'ClassVar[Dict[str, Callable[[BaseModel, str, Any], None]]]', '__pydantic_validator__': 'ClassVar[SchemaValidator | PluggableSchemaValidator]', '__signature__': 'ClassVar[Signature]', 'attributes': <class 'aiida_mlip.data.config.JanusConfigfile.AttributesModel'>, 'computer': 'int | None', 'ctime': 'datetime.datetime', 'description': 'str', 'extras': 'dict[str, Any]', 'label': 'str', 'model_config': 'ClassVar[ConfigDict]', 'mtime': 'datetime.datetime', 'node_type': typing.Literal['data.mlip.config.JanusConfigfile.'], 'pk': 'int', 'process_type': 'str | None', 'repository_metadata': 'dict[str, Any]', 'user': 'int', 'uuid': 'UUID'}¶
- __dict__¶
- __module__ = 'aiida_mlip.data.config'¶
- __private_attributes__: ClassVar[Dict[str, ModelPrivateAttr]] = {'_AIIDA_MINIMAL_MODEL': ModelPrivateAttr()}¶
Metadata about the private attributes of the model.
- __pydantic_complete__: ClassVar[bool] = True¶
Whether model building is completed, or if there are still undefined fields.
- __pydantic_computed_fields__: ClassVar[Dict[str, ComputedFieldInfo]] = {}¶
A dictionary of computed field names and their corresponding [ComputedFieldInfo][pydantic.fields.ComputedFieldInfo] objects.
- __pydantic_core_schema__: ClassVar[CoreSchema] = {'cls': <class 'aiida_mlip.data.config.JanusConfigfile.ReadModel'>, 'config': {'extra_fields_behavior': 'forbid', 'serialize_by_alias': True, 'title': 'JanusConfigfileReadModel', 'validate_by_alias': True, 'validate_by_name': True}, 'custom_init': False, 'metadata': {'pydantic_js_functions': [<bound method BaseModel.__get_pydantic_json_schema__ of <class 'aiida_mlip.data.config.JanusConfigfile.ReadModel'>>]}, 'post_init': 'model_post_init', 'ref': 'aiida_mlip.data.config.JanusConfigfile.ReadModel:382756528', 'root_model': False, 'schema': {'computed_fields': [], 'fields': {'attributes': {'metadata': {'pydantic_js_extra': {}, 'pydantic_js_updates': {'description': 'The node attributes', 'examples': [{'attr_key': 'attr_value'}]}}, 'schema': {'cls': <class 'aiida_mlip.data.config.JanusConfigfile.AttributesModel'>, 'config': {'extra_fields_behavior': 'forbid', 'serialize_by_alias': True, 'title': 'JanusConfigfileAttributesModel', 'validate_by_alias': True, 'validate_by_name': True}, 'custom_init': False, 'metadata': {'pydantic_js_functions': [<bound method BaseModel.__get_pydantic_json_schema__ of <class 'aiida_mlip.data.config.JanusConfigfile.AttributesModel'>>]}, 'post_init': 'model_post_init', 'ref': 'aiida_mlip.data.config.JanusConfigfile.AttributesModel:383171200', 'root_model': False, 'schema': {'computed_fields': [], 'fields': {'filename': {'metadata': {'pydantic_js_extra': {'readOnly': True}, 'pydantic_js_updates': {'description': 'The name of the stored file'}}, 'schema': {'type': 'str'}, 'type': 'model-field'}, 'source': {'metadata': {'pydantic_js_extra': {}, 'pydantic_js_updates': {'description': 'Source of the data'}}, 'schema': {'default': None, 'schema': {'schema': {'keys_schema': {'type': 'any'}, 'type': 'dict', 'values_schema': {'type': 'any'}}, 'type': 'nullable'}, 'type': 'default'}, 'type': 'model-field'}}, 'model_name': 'AttributesModel', 'type': 'model-fields'}, 'type': 'model'}, 'type': 'model-field'}, 'computer': {'metadata': {'pydantic_js_extra': {'readOnly': True}, 'pydantic_js_updates': {'description': 'The PK of the computer', 'examples': [42]}}, 'schema': {'default': None, 'schema': {'schema': {'type': 'int'}, 'type': 'nullable'}, 'type': 'default'}, 'type': 'model-field'}, 'ctime': {'metadata': {'pydantic_js_extra': {'readOnly': True}, 'pydantic_js_updates': {'description': 'The creation time of the node', 'examples': ['2024-01-01T12:00:00+00:00']}}, 'schema': {'microseconds_precision': 'truncate', 'serialization': {'function': <function OrmModel.<lambda>>, 'type': 'function-plain', 'when_used': 'json'}, 'type': 'datetime'}, 'type': 'model-field'}, 'description': {'metadata': {'pydantic_js_extra': {}, 'pydantic_js_updates': {'description': 'The node description', 'examples': ['This is my node description.']}}, 'schema': {'default': '', 'schema': {'type': 'str'}, 'type': 'default'}, 'type': 'model-field'}, 'extras': {'metadata': {'pydantic_js_extra': {}, 'pydantic_js_updates': {'description': 'The node extras', 'examples': [{'extra_key': 'extra_value'}]}}, 'schema': {'default_factory': <class 'dict'>, 'default_factory_takes_data': False, 'schema': {'keys_schema': {'type': 'str'}, 'type': 'dict', 'values_schema': {'type': 'any'}}, 'type': 'default'}, 'type': 'model-field'}, 'label': {'metadata': {'pydantic_js_extra': {}, 'pydantic_js_updates': {'description': 'The node label', 'examples': ['my_node']}}, 'schema': {'default': '', 'schema': {'type': 'str'}, 'type': 'default'}, 'type': 'model-field'}, 'mtime': {'metadata': {'pydantic_js_extra': {'readOnly': True}, 'pydantic_js_updates': {'description': 'The modification time of the node', 'examples': ['2024-01-02T12:00:00+00:00']}}, 'schema': {'microseconds_precision': 'truncate', 'serialization': {'function': <function OrmModel.<lambda>>, 'type': 'function-plain', 'when_used': 'json'}, 'type': 'datetime'}, 'type': 'model-field'}, 'node_type': {'metadata': {'pydantic_js_extra': {}, 'pydantic_js_updates': {'description': 'The type of the node.'}}, 'schema': {'expected': ['data.mlip.config.JanusConfigfile.'], 'type': 'literal'}, 'type': 'model-field'}, 'pk': {'metadata': {'pydantic_js_extra': {'readOnly': True}, 'pydantic_js_updates': {'description': 'The primary key of the entity', 'examples': [42]}}, 'schema': {'type': 'int'}, 'type': 'model-field'}, 'process_type': {'metadata': {'pydantic_js_extra': {'readOnly': True}, 'pydantic_js_updates': {'description': 'The process type of the node', 'examples': ['aiida.calculations:arithmetic.add.']}}, 'schema': {'default': None, 'schema': {'schema': {'type': 'str'}, 'type': 'nullable'}, 'type': 'default'}, 'type': 'model-field'}, 'repository_metadata': {'metadata': {'pydantic_js_extra': {}, 'pydantic_js_updates': {'description': 'Virtual hierarchy of the file repository', 'examples': [{'o': {'file.txt': {'k': '<file_hash>'}}}]}}, 'schema': {'default_factory': <class 'dict'>, 'default_factory_takes_data': False, 'schema': {'keys_schema': {'type': 'str'}, 'type': 'dict', 'values_schema': {'type': 'any'}}, 'type': 'default'}, 'type': 'model-field'}, 'user': {'metadata': {'pydantic_js_extra': {'readOnly': True}, 'pydantic_js_updates': {'description': 'The PK of the user who owns the node', 'examples': [7]}}, 'schema': {'type': 'int'}, 'type': 'model-field'}, 'uuid': {'metadata': {'pydantic_js_extra': {'readOnly': True}, 'pydantic_js_updates': {'description': 'The UUID of the node', 'examples': ['123e4567-e89b-12d3-a456-426614174000']}}, 'schema': {'type': 'uuid'}, 'type': 'model-field'}}, 'model_name': 'ReadModel', 'type': 'model-fields'}, 'type': 'model'}¶
The core schema of the model.
- __pydantic_decorators__: ClassVar[_decorators.DecoratorInfos] = DecoratorInfos(validators={}, field_validators={}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})¶
Metadata containing the decorators defined on the model. This replaces Model.__validators__ and Model.__root_validators__ from Pydantic V1.
- __pydantic_extra__: Dict[str, Any] | None¶
A dictionary containing extra values, if [extra][pydantic.config.ConfigDict.extra] is set to ‘allow’.
- __pydantic_extra_info__: ClassVar[PydanticExtraInfo | None] = None¶
A wrapper around the __pydantic_extra__ annotation, if explicitly annotated on a model.
This is a private attribute, not meant to be used outside Pydantic.
- __pydantic_fields__: ClassVar[Dict[str, FieldInfo]] = {'attributes': FieldInfo(annotation=JanusConfigfile.AttributesModel, required=True, description='The node attributes', examples=[{'attr_key': 'attr_value'}], json_schema_extra={}, metadata=[{'priority': 0}, {'read_only': False}, {'write_only': False}, {'may_be_large': True}]), 'computer': FieldInfo(annotation=Union[int, NoneType], required=False, default=None, description='The PK of the computer', examples=[42], json_schema_extra={'readOnly': True}, metadata=[{'priority': 0}, {'read_only': True}, {'write_only': False}, {'may_be_large': False}, {'orm_class': <class 'aiida.orm.computers.Computer'>}, {'orm_to_model': <function Node.ReadModel.<lambda>>}]), 'ctime': FieldInfo(annotation=datetime, required=True, description='The creation time of the node', examples=['2024-01-01T12:00:00+00:00'], json_schema_extra={'readOnly': True}, metadata=[{'priority': 0}, {'read_only': True}, {'write_only': False}, {'may_be_large': False}]), 'description': FieldInfo(annotation=str, required=False, default='', description='The node description', examples=['This is my node description.'], json_schema_extra={}, metadata=[{'priority': 0}, {'read_only': False}, {'write_only': False}, {'may_be_large': False}]), 'extras': FieldInfo(annotation=dict[str, Any], required=False, default_factory=dict, description='The node extras', examples=[{'extra_key': 'extra_value'}], json_schema_extra={}, metadata=[{'priority': 0}, {'read_only': False}, {'write_only': False}, {'may_be_large': True}, {'orm_to_model': <function Node.MutableNodeFields.<lambda>>}]), 'label': FieldInfo(annotation=str, required=False, default='', description='The node label', examples=['my_node'], json_schema_extra={}, metadata=[{'priority': 0}, {'read_only': False}, {'write_only': False}, {'may_be_large': False}]), 'mtime': FieldInfo(annotation=datetime, required=True, description='The modification time of the node', examples=['2024-01-02T12:00:00+00:00'], json_schema_extra={'readOnly': True}, metadata=[{'priority': 0}, {'read_only': True}, {'write_only': False}, {'may_be_large': False}]), 'node_type': FieldInfo(annotation=Literal['data.mlip.config.JanusConfigfile.'], required=True, description='The type of the node.', json_schema_extra={}, metadata=[{'priority': 0}, {'read_only': False}, {'write_only': False}, {'may_be_large': False}]), 'pk': FieldInfo(annotation=int, required=True, description='The primary key of the entity', examples=[42], json_schema_extra={'readOnly': True}, metadata=[{'priority': 0}, {'read_only': True}, {'write_only': False}, {'may_be_large': False}]), 'process_type': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='The process type of the node', examples=['aiida.calculations:arithmetic.add.'], json_schema_extra={'readOnly': True}, metadata=[{'priority': 0}, {'read_only': True}, {'write_only': False}, {'may_be_large': False}]), 'repository_metadata': FieldInfo(annotation=dict[str, Any], required=False, default_factory=dict, description='Virtual hierarchy of the file repository', examples=[{'o': {'file.txt': {'k': '<file_hash>'}}}], json_schema_extra={}, metadata=[{'priority': 0}, {'read_only': False}, {'write_only': False}, {'may_be_large': True}, {'orm_to_model': <function Node.WritableFields.<lambda>>}]), 'user': FieldInfo(annotation=int, required=True, description='The PK of the user who owns the node', examples=[7], json_schema_extra={'readOnly': True}, metadata=[{'priority': 0}, {'read_only': True}, {'write_only': False}, {'may_be_large': False}, {'orm_class': <class 'aiida.orm.users.User'>}, {'orm_to_model': <function Node.ReadModel.<lambda>>}]), 'uuid': FieldInfo(annotation=UUID, required=True, description='The UUID of the node', examples=['123e4567-e89b-12d3-a456-426614174000'], json_schema_extra={'readOnly': True}, metadata=[{'priority': 0}, {'read_only': True}, {'write_only': False}, {'may_be_large': False}])}¶
A dictionary of field names and their corresponding [FieldInfo][pydantic.fields.FieldInfo] objects. This replaces Model.__fields__ from Pydantic V1.
- __pydantic_generic_metadata__: ClassVar[_generics.PydanticGenericMetadata] = {'args': (), 'origin': None, 'parameters': ()}¶
A dictionary containing metadata about generic Pydantic models.
The origin and args items map to the [__origin__][genericalias.__origin__] and [__args__][genericalias.__args__] attributes of [generic aliases][types-genericalias], and the parameter item maps to the __parameter__ attribute of generic classes.
- __pydantic_post_init__: ClassVar[None | Literal['model_post_init']] = 'model_post_init'¶
The name of the post-init method for the model, if defined.
- __pydantic_private__: Dict[str, Any] | None¶
Values of private attributes set on the model instance.
- __pydantic_serializer__: ClassVar[SchemaSerializer] = SchemaSerializer(serializer=PolymorphismTrampoline( PolymorphismTrampoline { class: Py( 0x0000000016d066b0, ), serializer: PolymorphismTrampoline( PolymorphismTrampoline { class: Py( 0x0000000016d066b0, ), serializer: Model( ModelSerializer { class: Py( 0x0000000016d066b0, ), serializer: Fields( GeneralFieldsSerializer { fields: { "node_type": SerField { key: "node_type", alias: None, serializer: Some( Literal( LiteralSerializer { expected_int: {}, expected_str: { "data.mlip.config.JanusConfigfile.", }, expected_py: None, name: "literal['data.mlip.config.JanusConfigfile.']", }, ), ), required: true, serialize_by_alias: Some( true, ), serialization_exclude_if: None, }, "label": SerField { key: "label", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x0000000000b3c3f0, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, serialize_by_alias: Some( true, ), serialization_exclude_if: None, }, "repository_metadata": SerField { key: "repository_metadata", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: DefaultFactory( Py( 0x0000000000a3d840, ), false, ), serializer: Dict( DictSerializer { key_serializer: Str( StrSerializer, ), value_serializer: Any( AnySerializer, ), filter: SchemaFilter { include: None, exclude: None, }, name: "dict[str, any]", }, ), }, ), ), required: true, serialize_by_alias: Some( true, ), serialization_exclude_if: None, }, "extras": SerField { key: "extras", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: DefaultFactory( Py( 0x0000000000a3d840, ), false, ), serializer: Dict( DictSerializer { key_serializer: Str( StrSerializer, ), value_serializer: Any( AnySerializer, ), filter: SchemaFilter { include: None, exclude: None, }, name: "dict[str, any]", }, ), }, ), ), required: true, serialize_by_alias: Some( true, ), serialization_exclude_if: None, }, "attributes": SerField { key: "attributes", alias: None, serializer: Some( PolymorphismTrampoline( PolymorphismTrampoline { class: Py( 0x0000000016d6ba80, ), serializer: Prebuilt( PrebuiltSerializer { schema_serializer: Py( 0x00007f10dcec0310, ), }, ), enabled_from_config: false, }, ), ), required: true, serialize_by_alias: Some( true, ), serialization_exclude_if: None, }, "process_type": SerField { key: "process_type", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x0000000000a408a0, ), ), serializer: Nullable( NullableSerializer { serializer: Str( StrSerializer, ), }, ), }, ), ), required: true, serialize_by_alias: Some( true, ), serialization_exclude_if: None, }, "computer": SerField { key: "computer", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x0000000000a408a0, ), ), serializer: Nullable( NullableSerializer { serializer: Int( IntSerializer, ), }, ), }, ), ), required: true, serialize_by_alias: Some( true, ), serialization_exclude_if: None, }, "user": SerField { key: "user", alias: None, serializer: Some( Int( IntSerializer, ), ), required: true, serialize_by_alias: Some( true, ), serialization_exclude_if: None, }, "description": SerField { key: "description", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x0000000000b3c3f0, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, serialize_by_alias: Some( true, ), serialization_exclude_if: None, }, "pk": SerField { key: "pk", alias: None, serializer: Some( Int( IntSerializer, ), ), required: true, serialize_by_alias: Some( true, ), serialization_exclude_if: None, }, "mtime": SerField { key: "mtime", alias: None, serializer: Some( Function( FunctionPlainSerializer { func: Py( 0x00007f11019c5440, ), name: "plain_function[<lambda>]", function_name: "<lambda>", return_serializer: Any( AnySerializer, ), fallback_serializer: Some( Datetime( DatetimeSerializer { temporal_mode: Iso8601, }, ), ), when_used: Json, is_field_serializer: false, info_arg: false, }, ), ), required: true, serialize_by_alias: Some( true, ), serialization_exclude_if: None, }, "ctime": SerField { key: "ctime", alias: None, serializer: Some( Function( FunctionPlainSerializer { func: Py( 0x00007f11019c5440, ), name: "plain_function[<lambda>]", function_name: "<lambda>", return_serializer: Any( AnySerializer, ), fallback_serializer: Some( Datetime( DatetimeSerializer { temporal_mode: Iso8601, }, ), ), when_used: Json, is_field_serializer: false, info_arg: false, }, ), ), required: true, serialize_by_alias: Some( true, ), serialization_exclude_if: None, }, "uuid": SerField { key: "uuid", alias: None, serializer: Some( Uuid( UuidSerializer, ), ), required: true, serialize_by_alias: Some( true, ), serialization_exclude_if: None, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 13, }, ), has_extra: false, root_model: false, name: "ReadModel", }, ), enabled_from_config: false, }, ), enabled_from_config: false, }, ), definitions=[])¶
The pydantic-core SchemaSerializer used to dump instances of the model.
- __pydantic_setattr_handlers__: ClassVar[Dict[str, Callable[[BaseModel, str, Any], None]]] = {}¶
__setattr__ handlers. Memoizing the handlers leads to a dramatic performance improvement in __setattr__
- __pydantic_validator__: ClassVar[SchemaValidator | PluggableSchemaValidator] = SchemaValidator(title="JanusConfigfileReadModel", validator=Model( ModelValidator { revalidate: Never, validator: ModelFields( ModelFieldsValidator { fields: [ Field { name: "pk", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "pk", ), rest: [], }, by_alias: [], }, validator: Int( IntValidator { strict: false, }, ), frozen: false, }, Field { name: "label", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "label", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x0000000000b3c3f0, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1102f788b0, ), }, ), frozen: false, }, Field { name: "description", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "description", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x0000000000b3c3f0, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1102f788b0, ), }, ), frozen: false, }, Field { name: "extras", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "extras", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: DefaultFactory( Py( 0x0000000000a3d840, ), false, ), on_error: Raise, validator: Dict( DictValidator { strict: false, key_validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), value_validator: Any( AnyValidator, ), min_length: None, max_length: None, fail_fast: false, name: "dict[str,any]", }, ), validate_default: false, copy_default: false, name: "default[dict[str,any]]", undefined: Py( 0x00007f1102f788b0, ), }, ), frozen: false, }, Field { name: "node_type", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "node_type", ), rest: [], }, by_alias: [], }, validator: Literal( LiteralValidator { lookup: LiteralLookup { expected_bool: None, expected_int: None, expected_str: Some( { "data.mlip.config.JanusConfigfile.": 0, }, ), expected_py_dict: None, expected_py_values: None, expected_py_primitives: Some( Py( 0x00007f10dce48d40, ), ), values: [ Py( 0x00007f10de92ff50, ), ], }, expected_repr: "'data.mlip.config.JanusConfigfile.'", name: "literal['data.mlip.config.JanusConfigfile.']", }, ), frozen: false, }, Field { name: "attributes", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "attributes", ), rest: [], }, by_alias: [], }, validator: Prebuilt( PrebuiltValidator { schema_validator: Py( 0x00007f10dcec0280, ), }, ), frozen: false, }, Field { name: "repository_metadata", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "repository_metadata", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: DefaultFactory( Py( 0x0000000000a3d840, ), false, ), on_error: Raise, validator: Dict( DictValidator { strict: false, key_validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), value_validator: Any( AnyValidator, ), min_length: None, max_length: None, fail_fast: false, name: "dict[str,any]", }, ), validate_default: false, copy_default: false, name: "default[dict[str,any]]", undefined: Py( 0x00007f1102f788b0, ), }, ), frozen: false, }, Field { name: "uuid", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "uuid", ), rest: [], }, by_alias: [], }, validator: Uuid( UuidValidator { strict: false, version: None, }, ), frozen: false, }, Field { name: "process_type", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "process_type", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x0000000000a408a0, ), ), on_error: Raise, validator: Nullable( NullableValidator { validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), name: "nullable[str]", }, ), validate_default: false, copy_default: false, name: "default[nullable[str]]", undefined: Py( 0x00007f1102f788b0, ), }, ), frozen: false, }, Field { name: "ctime", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "ctime", ), rest: [], }, by_alias: [], }, validator: Datetime( DateTimeValidator { strict: false, constraints: None, microseconds_precision: Truncate, val_temporal_unit: Infer, }, ), frozen: false, }, Field { name: "mtime", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "mtime", ), rest: [], }, by_alias: [], }, validator: Datetime( DateTimeValidator { strict: false, constraints: None, microseconds_precision: Truncate, val_temporal_unit: Infer, }, ), frozen: false, }, Field { name: "computer", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "computer", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x0000000000a408a0, ), ), on_error: Raise, validator: Nullable( NullableValidator { validator: Int( IntValidator { strict: false, }, ), name: "nullable[int]", }, ), validate_default: false, copy_default: false, name: "default[nullable[int]]", undefined: Py( 0x00007f1102f788b0, ), }, ), frozen: false, }, Field { name: "user", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "user", ), rest: [], }, by_alias: [], }, validator: Int( IntValidator { strict: false, }, ), frozen: false, }, ], model_name: "ReadModel", extra_behavior: Forbid, extras_validator: None, extras_keys_validator: None, strict: false, from_attributes: false, loc_by_alias: true, lookup: LookupTree { inner: { PathItemString( "mtime", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 10, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "computer", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 11, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "label", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 1, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "pk", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 0, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "repository_metadata", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 6, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "user", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 12, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "description", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 2, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "extras", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 3, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "attributes", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 5, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "uuid", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 7, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "process_type", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 8, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "ctime", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 9, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "node_type", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 4, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, }, }, validate_by_alias: Some( true, ), validate_by_name: Some( true, ), }, ), class: Py( 0x0000000016d066b0, ), generic_origin: None, post_init: Some( Py( 0x00007f1101d1c530, ), ), frozen: false, custom_init: false, root_model: false, undefined: Py( 0x00007f1102f788b0, ), name: "ReadModel", }, ), definitions=[], cache_strings=True)¶
The pydantic-core SchemaValidator used to validate instances of the model.
- _abc_impl = <_abc._abc_data object>¶
- attributes: AttributesModel¶
- model_config: ClassVar[ConfigDict] = {'defer_build': True, 'extra': 'forbid', 'json_encoders': {<class 'datetime.datetime'>: <function OrmModel.<lambda>>}, 'serialize_by_alias': True, 'title': 'JanusConfigfileReadModel', 'validate_by_alias': True, 'validate_by_name': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class WriteModel(**data: Any)¶
Bases:
WriteModelMethods
model_post_init(context, /)This function is meant to behave like a BaseModel method to initialize private attributes.
- __abstractmethods__ = frozenset({})¶
- __annotations__ = {'_AIIDA_MINIMAL_MODEL': 'type[OrmModel] | None', '__class_vars__': 'ClassVar[set[str]]', '__private_attributes__': 'ClassVar[Dict[str, ModelPrivateAttr]]', '__pydantic_complete__': 'ClassVar[bool]', '__pydantic_computed_fields__': 'ClassVar[Dict[str, ComputedFieldInfo]]', '__pydantic_core_schema__': 'ClassVar[CoreSchema]', '__pydantic_custom_init__': 'ClassVar[bool]', '__pydantic_decorators__': 'ClassVar[_decorators.DecoratorInfos]', '__pydantic_extra__': 'Dict[str, Any] | None', '__pydantic_extra_info__': 'ClassVar[PydanticExtraInfo | None]', '__pydantic_fields__': 'ClassVar[Dict[str, FieldInfo]]', '__pydantic_fields_set__': 'set[str]', '__pydantic_generic_metadata__': 'ClassVar[_generics.PydanticGenericMetadata]', '__pydantic_parent_namespace__': 'ClassVar[Dict[str, Any] | None]', '__pydantic_post_init__': "ClassVar[None | Literal['model_post_init']]", '__pydantic_private__': 'Dict[str, Any] | None', '__pydantic_root_model__': 'ClassVar[bool]', '__pydantic_serializer__': 'ClassVar[SchemaSerializer]', '__pydantic_setattr_handlers__': 'ClassVar[Dict[str, Callable[[BaseModel, str, Any], None]]]', '__pydantic_validator__': 'ClassVar[SchemaValidator | PluggableSchemaValidator]', '__signature__': 'ClassVar[Signature]', 'attributes': <class 'aiida_mlip.data.config.JanusConfigfile.AttributesWriteModel'>, 'description': <class 'str'>, 'extras': dict[str, typing.Any], 'label': <class 'str'>, 'model_config': 'ClassVar[ConfigDict]', 'node_type': typing.Literal['data.mlip.config.JanusConfigfile.'], 'repository_metadata': dict[str, typing.Any]}¶
- __dict__¶
- __module__ = 'aiida_mlip.data.config'¶
- __private_attributes__: ClassVar[Dict[str, ModelPrivateAttr]] = {'_AIIDA_MINIMAL_MODEL': ModelPrivateAttr()}¶
Metadata about the private attributes of the model.
- __pydantic_complete__: ClassVar[bool] = True¶
Whether model building is completed, or if there are still undefined fields.
- __pydantic_computed_fields__: ClassVar[Dict[str, ComputedFieldInfo]] = {}¶
A dictionary of computed field names and their corresponding [ComputedFieldInfo][pydantic.fields.ComputedFieldInfo] objects.
- __pydantic_core_schema__: ClassVar[CoreSchema] = {'cls': <class 'aiida_mlip.data.config.JanusConfigfile.WriteModel'>, 'config': {'extra_fields_behavior': 'forbid', 'serialize_by_alias': True, 'title': 'JanusConfigfileWriteModel', 'validate_by_alias': True, 'validate_by_name': True}, 'custom_init': False, 'metadata': {'pydantic_js_functions': [<bound method BaseModel.__get_pydantic_json_schema__ of <class 'aiida_mlip.data.config.JanusConfigfile.WriteModel'>>]}, 'post_init': 'model_post_init', 'ref': 'aiida_mlip.data.config.JanusConfigfile.WriteModel:382785840', 'root_model': False, 'schema': {'computed_fields': [], 'fields': {'attributes': {'metadata': {'pydantic_js_extra': {}, 'pydantic_js_updates': {'description': 'The node attributes', 'examples': [{'attr_key': 'attr_value'}]}}, 'schema': {'cls': <class 'aiida_mlip.data.config.JanusConfigfile.AttributesWriteModel'>, 'config': {'extra_fields_behavior': 'forbid', 'serialize_by_alias': True, 'title': 'JanusConfigfileAttributesWriteModel', 'validate_by_alias': True, 'validate_by_name': True}, 'custom_init': False, 'metadata': {'pydantic_js_functions': [<bound method BaseModel.__get_pydantic_json_schema__ of <class 'aiida_mlip.data.config.JanusConfigfile.AttributesWriteModel'>>]}, 'post_init': 'model_post_init', 'ref': 'aiida_mlip.data.config.JanusConfigfile.AttributesWriteModel:382735968', 'root_model': False, 'schema': {'computed_fields': [], 'fields': {'source': {'metadata': {'pydantic_js_extra': {}, 'pydantic_js_updates': {'description': 'Source of the data'}}, 'schema': {'default': None, 'schema': {'schema': {'keys_schema': {'type': 'any'}, 'type': 'dict', 'values_schema': {'type': 'any'}}, 'type': 'nullable'}, 'type': 'default'}, 'type': 'model-field'}}, 'model_name': 'AttributesWriteModel', 'type': 'model-fields'}, 'type': 'model'}, 'type': 'model-field'}, 'description': {'metadata': {'pydantic_js_extra': {}, 'pydantic_js_updates': {'description': 'The node description', 'examples': ['This is my node description.']}}, 'schema': {'default': '', 'schema': {'type': 'str'}, 'type': 'default'}, 'type': 'model-field'}, 'extras': {'metadata': {'pydantic_js_extra': {}, 'pydantic_js_updates': {'description': 'The node extras', 'examples': [{'extra_key': 'extra_value'}]}}, 'schema': {'default_factory': <class 'dict'>, 'default_factory_takes_data': False, 'schema': {'keys_schema': {'type': 'str'}, 'type': 'dict', 'values_schema': {'type': 'any'}}, 'type': 'default'}, 'type': 'model-field'}, 'label': {'metadata': {'pydantic_js_extra': {}, 'pydantic_js_updates': {'description': 'The node label', 'examples': ['my_node']}}, 'schema': {'default': '', 'schema': {'type': 'str'}, 'type': 'default'}, 'type': 'model-field'}, 'node_type': {'metadata': {'pydantic_js_extra': {}, 'pydantic_js_updates': {'description': 'The type of the node.'}}, 'schema': {'expected': ['data.mlip.config.JanusConfigfile.'], 'type': 'literal'}, 'type': 'model-field'}, 'repository_metadata': {'metadata': {'pydantic_js_extra': {}, 'pydantic_js_updates': {'description': 'Virtual hierarchy of the file repository', 'examples': [{'o': {'file.txt': {'k': '<file_hash>'}}}]}}, 'schema': {'default_factory': <class 'dict'>, 'default_factory_takes_data': False, 'schema': {'keys_schema': {'type': 'str'}, 'type': 'dict', 'values_schema': {'type': 'any'}}, 'type': 'default'}, 'type': 'model-field'}}, 'model_name': 'WriteModel', 'type': 'model-fields'}, 'type': 'model'}¶
The core schema of the model.
- __pydantic_decorators__: ClassVar[_decorators.DecoratorInfos] = DecoratorInfos(validators={}, field_validators={}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})¶
Metadata containing the decorators defined on the model. This replaces Model.__validators__ and Model.__root_validators__ from Pydantic V1.
- __pydantic_extra__: Dict[str, Any] | None¶
A dictionary containing extra values, if [extra][pydantic.config.ConfigDict.extra] is set to ‘allow’.
- __pydantic_extra_info__: ClassVar[PydanticExtraInfo | None] = None¶
A wrapper around the __pydantic_extra__ annotation, if explicitly annotated on a model.
This is a private attribute, not meant to be used outside Pydantic.
- __pydantic_fields__: ClassVar[Dict[str, FieldInfo]] = {'attributes': FieldInfo(annotation=JanusConfigfile.AttributesWriteModel, required=True, description='The node attributes', examples=[{'attr_key': 'attr_value'}], json_schema_extra={}, metadata=[{'priority': 0}, {'read_only': False}, {'write_only': False}, {'may_be_large': True}]), 'description': FieldInfo(annotation=str, required=False, default='', description='The node description', examples=['This is my node description.'], json_schema_extra={}, metadata=[{'priority': 0}, {'read_only': False}, {'write_only': False}, {'may_be_large': False}]), 'extras': FieldInfo(annotation=dict[str, Any], required=False, default_factory=dict, description='The node extras', examples=[{'extra_key': 'extra_value'}], json_schema_extra={}, metadata=[{'priority': 0}, {'read_only': False}, {'write_only': False}, {'may_be_large': True}, {'orm_to_model': <function Node.MutableNodeFields.<lambda>>}]), 'label': FieldInfo(annotation=str, required=False, default='', description='The node label', examples=['my_node'], json_schema_extra={}, metadata=[{'priority': 0}, {'read_only': False}, {'write_only': False}, {'may_be_large': False}]), 'node_type': FieldInfo(annotation=Literal['data.mlip.config.JanusConfigfile.'], required=True, description='The type of the node.', json_schema_extra={}, metadata=[{'priority': 0}, {'read_only': False}, {'write_only': False}, {'may_be_large': False}]), 'repository_metadata': FieldInfo(annotation=dict[str, Any], required=False, default_factory=dict, description='Virtual hierarchy of the file repository', examples=[{'o': {'file.txt': {'k': '<file_hash>'}}}], json_schema_extra={}, metadata=[{'priority': 0}, {'read_only': False}, {'write_only': False}, {'may_be_large': True}, {'orm_to_model': <function Node.WritableFields.<lambda>>}])}¶
A dictionary of field names and their corresponding [FieldInfo][pydantic.fields.FieldInfo] objects. This replaces Model.__fields__ from Pydantic V1.
- __pydantic_generic_metadata__: ClassVar[_generics.PydanticGenericMetadata] = {'args': (), 'origin': None, 'parameters': ()}¶
A dictionary containing metadata about generic Pydantic models.
The origin and args items map to the [__origin__][genericalias.__origin__] and [__args__][genericalias.__args__] attributes of [generic aliases][types-genericalias], and the parameter item maps to the __parameter__ attribute of generic classes.
- __pydantic_post_init__: ClassVar[None | Literal['model_post_init']] = 'model_post_init'¶
The name of the post-init method for the model, if defined.
- __pydantic_private__: Dict[str, Any] | None¶
Values of private attributes set on the model instance.
- __pydantic_serializer__: ClassVar[SchemaSerializer] = SchemaSerializer(serializer=PolymorphismTrampoline( PolymorphismTrampoline { class: Py( 0x0000000016d0d930, ), serializer: PolymorphismTrampoline( PolymorphismTrampoline { class: Py( 0x0000000016d0d930, ), serializer: Model( ModelSerializer { class: Py( 0x0000000016d0d930, ), serializer: Fields( GeneralFieldsSerializer { fields: { "attributes": SerField { key: "attributes", alias: None, serializer: Some( PolymorphismTrampoline( PolymorphismTrampoline { class: Py( 0x0000000016d01660, ), serializer: PolymorphismTrampoline( PolymorphismTrampoline { class: Py( 0x0000000016d01660, ), serializer: Model( ModelSerializer { class: Py( 0x0000000016d01660, ), serializer: Fields( GeneralFieldsSerializer { fields: { "source": SerField { key: "source", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x0000000000a408a0, ), ), serializer: Nullable( NullableSerializer { serializer: Dict( DictSerializer { key_serializer: Any( AnySerializer, ), value_serializer: Any( AnySerializer, ), filter: SchemaFilter { include: None, exclude: None, }, name: "dict[any, any]", }, ), }, ), }, ), ), required: true, serialize_by_alias: Some( true, ), serialization_exclude_if: None, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 1, }, ), has_extra: false, root_model: false, name: "AttributesWriteModel", }, ), enabled_from_config: false, }, ), enabled_from_config: false, }, ), ), required: true, serialize_by_alias: Some( true, ), serialization_exclude_if: None, }, "node_type": SerField { key: "node_type", alias: None, serializer: Some( Literal( LiteralSerializer { expected_int: {}, expected_str: { "data.mlip.config.JanusConfigfile.", }, expected_py: None, name: "literal['data.mlip.config.JanusConfigfile.']", }, ), ), required: true, serialize_by_alias: Some( true, ), serialization_exclude_if: None, }, "label": SerField { key: "label", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x0000000000b3c3f0, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, serialize_by_alias: Some( true, ), serialization_exclude_if: None, }, "repository_metadata": SerField { key: "repository_metadata", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: DefaultFactory( Py( 0x0000000000a3d840, ), false, ), serializer: Dict( DictSerializer { key_serializer: Str( StrSerializer, ), value_serializer: Any( AnySerializer, ), filter: SchemaFilter { include: None, exclude: None, }, name: "dict[str, any]", }, ), }, ), ), required: true, serialize_by_alias: Some( true, ), serialization_exclude_if: None, }, "description": SerField { key: "description", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x0000000000b3c3f0, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, serialize_by_alias: Some( true, ), serialization_exclude_if: None, }, "extras": SerField { key: "extras", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: DefaultFactory( Py( 0x0000000000a3d840, ), false, ), serializer: Dict( DictSerializer { key_serializer: Str( StrSerializer, ), value_serializer: Any( AnySerializer, ), filter: SchemaFilter { include: None, exclude: None, }, name: "dict[str, any]", }, ), }, ), ), required: true, serialize_by_alias: Some( true, ), serialization_exclude_if: None, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 6, }, ), has_extra: false, root_model: false, name: "WriteModel", }, ), enabled_from_config: false, }, ), enabled_from_config: false, }, ), definitions=[])¶
The pydantic-core SchemaSerializer used to dump instances of the model.
- __pydantic_setattr_handlers__: ClassVar[Dict[str, Callable[[BaseModel, str, Any], None]]] = {}¶
__setattr__ handlers. Memoizing the handlers leads to a dramatic performance improvement in __setattr__
- __pydantic_validator__: ClassVar[SchemaValidator | PluggableSchemaValidator] = SchemaValidator(title="JanusConfigfileWriteModel", validator=Model( ModelValidator { revalidate: Never, validator: ModelFields( ModelFieldsValidator { fields: [ Field { name: "label", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "label", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x0000000000b3c3f0, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1102f788b0, ), }, ), frozen: false, }, Field { name: "description", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "description", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x0000000000b3c3f0, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1102f788b0, ), }, ), frozen: false, }, Field { name: "extras", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "extras", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: DefaultFactory( Py( 0x0000000000a3d840, ), false, ), on_error: Raise, validator: Dict( DictValidator { strict: false, key_validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), value_validator: Any( AnyValidator, ), min_length: None, max_length: None, fail_fast: false, name: "dict[str,any]", }, ), validate_default: false, copy_default: false, name: "default[dict[str,any]]", undefined: Py( 0x00007f1102f788b0, ), }, ), frozen: false, }, Field { name: "node_type", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "node_type", ), rest: [], }, by_alias: [], }, validator: Literal( LiteralValidator { lookup: LiteralLookup { expected_bool: None, expected_int: None, expected_str: Some( { "data.mlip.config.JanusConfigfile.": 0, }, ), expected_py_dict: None, expected_py_values: None, expected_py_primitives: Some( Py( 0x00007f10dce4dc40, ), ), values: [ Py( 0x00007f10de92ff50, ), ], }, expected_repr: "'data.mlip.config.JanusConfigfile.'", name: "literal['data.mlip.config.JanusConfigfile.']", }, ), frozen: false, }, Field { name: "attributes", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "attributes", ), rest: [], }, by_alias: [], }, validator: Model( ModelValidator { revalidate: Never, validator: ModelFields( ModelFieldsValidator { fields: [ Field { name: "source", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "source", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x0000000000a408a0, ), ), on_error: Raise, validator: Nullable( NullableValidator { validator: Dict( DictValidator { strict: false, key_validator: Any( AnyValidator, ), value_validator: Any( AnyValidator, ), min_length: None, max_length: None, fail_fast: false, name: "dict[any,any]", }, ), name: "nullable[dict[any,any]]", }, ), validate_default: false, copy_default: false, name: "default[nullable[dict[any,any]]]", undefined: Py( 0x00007f1102f788b0, ), }, ), frozen: false, }, ], model_name: "AttributesWriteModel", extra_behavior: Forbid, extras_validator: None, extras_keys_validator: None, strict: false, from_attributes: false, loc_by_alias: true, lookup: LookupTree { inner: { PathItemString( "source", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 0, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, }, }, validate_by_alias: Some( true, ), validate_by_name: Some( true, ), }, ), class: Py( 0x0000000016d01660, ), generic_origin: None, post_init: Some( Py( 0x00007f1101d1c530, ), ), frozen: false, custom_init: false, root_model: false, undefined: Py( 0x00007f1102f788b0, ), name: "AttributesWriteModel", }, ), frozen: false, }, Field { name: "repository_metadata", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "repository_metadata", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: DefaultFactory( Py( 0x0000000000a3d840, ), false, ), on_error: Raise, validator: Dict( DictValidator { strict: false, key_validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), value_validator: Any( AnyValidator, ), min_length: None, max_length: None, fail_fast: false, name: "dict[str,any]", }, ), validate_default: false, copy_default: false, name: "default[dict[str,any]]", undefined: Py( 0x00007f1102f788b0, ), }, ), frozen: false, }, ], model_name: "WriteModel", extra_behavior: Forbid, extras_validator: None, extras_keys_validator: None, strict: false, from_attributes: false, loc_by_alias: true, lookup: LookupTree { inner: { PathItemString( "label", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 0, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "attributes", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 4, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "description", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 1, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "repository_metadata", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 5, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "node_type", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 3, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "extras", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 2, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, }, }, validate_by_alias: Some( true, ), validate_by_name: Some( true, ), }, ), class: Py( 0x0000000016d0d930, ), generic_origin: None, post_init: Some( Py( 0x00007f1101d1c530, ), ), frozen: false, custom_init: false, root_model: false, undefined: Py( 0x00007f1102f788b0, ), name: "WriteModel", }, ), definitions=[], cache_strings=True)¶
The pydantic-core SchemaValidator used to validate instances of the model.
- _abc_impl = <_abc._abc_data object>¶
- attributes: AttributesWriteModel¶
- model_config: ClassVar[ConfigDict] = {'defer_build': True, 'extra': 'forbid', 'json_encoders': {<class 'datetime.datetime'>: <function OrmModel.<lambda>>}, 'serialize_by_alias': True, 'title': 'JanusConfigfileWriteModel', 'validate_by_alias': True, 'validate_by_name': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- _COMPAT_MODEL¶
alias of
Model
- _ConstructorModel¶
alias of
ConstructorModel
- _MODEL_MAP: ClassVar[dict[str, type[OrmModel]]] = {'read': <class 'aiida_mlip.data.config.JanusConfigfile.ReadModel'>, 'write': <class 'aiida_mlip.data.config.JanusConfigfile.WriteModel'>}¶
- __abstractmethods__ = frozenset({})¶
- __annotations__ = {'_CLS_COLLECTION': 'type[CollectionType]', '_COMPAT_MODEL': 'ClassVar[type[OrmModel] | None]', '_CliModel': 'ClassVar[type[OrmModel] | None]', '_ConstructorModel': 'ClassVar[type[BaseNodeModel] | None]', '_MODEL_MAP': 'ClassVar[dict[str, type[OrmModel]]]', '__plugin_type_string': 'ClassVar[str]', '__query_type_string': 'ClassVar[str]', '_export_format_replacements': 'dict[str, str]', '_hash_ignored_attributes': 'tuple[str, ...]', '_logger': 'AiidaLoggerType', '_updatable_attributes': 'tuple[str, ...]', 'fields': 'ClassVar[QbFields]'}¶
- __contains__(key)[source]¶
Check if a key exists in the config file.
- Parameters:
- keystr
Key to check.
- Returns:
- bool
True if the key exists in the config file, False otherwise.
- __init__(file: str | Path, filename: str | None = None, **kwargs: Any) None[source]¶
Initialize the JanusConfigfile object.
- Parameters:
- filestr | Path
Absolute path to the file.
- filenamestr | None
Name to be used for the file. Defaults is the name of provided file.
- Other Parameters:
- **kwargsAny
Additional keyword arguments.
- __module__ = 'aiida_mlip.data.config'¶
- __parameters__ = ()¶
- _abc_impl = <_abc._abc_data object>¶
- _logger: AiidaLoggerType = <Logger aiida_mlip.data.config.JanusConfigfile (WARNING)>¶
- fields: ClassVar[QbFields] = {'attributes': "QbAttributesField('attributes', dtype=<class 'aiida_mlip.data.config.JanusConfigfile.AttributesModel'>, doc='The node attributes')", 'computer': "QbNumericField('computer', dtype=int | None, doc='The PK of the computer')", 'ctime': "QbNumericField('ctime', dtype=<class 'datetime.datetime'>, doc='The creation time of the node')", 'description': "QbStrField('description', dtype=<class 'str'>, doc='The node description')", 'extras': "QbDictField('extras', dtype=dict[str, typing.Any], doc='The node extras')", 'filename': "QbStrField('attributes.filename', dtype=<class 'str'>, doc='The name of the stored file')", 'label': "QbStrField('label', dtype=<class 'str'>, doc='The node label')", 'mtime': "QbNumericField('mtime', dtype=<class 'datetime.datetime'>, doc='The modification time of the node')", 'node_type': "QbStrField('node_type', dtype=typing.Literal['data.mlip.config.JanusConfigfile.'], doc='The type of the node.')", 'pk': "QbNumericField('pk', dtype=<class 'int'>, doc='The primary key of the entity')", 'process_type': "QbStrField('process_type', dtype=str | None, doc='The process type of the node')", 'repository_metadata': "QbDictField('repository_metadata', dtype=dict[str, typing.Any], doc='Virtual hierarchy of the file repository')", 'source': "QbDictField('attributes.source', dtype=dict | None, doc='Source of the data')", 'user': "QbNumericField('user', dtype=<class 'int'>, doc='The PK of the user who owns the node')", 'uuid': "QbStrField('uuid', dtype=<class 'uuid.UUID'>, doc='The UUID of the node')"}¶
- read_yaml() dict[source]¶
Convert yaml file to dictionary.
- Returns:
- dict
Returns the converted dictionary with the stored parameters.
- set_file(file: str | Path, filename: str | None = None, **kwargs: Any) None[source]¶
Set the file for the node.
- Parameters:
- filestr | Path
Absolute path to the file.
- filenamestr | None
Name to be used for the file. Default is the name of provided file.
- Other Parameters:
- **kwargsAny
Additional keyword arguments.
- store_content(store_all: bool = False, skip: list = None) dict[source]¶
Store the content of the config file in the database.
- Parameters:
- store_allbool
Define if you want to store all the parameters or only the main ones.
- skiplist
List of parameters that do not have to be stored.
- Returns:
- dict
Returns the converted dictionary with the stored parameters.
aiida_mlip.data.model module¶
Define Model Data type in AiiDA.
- class aiida_mlip.data.model.ModelData(file: str | Path, architecture: str, filename: str | None = None, **kwargs: Any)[source]¶
Bases:
SinglefileDataDefine Model Data type in AiiDA.
- Parameters:
- filestr | Path
Absolute path to the file.
- architecturestr
Architecture of the mlip model.
- filenamestr | None
Name to be used for the file. Default is the name of provided file.
- Attributes:
architecturestrReturn the architecture.
model_hashstrReturn hash of the architecture.
Methods
set_file(file, filename=None, architecture=None, **kwargs)
Set the file for the node.
from_local(file, architecture, filename=None):
Create a ModelData instance from a local file.
from_uri(uri, architecture, filename=None, cache_dir=None, keep_file=False)
Download a file from a URI and save it as ModelData.
- Other Parameters:
- **kwargsAny
Additional keyword arguments.
- class AttributesModel(**data: Any)¶
Bases:
AttributesModelMethods
model_post_init(context, /)This function is meant to behave like a BaseModel method to initialize private attributes.
- __abstractmethods__ = frozenset({})¶
- __annotations__ = {'_AIIDA_MINIMAL_MODEL': 'type[OrmModel] | None', '__class_vars__': 'ClassVar[set[str]]', '__private_attributes__': 'ClassVar[Dict[str, ModelPrivateAttr]]', '__pydantic_complete__': 'ClassVar[bool]', '__pydantic_computed_fields__': 'ClassVar[Dict[str, ComputedFieldInfo]]', '__pydantic_core_schema__': 'ClassVar[CoreSchema]', '__pydantic_custom_init__': 'ClassVar[bool]', '__pydantic_decorators__': 'ClassVar[_decorators.DecoratorInfos]', '__pydantic_extra__': 'Dict[str, Any] | None', '__pydantic_extra_info__': 'ClassVar[PydanticExtraInfo | None]', '__pydantic_fields__': 'ClassVar[Dict[str, FieldInfo]]', '__pydantic_fields_set__': 'set[str]', '__pydantic_generic_metadata__': 'ClassVar[_generics.PydanticGenericMetadata]', '__pydantic_parent_namespace__': 'ClassVar[Dict[str, Any] | None]', '__pydantic_post_init__': "ClassVar[None | Literal['model_post_init']]", '__pydantic_private__': 'Dict[str, Any] | None', '__pydantic_root_model__': 'ClassVar[bool]', '__pydantic_serializer__': 'ClassVar[SchemaSerializer]', '__pydantic_setattr_handlers__': 'ClassVar[Dict[str, Callable[[BaseModel, str, Any], None]]]', '__pydantic_validator__': 'ClassVar[SchemaValidator | PluggableSchemaValidator]', '__signature__': 'ClassVar[Signature]', 'filename': 'str', 'model_config': 'ClassVar[ConfigDict]', 'source': 'dict | None'}¶
- __dict__¶
- __module__ = 'aiida_mlip.data.model'¶
- __private_attributes__: ClassVar[Dict[str, ModelPrivateAttr]] = {'_AIIDA_MINIMAL_MODEL': ModelPrivateAttr()}¶
Metadata about the private attributes of the model.
- __pydantic_complete__: ClassVar[bool] = True¶
Whether model building is completed, or if there are still undefined fields.
- __pydantic_computed_fields__: ClassVar[Dict[str, ComputedFieldInfo]] = {}¶
A dictionary of computed field names and their corresponding [ComputedFieldInfo][pydantic.fields.ComputedFieldInfo] objects.
- __pydantic_core_schema__: ClassVar[CoreSchema] = {'cls': <class 'aiida_mlip.data.model.ModelData.AttributesModel'>, 'config': {'extra_fields_behavior': 'forbid', 'serialize_by_alias': True, 'title': 'ModelDataAttributesModel', 'validate_by_alias': True, 'validate_by_name': True}, 'custom_init': False, 'metadata': {'pydantic_js_functions': [<bound method BaseModel.__get_pydantic_json_schema__ of <class 'aiida_mlip.data.model.ModelData.AttributesModel'>>]}, 'post_init': 'model_post_init', 'ref': 'aiida_mlip.data.model.ModelData.AttributesModel:382855184', 'root_model': False, 'schema': {'computed_fields': [], 'fields': {'filename': {'metadata': {'pydantic_js_extra': {'readOnly': True}, 'pydantic_js_updates': {'description': 'The name of the stored file'}}, 'schema': {'type': 'str'}, 'type': 'model-field'}, 'source': {'metadata': {'pydantic_js_extra': {}, 'pydantic_js_updates': {'description': 'Source of the data'}}, 'schema': {'default': None, 'schema': {'schema': {'keys_schema': {'type': 'any'}, 'type': 'dict', 'values_schema': {'type': 'any'}}, 'type': 'nullable'}, 'type': 'default'}, 'type': 'model-field'}}, 'model_name': 'AttributesModel', 'type': 'model-fields'}, 'type': 'model'}¶
The core schema of the model.
- __pydantic_decorators__: ClassVar[_decorators.DecoratorInfos] = DecoratorInfos(validators={}, field_validators={}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})¶
Metadata containing the decorators defined on the model. This replaces Model.__validators__ and Model.__root_validators__ from Pydantic V1.
- __pydantic_extra__: Dict[str, Any] | None¶
A dictionary containing extra values, if [extra][pydantic.config.ConfigDict.extra] is set to ‘allow’.
- __pydantic_extra_info__: ClassVar[PydanticExtraInfo | None] = None¶
A wrapper around the __pydantic_extra__ annotation, if explicitly annotated on a model.
This is a private attribute, not meant to be used outside Pydantic.
- __pydantic_fields__: ClassVar[Dict[str, FieldInfo]] = {'filename': FieldInfo(annotation=str, required=True, description='The name of the stored file', json_schema_extra={'readOnly': True}, metadata=[{'priority': 0}, {'read_only': True}, {'write_only': False}, {'may_be_large': False}, {'orm_to_model': <function SinglefileData.AttributesModel.<lambda>>}]), 'source': FieldInfo(annotation=Union[dict, NoneType], required=False, default=None, description='Source of the data', json_schema_extra={}, metadata=[{'priority': 0}, {'read_only': False}, {'write_only': False}, {'may_be_large': False}])}¶
A dictionary of field names and their corresponding [FieldInfo][pydantic.fields.FieldInfo] objects. This replaces Model.__fields__ from Pydantic V1.
- __pydantic_generic_metadata__: ClassVar[_generics.PydanticGenericMetadata] = {'args': (), 'origin': None, 'parameters': ()}¶
A dictionary containing metadata about generic Pydantic models.
The origin and args items map to the [__origin__][genericalias.__origin__] and [__args__][genericalias.__args__] attributes of [generic aliases][types-genericalias], and the parameter item maps to the __parameter__ attribute of generic classes.
- __pydantic_post_init__: ClassVar[None | Literal['model_post_init']] = 'model_post_init'¶
The name of the post-init method for the model, if defined.
- __pydantic_private__: Dict[str, Any] | None¶
Values of private attributes set on the model instance.
- __pydantic_serializer__: ClassVar[SchemaSerializer] = SchemaSerializer(serializer=PolymorphismTrampoline( PolymorphismTrampoline { class: Py( 0x0000000016d1e810, ), serializer: PolymorphismTrampoline( PolymorphismTrampoline { class: Py( 0x0000000016d1e810, ), serializer: Model( ModelSerializer { class: Py( 0x0000000016d1e810, ), serializer: Fields( GeneralFieldsSerializer { fields: { "source": SerField { key: "source", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x0000000000a408a0, ), ), serializer: Nullable( NullableSerializer { serializer: Dict( DictSerializer { key_serializer: Any( AnySerializer, ), value_serializer: Any( AnySerializer, ), filter: SchemaFilter { include: None, exclude: None, }, name: "dict[any, any]", }, ), }, ), }, ), ), required: true, serialize_by_alias: Some( true, ), serialization_exclude_if: None, }, "filename": SerField { key: "filename", alias: None, serializer: Some( Str( StrSerializer, ), ), required: true, serialize_by_alias: Some( true, ), serialization_exclude_if: None, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 2, }, ), has_extra: false, root_model: false, name: "AttributesModel", }, ), enabled_from_config: false, }, ), enabled_from_config: false, }, ), definitions=[])¶
The pydantic-core SchemaSerializer used to dump instances of the model.
- __pydantic_setattr_handlers__: ClassVar[Dict[str, Callable[[BaseModel, str, Any], None]]] = {}¶
__setattr__ handlers. Memoizing the handlers leads to a dramatic performance improvement in __setattr__
- __pydantic_validator__: ClassVar[SchemaValidator | PluggableSchemaValidator] = SchemaValidator(title="ModelDataAttributesModel", validator=Model( ModelValidator { revalidate: Never, validator: ModelFields( ModelFieldsValidator { fields: [ Field { name: "source", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "source", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x0000000000a408a0, ), ), on_error: Raise, validator: Nullable( NullableValidator { validator: Dict( DictValidator { strict: false, key_validator: Any( AnyValidator, ), value_validator: Any( AnyValidator, ), min_length: None, max_length: None, fail_fast: false, name: "dict[any,any]", }, ), name: "nullable[dict[any,any]]", }, ), validate_default: false, copy_default: false, name: "default[nullable[dict[any,any]]]", undefined: Py( 0x00007f1102f788b0, ), }, ), frozen: false, }, Field { name: "filename", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "filename", ), rest: [], }, by_alias: [], }, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), frozen: false, }, ], model_name: "AttributesModel", extra_behavior: Forbid, extras_validator: None, extras_keys_validator: None, strict: false, from_attributes: false, loc_by_alias: true, lookup: LookupTree { inner: { PathItemString( "source", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 0, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "filename", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 1, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, }, }, validate_by_alias: Some( true, ), validate_by_name: Some( true, ), }, ), class: Py( 0x0000000016d1e810, ), generic_origin: None, post_init: Some( Py( 0x00007f1101d1c530, ), ), frozen: false, custom_init: false, root_model: false, undefined: Py( 0x00007f1102f788b0, ), name: "AttributesModel", }, ), definitions=[], cache_strings=True)¶
The pydantic-core SchemaValidator used to validate instances of the model.
- _abc_impl = <_abc._abc_data object>¶
- model_config: ClassVar[ConfigDict] = {'defer_build': True, 'extra': 'forbid', 'json_encoders': {<class 'datetime.datetime'>: <function OrmModel.<lambda>>}, 'serialize_by_alias': True, 'title': 'ModelDataAttributesModel', 'validate_by_alias': True, 'validate_by_name': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class ReadModel(**data: Any)¶
Bases:
ReadModelMethods
model_post_init(context, /)This function is meant to behave like a BaseModel method to initialize private attributes.
- __abstractmethods__ = frozenset({})¶
- __annotations__ = {'_AIIDA_MINIMAL_MODEL': 'type[OrmModel] | None', '__class_vars__': 'ClassVar[set[str]]', '__private_attributes__': 'ClassVar[Dict[str, ModelPrivateAttr]]', '__pydantic_complete__': 'ClassVar[bool]', '__pydantic_computed_fields__': 'ClassVar[Dict[str, ComputedFieldInfo]]', '__pydantic_core_schema__': 'ClassVar[CoreSchema]', '__pydantic_custom_init__': 'ClassVar[bool]', '__pydantic_decorators__': 'ClassVar[_decorators.DecoratorInfos]', '__pydantic_extra__': 'Dict[str, Any] | None', '__pydantic_extra_info__': 'ClassVar[PydanticExtraInfo | None]', '__pydantic_fields__': 'ClassVar[Dict[str, FieldInfo]]', '__pydantic_fields_set__': 'set[str]', '__pydantic_generic_metadata__': 'ClassVar[_generics.PydanticGenericMetadata]', '__pydantic_parent_namespace__': 'ClassVar[Dict[str, Any] | None]', '__pydantic_post_init__': "ClassVar[None | Literal['model_post_init']]", '__pydantic_private__': 'Dict[str, Any] | None', '__pydantic_root_model__': 'ClassVar[bool]', '__pydantic_serializer__': 'ClassVar[SchemaSerializer]', '__pydantic_setattr_handlers__': 'ClassVar[Dict[str, Callable[[BaseModel, str, Any], None]]]', '__pydantic_validator__': 'ClassVar[SchemaValidator | PluggableSchemaValidator]', '__signature__': 'ClassVar[Signature]', 'attributes': <class 'aiida_mlip.data.model.ModelData.AttributesModel'>, 'computer': 'int | None', 'ctime': 'datetime.datetime', 'description': 'str', 'extras': 'dict[str, Any]', 'label': 'str', 'model_config': 'ClassVar[ConfigDict]', 'mtime': 'datetime.datetime', 'node_type': typing.Literal['data.mlip.modeldata.ModelData.'], 'pk': 'int', 'process_type': 'str | None', 'repository_metadata': 'dict[str, Any]', 'user': 'int', 'uuid': 'UUID'}¶
- __dict__¶
- __module__ = 'aiida_mlip.data.model'¶
- __private_attributes__: ClassVar[Dict[str, ModelPrivateAttr]] = {'_AIIDA_MINIMAL_MODEL': ModelPrivateAttr()}¶
Metadata about the private attributes of the model.
- __pydantic_complete__: ClassVar[bool] = True¶
Whether model building is completed, or if there are still undefined fields.
- __pydantic_computed_fields__: ClassVar[Dict[str, ComputedFieldInfo]] = {}¶
A dictionary of computed field names and their corresponding [ComputedFieldInfo][pydantic.fields.ComputedFieldInfo] objects.
- __pydantic_core_schema__: ClassVar[CoreSchema] = {'cls': <class 'aiida_mlip.data.model.ModelData.ReadModel'>, 'config': {'extra_fields_behavior': 'forbid', 'serialize_by_alias': True, 'title': 'ModelDataReadModel', 'validate_by_alias': True, 'validate_by_name': True}, 'custom_init': False, 'metadata': {'pydantic_js_functions': [<bound method BaseModel.__get_pydantic_json_schema__ of <class 'aiida_mlip.data.model.ModelData.ReadModel'>>]}, 'post_init': 'model_post_init', 'ref': 'aiida_mlip.data.model.ModelData.ReadModel:383719280', 'root_model': False, 'schema': {'computed_fields': [], 'fields': {'attributes': {'metadata': {'pydantic_js_extra': {}, 'pydantic_js_updates': {'description': 'The node attributes', 'examples': [{'attr_key': 'attr_value'}]}}, 'schema': {'cls': <class 'aiida_mlip.data.model.ModelData.AttributesModel'>, 'config': {'extra_fields_behavior': 'forbid', 'serialize_by_alias': True, 'title': 'ModelDataAttributesModel', 'validate_by_alias': True, 'validate_by_name': True}, 'custom_init': False, 'metadata': {'pydantic_js_functions': [<bound method BaseModel.__get_pydantic_json_schema__ of <class 'aiida_mlip.data.model.ModelData.AttributesModel'>>]}, 'post_init': 'model_post_init', 'ref': 'aiida_mlip.data.model.ModelData.AttributesModel:382855184', 'root_model': False, 'schema': {'computed_fields': [], 'fields': {'filename': {'metadata': {'pydantic_js_extra': {'readOnly': True}, 'pydantic_js_updates': {'description': 'The name of the stored file'}}, 'schema': {'type': 'str'}, 'type': 'model-field'}, 'source': {'metadata': {'pydantic_js_extra': {}, 'pydantic_js_updates': {'description': 'Source of the data'}}, 'schema': {'default': None, 'schema': {'schema': {'keys_schema': {'type': 'any'}, 'type': 'dict', 'values_schema': {'type': 'any'}}, 'type': 'nullable'}, 'type': 'default'}, 'type': 'model-field'}}, 'model_name': 'AttributesModel', 'type': 'model-fields'}, 'type': 'model'}, 'type': 'model-field'}, 'computer': {'metadata': {'pydantic_js_extra': {'readOnly': True}, 'pydantic_js_updates': {'description': 'The PK of the computer', 'examples': [42]}}, 'schema': {'default': None, 'schema': {'schema': {'type': 'int'}, 'type': 'nullable'}, 'type': 'default'}, 'type': 'model-field'}, 'ctime': {'metadata': {'pydantic_js_extra': {'readOnly': True}, 'pydantic_js_updates': {'description': 'The creation time of the node', 'examples': ['2024-01-01T12:00:00+00:00']}}, 'schema': {'microseconds_precision': 'truncate', 'serialization': {'function': <function OrmModel.<lambda>>, 'type': 'function-plain', 'when_used': 'json'}, 'type': 'datetime'}, 'type': 'model-field'}, 'description': {'metadata': {'pydantic_js_extra': {}, 'pydantic_js_updates': {'description': 'The node description', 'examples': ['This is my node description.']}}, 'schema': {'default': '', 'schema': {'type': 'str'}, 'type': 'default'}, 'type': 'model-field'}, 'extras': {'metadata': {'pydantic_js_extra': {}, 'pydantic_js_updates': {'description': 'The node extras', 'examples': [{'extra_key': 'extra_value'}]}}, 'schema': {'default_factory': <class 'dict'>, 'default_factory_takes_data': False, 'schema': {'keys_schema': {'type': 'str'}, 'type': 'dict', 'values_schema': {'type': 'any'}}, 'type': 'default'}, 'type': 'model-field'}, 'label': {'metadata': {'pydantic_js_extra': {}, 'pydantic_js_updates': {'description': 'The node label', 'examples': ['my_node']}}, 'schema': {'default': '', 'schema': {'type': 'str'}, 'type': 'default'}, 'type': 'model-field'}, 'mtime': {'metadata': {'pydantic_js_extra': {'readOnly': True}, 'pydantic_js_updates': {'description': 'The modification time of the node', 'examples': ['2024-01-02T12:00:00+00:00']}}, 'schema': {'microseconds_precision': 'truncate', 'serialization': {'function': <function OrmModel.<lambda>>, 'type': 'function-plain', 'when_used': 'json'}, 'type': 'datetime'}, 'type': 'model-field'}, 'node_type': {'metadata': {'pydantic_js_extra': {}, 'pydantic_js_updates': {'description': 'The type of the node.'}}, 'schema': {'expected': ['data.mlip.modeldata.ModelData.'], 'type': 'literal'}, 'type': 'model-field'}, 'pk': {'metadata': {'pydantic_js_extra': {'readOnly': True}, 'pydantic_js_updates': {'description': 'The primary key of the entity', 'examples': [42]}}, 'schema': {'type': 'int'}, 'type': 'model-field'}, 'process_type': {'metadata': {'pydantic_js_extra': {'readOnly': True}, 'pydantic_js_updates': {'description': 'The process type of the node', 'examples': ['aiida.calculations:arithmetic.add.']}}, 'schema': {'default': None, 'schema': {'schema': {'type': 'str'}, 'type': 'nullable'}, 'type': 'default'}, 'type': 'model-field'}, 'repository_metadata': {'metadata': {'pydantic_js_extra': {}, 'pydantic_js_updates': {'description': 'Virtual hierarchy of the file repository', 'examples': [{'o': {'file.txt': {'k': '<file_hash>'}}}]}}, 'schema': {'default_factory': <class 'dict'>, 'default_factory_takes_data': False, 'schema': {'keys_schema': {'type': 'str'}, 'type': 'dict', 'values_schema': {'type': 'any'}}, 'type': 'default'}, 'type': 'model-field'}, 'user': {'metadata': {'pydantic_js_extra': {'readOnly': True}, 'pydantic_js_updates': {'description': 'The PK of the user who owns the node', 'examples': [7]}}, 'schema': {'type': 'int'}, 'type': 'model-field'}, 'uuid': {'metadata': {'pydantic_js_extra': {'readOnly': True}, 'pydantic_js_updates': {'description': 'The UUID of the node', 'examples': ['123e4567-e89b-12d3-a456-426614174000']}}, 'schema': {'type': 'uuid'}, 'type': 'model-field'}}, 'model_name': 'ReadModel', 'type': 'model-fields'}, 'type': 'model'}¶
The core schema of the model.
- __pydantic_decorators__: ClassVar[_decorators.DecoratorInfos] = DecoratorInfos(validators={}, field_validators={}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})¶
Metadata containing the decorators defined on the model. This replaces Model.__validators__ and Model.__root_validators__ from Pydantic V1.
- __pydantic_extra__: Dict[str, Any] | None¶
A dictionary containing extra values, if [extra][pydantic.config.ConfigDict.extra] is set to ‘allow’.
- __pydantic_extra_info__: ClassVar[PydanticExtraInfo | None] = None¶
A wrapper around the __pydantic_extra__ annotation, if explicitly annotated on a model.
This is a private attribute, not meant to be used outside Pydantic.
- __pydantic_fields__: ClassVar[Dict[str, FieldInfo]] = {'attributes': FieldInfo(annotation=ModelData.AttributesModel, required=True, description='The node attributes', examples=[{'attr_key': 'attr_value'}], json_schema_extra={}, metadata=[{'priority': 0}, {'read_only': False}, {'write_only': False}, {'may_be_large': True}]), 'computer': FieldInfo(annotation=Union[int, NoneType], required=False, default=None, description='The PK of the computer', examples=[42], json_schema_extra={'readOnly': True}, metadata=[{'priority': 0}, {'read_only': True}, {'write_only': False}, {'may_be_large': False}, {'orm_class': <class 'aiida.orm.computers.Computer'>}, {'orm_to_model': <function Node.ReadModel.<lambda>>}]), 'ctime': FieldInfo(annotation=datetime, required=True, description='The creation time of the node', examples=['2024-01-01T12:00:00+00:00'], json_schema_extra={'readOnly': True}, metadata=[{'priority': 0}, {'read_only': True}, {'write_only': False}, {'may_be_large': False}]), 'description': FieldInfo(annotation=str, required=False, default='', description='The node description', examples=['This is my node description.'], json_schema_extra={}, metadata=[{'priority': 0}, {'read_only': False}, {'write_only': False}, {'may_be_large': False}]), 'extras': FieldInfo(annotation=dict[str, Any], required=False, default_factory=dict, description='The node extras', examples=[{'extra_key': 'extra_value'}], json_schema_extra={}, metadata=[{'priority': 0}, {'read_only': False}, {'write_only': False}, {'may_be_large': True}, {'orm_to_model': <function Node.MutableNodeFields.<lambda>>}]), 'label': FieldInfo(annotation=str, required=False, default='', description='The node label', examples=['my_node'], json_schema_extra={}, metadata=[{'priority': 0}, {'read_only': False}, {'write_only': False}, {'may_be_large': False}]), 'mtime': FieldInfo(annotation=datetime, required=True, description='The modification time of the node', examples=['2024-01-02T12:00:00+00:00'], json_schema_extra={'readOnly': True}, metadata=[{'priority': 0}, {'read_only': True}, {'write_only': False}, {'may_be_large': False}]), 'node_type': FieldInfo(annotation=Literal['data.mlip.modeldata.ModelData.'], required=True, description='The type of the node.', json_schema_extra={}, metadata=[{'priority': 0}, {'read_only': False}, {'write_only': False}, {'may_be_large': False}]), 'pk': FieldInfo(annotation=int, required=True, description='The primary key of the entity', examples=[42], json_schema_extra={'readOnly': True}, metadata=[{'priority': 0}, {'read_only': True}, {'write_only': False}, {'may_be_large': False}]), 'process_type': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='The process type of the node', examples=['aiida.calculations:arithmetic.add.'], json_schema_extra={'readOnly': True}, metadata=[{'priority': 0}, {'read_only': True}, {'write_only': False}, {'may_be_large': False}]), 'repository_metadata': FieldInfo(annotation=dict[str, Any], required=False, default_factory=dict, description='Virtual hierarchy of the file repository', examples=[{'o': {'file.txt': {'k': '<file_hash>'}}}], json_schema_extra={}, metadata=[{'priority': 0}, {'read_only': False}, {'write_only': False}, {'may_be_large': True}, {'orm_to_model': <function Node.WritableFields.<lambda>>}]), 'user': FieldInfo(annotation=int, required=True, description='The PK of the user who owns the node', examples=[7], json_schema_extra={'readOnly': True}, metadata=[{'priority': 0}, {'read_only': True}, {'write_only': False}, {'may_be_large': False}, {'orm_class': <class 'aiida.orm.users.User'>}, {'orm_to_model': <function Node.ReadModel.<lambda>>}]), 'uuid': FieldInfo(annotation=UUID, required=True, description='The UUID of the node', examples=['123e4567-e89b-12d3-a456-426614174000'], json_schema_extra={'readOnly': True}, metadata=[{'priority': 0}, {'read_only': True}, {'write_only': False}, {'may_be_large': False}])}¶
A dictionary of field names and their corresponding [FieldInfo][pydantic.fields.FieldInfo] objects. This replaces Model.__fields__ from Pydantic V1.
- __pydantic_generic_metadata__: ClassVar[_generics.PydanticGenericMetadata] = {'args': (), 'origin': None, 'parameters': ()}¶
A dictionary containing metadata about generic Pydantic models.
The origin and args items map to the [__origin__][genericalias.__origin__] and [__args__][genericalias.__args__] attributes of [generic aliases][types-genericalias], and the parameter item maps to the __parameter__ attribute of generic classes.
- __pydantic_post_init__: ClassVar[None | Literal['model_post_init']] = 'model_post_init'¶
The name of the post-init method for the model, if defined.
- __pydantic_private__: Dict[str, Any] | None¶
Values of private attributes set on the model instance.
- __pydantic_serializer__: ClassVar[SchemaSerializer] = SchemaSerializer(serializer=PolymorphismTrampoline( PolymorphismTrampoline { class: Py( 0x0000000016df1770, ), serializer: PolymorphismTrampoline( PolymorphismTrampoline { class: Py( 0x0000000016df1770, ), serializer: Model( ModelSerializer { class: Py( 0x0000000016df1770, ), serializer: Fields( GeneralFieldsSerializer { fields: { "description": SerField { key: "description", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x0000000000b3c3f0, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, serialize_by_alias: Some( true, ), serialization_exclude_if: None, }, "extras": SerField { key: "extras", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: DefaultFactory( Py( 0x0000000000a3d840, ), false, ), serializer: Dict( DictSerializer { key_serializer: Str( StrSerializer, ), value_serializer: Any( AnySerializer, ), filter: SchemaFilter { include: None, exclude: None, }, name: "dict[str, any]", }, ), }, ), ), required: true, serialize_by_alias: Some( true, ), serialization_exclude_if: None, }, "label": SerField { key: "label", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x0000000000b3c3f0, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, serialize_by_alias: Some( true, ), serialization_exclude_if: None, }, "mtime": SerField { key: "mtime", alias: None, serializer: Some( Function( FunctionPlainSerializer { func: Py( 0x00007f11019c5440, ), name: "plain_function[<lambda>]", function_name: "<lambda>", return_serializer: Any( AnySerializer, ), fallback_serializer: Some( Datetime( DatetimeSerializer { temporal_mode: Iso8601, }, ), ), when_used: Json, is_field_serializer: false, info_arg: false, }, ), ), required: true, serialize_by_alias: Some( true, ), serialization_exclude_if: None, }, "computer": SerField { key: "computer", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x0000000000a408a0, ), ), serializer: Nullable( NullableSerializer { serializer: Int( IntSerializer, ), }, ), }, ), ), required: true, serialize_by_alias: Some( true, ), serialization_exclude_if: None, }, "pk": SerField { key: "pk", alias: None, serializer: Some( Int( IntSerializer, ), ), required: true, serialize_by_alias: Some( true, ), serialization_exclude_if: None, }, "node_type": SerField { key: "node_type", alias: None, serializer: Some( Literal( LiteralSerializer { expected_int: {}, expected_str: { "data.mlip.modeldata.ModelData.", }, expected_py: None, name: "literal['data.mlip.modeldata.ModelData.']", }, ), ), required: true, serialize_by_alias: Some( true, ), serialization_exclude_if: None, }, "user": SerField { key: "user", alias: None, serializer: Some( Int( IntSerializer, ), ), required: true, serialize_by_alias: Some( true, ), serialization_exclude_if: None, }, "attributes": SerField { key: "attributes", alias: None, serializer: Some( PolymorphismTrampoline( PolymorphismTrampoline { class: Py( 0x0000000016d1e810, ), serializer: Prebuilt( PrebuiltSerializer { schema_serializer: Py( 0x00007f10dcdb2dd0, ), }, ), enabled_from_config: false, }, ), ), required: true, serialize_by_alias: Some( true, ), serialization_exclude_if: None, }, "uuid": SerField { key: "uuid", alias: None, serializer: Some( Uuid( UuidSerializer, ), ), required: true, serialize_by_alias: Some( true, ), serialization_exclude_if: None, }, "process_type": SerField { key: "process_type", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x0000000000a408a0, ), ), serializer: Nullable( NullableSerializer { serializer: Str( StrSerializer, ), }, ), }, ), ), required: true, serialize_by_alias: Some( true, ), serialization_exclude_if: None, }, "repository_metadata": SerField { key: "repository_metadata", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: DefaultFactory( Py( 0x0000000000a3d840, ), false, ), serializer: Dict( DictSerializer { key_serializer: Str( StrSerializer, ), value_serializer: Any( AnySerializer, ), filter: SchemaFilter { include: None, exclude: None, }, name: "dict[str, any]", }, ), }, ), ), required: true, serialize_by_alias: Some( true, ), serialization_exclude_if: None, }, "ctime": SerField { key: "ctime", alias: None, serializer: Some( Function( FunctionPlainSerializer { func: Py( 0x00007f11019c5440, ), name: "plain_function[<lambda>]", function_name: "<lambda>", return_serializer: Any( AnySerializer, ), fallback_serializer: Some( Datetime( DatetimeSerializer { temporal_mode: Iso8601, }, ), ), when_used: Json, is_field_serializer: false, info_arg: false, }, ), ), required: true, serialize_by_alias: Some( true, ), serialization_exclude_if: None, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 13, }, ), has_extra: false, root_model: false, name: "ReadModel", }, ), enabled_from_config: false, }, ), enabled_from_config: false, }, ), definitions=[])¶
The pydantic-core SchemaSerializer used to dump instances of the model.
- __pydantic_setattr_handlers__: ClassVar[Dict[str, Callable[[BaseModel, str, Any], None]]] = {}¶
__setattr__ handlers. Memoizing the handlers leads to a dramatic performance improvement in __setattr__
- __pydantic_validator__: ClassVar[SchemaValidator | PluggableSchemaValidator] = SchemaValidator(title="ModelDataReadModel", validator=Model( ModelValidator { revalidate: Never, validator: ModelFields( ModelFieldsValidator { fields: [ Field { name: "pk", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "pk", ), rest: [], }, by_alias: [], }, validator: Int( IntValidator { strict: false, }, ), frozen: false, }, Field { name: "label", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "label", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x0000000000b3c3f0, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1102f788b0, ), }, ), frozen: false, }, Field { name: "description", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "description", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x0000000000b3c3f0, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1102f788b0, ), }, ), frozen: false, }, Field { name: "extras", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "extras", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: DefaultFactory( Py( 0x0000000000a3d840, ), false, ), on_error: Raise, validator: Dict( DictValidator { strict: false, key_validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), value_validator: Any( AnyValidator, ), min_length: None, max_length: None, fail_fast: false, name: "dict[str,any]", }, ), validate_default: false, copy_default: false, name: "default[dict[str,any]]", undefined: Py( 0x00007f1102f788b0, ), }, ), frozen: false, }, Field { name: "node_type", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "node_type", ), rest: [], }, by_alias: [], }, validator: Literal( LiteralValidator { lookup: LiteralLookup { expected_bool: None, expected_int: None, expected_str: Some( { "data.mlip.modeldata.ModelData.": 0, }, ), expected_py_dict: None, expected_py_values: None, expected_py_primitives: Some( Py( 0x00007f10dcd7d9c0, ), ), values: [ Py( 0x00007f10de92f280, ), ], }, expected_repr: "'data.mlip.modeldata.ModelData.'", name: "literal['data.mlip.modeldata.ModelData.']", }, ), frozen: false, }, Field { name: "attributes", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "attributes", ), rest: [], }, by_alias: [], }, validator: Prebuilt( PrebuiltValidator { schema_validator: Py( 0x00007f10dcdb1d80, ), }, ), frozen: false, }, Field { name: "repository_metadata", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "repository_metadata", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: DefaultFactory( Py( 0x0000000000a3d840, ), false, ), on_error: Raise, validator: Dict( DictValidator { strict: false, key_validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), value_validator: Any( AnyValidator, ), min_length: None, max_length: None, fail_fast: false, name: "dict[str,any]", }, ), validate_default: false, copy_default: false, name: "default[dict[str,any]]", undefined: Py( 0x00007f1102f788b0, ), }, ), frozen: false, }, Field { name: "uuid", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "uuid", ), rest: [], }, by_alias: [], }, validator: Uuid( UuidValidator { strict: false, version: None, }, ), frozen: false, }, Field { name: "process_type", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "process_type", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x0000000000a408a0, ), ), on_error: Raise, validator: Nullable( NullableValidator { validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), name: "nullable[str]", }, ), validate_default: false, copy_default: false, name: "default[nullable[str]]", undefined: Py( 0x00007f1102f788b0, ), }, ), frozen: false, }, Field { name: "ctime", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "ctime", ), rest: [], }, by_alias: [], }, validator: Datetime( DateTimeValidator { strict: false, constraints: None, microseconds_precision: Truncate, val_temporal_unit: Infer, }, ), frozen: false, }, Field { name: "mtime", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "mtime", ), rest: [], }, by_alias: [], }, validator: Datetime( DateTimeValidator { strict: false, constraints: None, microseconds_precision: Truncate, val_temporal_unit: Infer, }, ), frozen: false, }, Field { name: "computer", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "computer", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x0000000000a408a0, ), ), on_error: Raise, validator: Nullable( NullableValidator { validator: Int( IntValidator { strict: false, }, ), name: "nullable[int]", }, ), validate_default: false, copy_default: false, name: "default[nullable[int]]", undefined: Py( 0x00007f1102f788b0, ), }, ), frozen: false, }, Field { name: "user", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "user", ), rest: [], }, by_alias: [], }, validator: Int( IntValidator { strict: false, }, ), frozen: false, }, ], model_name: "ReadModel", extra_behavior: Forbid, extras_validator: None, extras_keys_validator: None, strict: false, from_attributes: false, loc_by_alias: true, lookup: LookupTree { inner: { PathItemString( "process_type", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 8, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "node_type", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 4, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "attributes", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 5, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "computer", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 11, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "label", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 1, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "pk", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 0, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "repository_metadata", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 6, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "uuid", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 7, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "description", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 2, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "extras", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 3, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "ctime", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 9, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "mtime", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 10, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "user", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 12, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, }, }, validate_by_alias: Some( true, ), validate_by_name: Some( true, ), }, ), class: Py( 0x0000000016df1770, ), generic_origin: None, post_init: Some( Py( 0x00007f1101d1c530, ), ), frozen: false, custom_init: false, root_model: false, undefined: Py( 0x00007f1102f788b0, ), name: "ReadModel", }, ), definitions=[], cache_strings=True)¶
The pydantic-core SchemaValidator used to validate instances of the model.
- _abc_impl = <_abc._abc_data object>¶
- attributes: AttributesModel¶
- model_config: ClassVar[ConfigDict] = {'defer_build': True, 'extra': 'forbid', 'json_encoders': {<class 'datetime.datetime'>: <function OrmModel.<lambda>>}, 'serialize_by_alias': True, 'title': 'ModelDataReadModel', 'validate_by_alias': True, 'validate_by_name': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class WriteModel(**data: Any)¶
Bases:
WriteModelMethods
model_post_init(context, /)This function is meant to behave like a BaseModel method to initialize private attributes.
- __abstractmethods__ = frozenset({})¶
- __annotations__ = {'_AIIDA_MINIMAL_MODEL': 'type[OrmModel] | None', '__class_vars__': 'ClassVar[set[str]]', '__private_attributes__': 'ClassVar[Dict[str, ModelPrivateAttr]]', '__pydantic_complete__': 'ClassVar[bool]', '__pydantic_computed_fields__': 'ClassVar[Dict[str, ComputedFieldInfo]]', '__pydantic_core_schema__': 'ClassVar[CoreSchema]', '__pydantic_custom_init__': 'ClassVar[bool]', '__pydantic_decorators__': 'ClassVar[_decorators.DecoratorInfos]', '__pydantic_extra__': 'Dict[str, Any] | None', '__pydantic_extra_info__': 'ClassVar[PydanticExtraInfo | None]', '__pydantic_fields__': 'ClassVar[Dict[str, FieldInfo]]', '__pydantic_fields_set__': 'set[str]', '__pydantic_generic_metadata__': 'ClassVar[_generics.PydanticGenericMetadata]', '__pydantic_parent_namespace__': 'ClassVar[Dict[str, Any] | None]', '__pydantic_post_init__': "ClassVar[None | Literal['model_post_init']]", '__pydantic_private__': 'Dict[str, Any] | None', '__pydantic_root_model__': 'ClassVar[bool]', '__pydantic_serializer__': 'ClassVar[SchemaSerializer]', '__pydantic_setattr_handlers__': 'ClassVar[Dict[str, Callable[[BaseModel, str, Any], None]]]', '__pydantic_validator__': 'ClassVar[SchemaValidator | PluggableSchemaValidator]', '__signature__': 'ClassVar[Signature]', 'attributes': <class 'aiida_mlip.data.model.WriteModelData.AttributesWriteModel'>, 'description': <class 'str'>, 'extras': dict[str, typing.Any], 'label': <class 'str'>, 'model_config': 'ClassVar[ConfigDict]', 'node_type': typing.Literal['data.mlip.modeldata.ModelData.'], 'repository_metadata': dict[str, typing.Any]}¶
- __dict__¶
- __module__ = 'aiida_mlip.data.model'¶
- __private_attributes__: ClassVar[Dict[str, ModelPrivateAttr]] = {'_AIIDA_MINIMAL_MODEL': ModelPrivateAttr()}¶
Metadata about the private attributes of the model.
- __pydantic_complete__: ClassVar[bool] = True¶
Whether model building is completed, or if there are still undefined fields.
- __pydantic_computed_fields__: ClassVar[Dict[str, ComputedFieldInfo]] = {}¶
A dictionary of computed field names and their corresponding [ComputedFieldInfo][pydantic.fields.ComputedFieldInfo] objects.
- __pydantic_core_schema__: ClassVar[CoreSchema] = {'cls': <class 'aiida_mlip.data.model.ModelData.WriteModel'>, 'config': {'extra_fields_behavior': 'forbid', 'serialize_by_alias': True, 'title': 'ModelDataWriteModel', 'validate_by_alias': True, 'validate_by_name': True}, 'custom_init': False, 'metadata': {'pydantic_js_functions': [<bound method BaseModel.__get_pydantic_json_schema__ of <class 'aiida_mlip.data.model.ModelData.WriteModel'>>]}, 'post_init': 'model_post_init', 'ref': 'aiida_mlip.data.model.ModelData.WriteModel:378700160', 'root_model': False, 'schema': {'computed_fields': [], 'fields': {'attributes': {'metadata': {'pydantic_js_extra': {}, 'pydantic_js_updates': {'description': 'The node attributes', 'examples': [{'attr_key': 'attr_value'}]}}, 'schema': {'cls': <class 'aiida_mlip.data.model.WriteModelData.AttributesWriteModel'>, 'config': {'extra_fields_behavior': 'forbid', 'serialize_by_alias': True, 'title': 'WriteModelDataAttributesWriteModel', 'validate_by_alias': True, 'validate_by_name': True}, 'custom_init': False, 'metadata': {'pydantic_js_functions': [<bound method BaseModel.__get_pydantic_json_schema__ of <class 'aiida_mlip.data.model.WriteModelData.AttributesWriteModel'>>]}, 'post_init': 'model_post_init', 'ref': 'aiida_mlip.data.model.WriteModelData.AttributesWriteModel:381953584', 'root_model': False, 'schema': {'computed_fields': [], 'fields': {'source': {'metadata': {'pydantic_js_extra': {}, 'pydantic_js_updates': {'description': 'Source of the data'}}, 'schema': {'default': None, 'schema': {'schema': {'keys_schema': {'type': 'any'}, 'type': 'dict', 'values_schema': {'type': 'any'}}, 'type': 'nullable'}, 'type': 'default'}, 'type': 'model-field'}}, 'model_name': 'AttributesWriteModel', 'type': 'model-fields'}, 'type': 'model'}, 'type': 'model-field'}, 'description': {'metadata': {'pydantic_js_extra': {}, 'pydantic_js_updates': {'description': 'The node description', 'examples': ['This is my node description.']}}, 'schema': {'default': '', 'schema': {'type': 'str'}, 'type': 'default'}, 'type': 'model-field'}, 'extras': {'metadata': {'pydantic_js_extra': {}, 'pydantic_js_updates': {'description': 'The node extras', 'examples': [{'extra_key': 'extra_value'}]}}, 'schema': {'default_factory': <class 'dict'>, 'default_factory_takes_data': False, 'schema': {'keys_schema': {'type': 'str'}, 'type': 'dict', 'values_schema': {'type': 'any'}}, 'type': 'default'}, 'type': 'model-field'}, 'label': {'metadata': {'pydantic_js_extra': {}, 'pydantic_js_updates': {'description': 'The node label', 'examples': ['my_node']}}, 'schema': {'default': '', 'schema': {'type': 'str'}, 'type': 'default'}, 'type': 'model-field'}, 'node_type': {'metadata': {'pydantic_js_extra': {}, 'pydantic_js_updates': {'description': 'The type of the node.'}}, 'schema': {'expected': ['data.mlip.modeldata.ModelData.'], 'type': 'literal'}, 'type': 'model-field'}, 'repository_metadata': {'metadata': {'pydantic_js_extra': {}, 'pydantic_js_updates': {'description': 'Virtual hierarchy of the file repository', 'examples': [{'o': {'file.txt': {'k': '<file_hash>'}}}]}}, 'schema': {'default_factory': <class 'dict'>, 'default_factory_takes_data': False, 'schema': {'keys_schema': {'type': 'str'}, 'type': 'dict', 'values_schema': {'type': 'any'}}, 'type': 'default'}, 'type': 'model-field'}}, 'model_name': 'WriteModel', 'type': 'model-fields'}, 'type': 'model'}¶
The core schema of the model.
- __pydantic_decorators__: ClassVar[_decorators.DecoratorInfos] = DecoratorInfos(validators={}, field_validators={}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})¶
Metadata containing the decorators defined on the model. This replaces Model.__validators__ and Model.__root_validators__ from Pydantic V1.
- __pydantic_extra__: Dict[str, Any] | None¶
A dictionary containing extra values, if [extra][pydantic.config.ConfigDict.extra] is set to ‘allow’.
- __pydantic_extra_info__: ClassVar[PydanticExtraInfo | None] = None¶
A wrapper around the __pydantic_extra__ annotation, if explicitly annotated on a model.
This is a private attribute, not meant to be used outside Pydantic.
- __pydantic_fields__: ClassVar[Dict[str, FieldInfo]] = {'attributes': FieldInfo(annotation=WriteModelData.AttributesWriteModel, required=True, description='The node attributes', examples=[{'attr_key': 'attr_value'}], json_schema_extra={}, metadata=[{'priority': 0}, {'read_only': False}, {'write_only': False}, {'may_be_large': True}]), 'description': FieldInfo(annotation=str, required=False, default='', description='The node description', examples=['This is my node description.'], json_schema_extra={}, metadata=[{'priority': 0}, {'read_only': False}, {'write_only': False}, {'may_be_large': False}]), 'extras': FieldInfo(annotation=dict[str, Any], required=False, default_factory=dict, description='The node extras', examples=[{'extra_key': 'extra_value'}], json_schema_extra={}, metadata=[{'priority': 0}, {'read_only': False}, {'write_only': False}, {'may_be_large': True}, {'orm_to_model': <function Node.MutableNodeFields.<lambda>>}]), 'label': FieldInfo(annotation=str, required=False, default='', description='The node label', examples=['my_node'], json_schema_extra={}, metadata=[{'priority': 0}, {'read_only': False}, {'write_only': False}, {'may_be_large': False}]), 'node_type': FieldInfo(annotation=Literal['data.mlip.modeldata.ModelData.'], required=True, description='The type of the node.', json_schema_extra={}, metadata=[{'priority': 0}, {'read_only': False}, {'write_only': False}, {'may_be_large': False}]), 'repository_metadata': FieldInfo(annotation=dict[str, Any], required=False, default_factory=dict, description='Virtual hierarchy of the file repository', examples=[{'o': {'file.txt': {'k': '<file_hash>'}}}], json_schema_extra={}, metadata=[{'priority': 0}, {'read_only': False}, {'write_only': False}, {'may_be_large': True}, {'orm_to_model': <function Node.WritableFields.<lambda>>}])}¶
A dictionary of field names and their corresponding [FieldInfo][pydantic.fields.FieldInfo] objects. This replaces Model.__fields__ from Pydantic V1.
- __pydantic_generic_metadata__: ClassVar[_generics.PydanticGenericMetadata] = {'args': (), 'origin': None, 'parameters': ()}¶
A dictionary containing metadata about generic Pydantic models.
The origin and args items map to the [__origin__][genericalias.__origin__] and [__args__][genericalias.__args__] attributes of [generic aliases][types-genericalias], and the parameter item maps to the __parameter__ attribute of generic classes.
- __pydantic_post_init__: ClassVar[None | Literal['model_post_init']] = 'model_post_init'¶
The name of the post-init method for the model, if defined.
- __pydantic_private__: Dict[str, Any] | None¶
Values of private attributes set on the model instance.
- __pydantic_serializer__: ClassVar[SchemaSerializer] = SchemaSerializer(serializer=PolymorphismTrampoline( PolymorphismTrampoline { class: Py( 0x0000000016928180, ), serializer: PolymorphismTrampoline( PolymorphismTrampoline { class: Py( 0x0000000016928180, ), serializer: Model( ModelSerializer { class: Py( 0x0000000016928180, ), serializer: Fields( GeneralFieldsSerializer { fields: { "description": SerField { key: "description", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x0000000000b3c3f0, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, serialize_by_alias: Some( true, ), serialization_exclude_if: None, }, "extras": SerField { key: "extras", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: DefaultFactory( Py( 0x0000000000a3d840, ), false, ), serializer: Dict( DictSerializer { key_serializer: Str( StrSerializer, ), value_serializer: Any( AnySerializer, ), filter: SchemaFilter { include: None, exclude: None, }, name: "dict[str, any]", }, ), }, ), ), required: true, serialize_by_alias: Some( true, ), serialization_exclude_if: None, }, "repository_metadata": SerField { key: "repository_metadata", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: DefaultFactory( Py( 0x0000000000a3d840, ), false, ), serializer: Dict( DictSerializer { key_serializer: Str( StrSerializer, ), value_serializer: Any( AnySerializer, ), filter: SchemaFilter { include: None, exclude: None, }, name: "dict[str, any]", }, ), }, ), ), required: true, serialize_by_alias: Some( true, ), serialization_exclude_if: None, }, "attributes": SerField { key: "attributes", alias: None, serializer: Some( PolymorphismTrampoline( PolymorphismTrampoline { class: Py( 0x0000000016c42630, ), serializer: PolymorphismTrampoline( PolymorphismTrampoline { class: Py( 0x0000000016c42630, ), serializer: Model( ModelSerializer { class: Py( 0x0000000016c42630, ), serializer: Fields( GeneralFieldsSerializer { fields: { "source": SerField { key: "source", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x0000000000a408a0, ), ), serializer: Nullable( NullableSerializer { serializer: Dict( DictSerializer { key_serializer: Any( AnySerializer, ), value_serializer: Any( AnySerializer, ), filter: SchemaFilter { include: None, exclude: None, }, name: "dict[any, any]", }, ), }, ), }, ), ), required: true, serialize_by_alias: Some( true, ), serialization_exclude_if: None, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 1, }, ), has_extra: false, root_model: false, name: "AttributesWriteModel", }, ), enabled_from_config: false, }, ), enabled_from_config: false, }, ), ), required: true, serialize_by_alias: Some( true, ), serialization_exclude_if: None, }, "label": SerField { key: "label", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x0000000000b3c3f0, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, serialize_by_alias: Some( true, ), serialization_exclude_if: None, }, "node_type": SerField { key: "node_type", alias: None, serializer: Some( Literal( LiteralSerializer { expected_int: {}, expected_str: { "data.mlip.modeldata.ModelData.", }, expected_py: None, name: "literal['data.mlip.modeldata.ModelData.']", }, ), ), required: true, serialize_by_alias: Some( true, ), serialization_exclude_if: None, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 6, }, ), has_extra: false, root_model: false, name: "WriteModel", }, ), enabled_from_config: false, }, ), enabled_from_config: false, }, ), definitions=[])¶
The pydantic-core SchemaSerializer used to dump instances of the model.
- __pydantic_setattr_handlers__: ClassVar[Dict[str, Callable[[BaseModel, str, Any], None]]] = {}¶
__setattr__ handlers. Memoizing the handlers leads to a dramatic performance improvement in __setattr__
- __pydantic_validator__: ClassVar[SchemaValidator | PluggableSchemaValidator] = SchemaValidator(title="ModelDataWriteModel", validator=Model( ModelValidator { revalidate: Never, validator: ModelFields( ModelFieldsValidator { fields: [ Field { name: "label", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "label", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x0000000000b3c3f0, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1102f788b0, ), }, ), frozen: false, }, Field { name: "description", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "description", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x0000000000b3c3f0, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1102f788b0, ), }, ), frozen: false, }, Field { name: "extras", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "extras", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: DefaultFactory( Py( 0x0000000000a3d840, ), false, ), on_error: Raise, validator: Dict( DictValidator { strict: false, key_validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), value_validator: Any( AnyValidator, ), min_length: None, max_length: None, fail_fast: false, name: "dict[str,any]", }, ), validate_default: false, copy_default: false, name: "default[dict[str,any]]", undefined: Py( 0x00007f1102f788b0, ), }, ), frozen: false, }, Field { name: "node_type", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "node_type", ), rest: [], }, by_alias: [], }, validator: Literal( LiteralValidator { lookup: LiteralLookup { expected_bool: None, expected_int: None, expected_str: Some( { "data.mlip.modeldata.ModelData.": 0, }, ), expected_py_dict: None, expected_py_values: None, expected_py_primitives: Some( Py( 0x00007f10dca09a80, ), ), values: [ Py( 0x00007f10de92f280, ), ], }, expected_repr: "'data.mlip.modeldata.ModelData.'", name: "literal['data.mlip.modeldata.ModelData.']", }, ), frozen: false, }, Field { name: "attributes", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "attributes", ), rest: [], }, by_alias: [], }, validator: Model( ModelValidator { revalidate: Never, validator: ModelFields( ModelFieldsValidator { fields: [ Field { name: "source", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "source", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x0000000000a408a0, ), ), on_error: Raise, validator: Nullable( NullableValidator { validator: Dict( DictValidator { strict: false, key_validator: Any( AnyValidator, ), value_validator: Any( AnyValidator, ), min_length: None, max_length: None, fail_fast: false, name: "dict[any,any]", }, ), name: "nullable[dict[any,any]]", }, ), validate_default: false, copy_default: false, name: "default[nullable[dict[any,any]]]", undefined: Py( 0x00007f1102f788b0, ), }, ), frozen: false, }, ], model_name: "AttributesWriteModel", extra_behavior: Forbid, extras_validator: None, extras_keys_validator: None, strict: false, from_attributes: false, loc_by_alias: true, lookup: LookupTree { inner: { PathItemString( "source", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 0, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, }, }, validate_by_alias: Some( true, ), validate_by_name: Some( true, ), }, ), class: Py( 0x0000000016c42630, ), generic_origin: None, post_init: Some( Py( 0x00007f1101d1c530, ), ), frozen: false, custom_init: false, root_model: false, undefined: Py( 0x00007f1102f788b0, ), name: "AttributesWriteModel", }, ), frozen: false, }, Field { name: "repository_metadata", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "repository_metadata", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: DefaultFactory( Py( 0x0000000000a3d840, ), false, ), on_error: Raise, validator: Dict( DictValidator { strict: false, key_validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), value_validator: Any( AnyValidator, ), min_length: None, max_length: None, fail_fast: false, name: "dict[str,any]", }, ), validate_default: false, copy_default: false, name: "default[dict[str,any]]", undefined: Py( 0x00007f1102f788b0, ), }, ), frozen: false, }, ], model_name: "WriteModel", extra_behavior: Forbid, extras_validator: None, extras_keys_validator: None, strict: false, from_attributes: false, loc_by_alias: true, lookup: LookupTree { inner: { PathItemString( "repository_metadata", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 5, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "attributes", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 4, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "label", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 0, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "description", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 1, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "node_type", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 3, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "extras", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 2, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, }, }, validate_by_alias: Some( true, ), validate_by_name: Some( true, ), }, ), class: Py( 0x0000000016928180, ), generic_origin: None, post_init: Some( Py( 0x00007f1101d1c530, ), ), frozen: false, custom_init: false, root_model: false, undefined: Py( 0x00007f1102f788b0, ), name: "WriteModel", }, ), definitions=[], cache_strings=True)¶
The pydantic-core SchemaValidator used to validate instances of the model.
- _abc_impl = <_abc._abc_data object>¶
- attributes: AttributesWriteModel¶
- model_config: ClassVar[ConfigDict] = {'defer_build': True, 'extra': 'forbid', 'json_encoders': {<class 'datetime.datetime'>: <function OrmModel.<lambda>>}, 'serialize_by_alias': True, 'title': 'ModelDataWriteModel', 'validate_by_alias': True, 'validate_by_name': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- _COMPAT_MODEL¶
alias of
Model
- _ConstructorModel¶
alias of
ConstructorModel
- _MODEL_MAP: ClassVar[dict[str, type[OrmModel]]] = {'read': <class 'aiida_mlip.data.model.ModelData.ReadModel'>, 'write': <class 'aiida_mlip.data.model.ModelData.WriteModel'>}¶
- __abstractmethods__ = frozenset({})¶
- __annotations__ = {'_CLS_COLLECTION': 'type[CollectionType]', '_COMPAT_MODEL': 'ClassVar[type[OrmModel] | None]', '_CliModel': 'ClassVar[type[OrmModel] | None]', '_ConstructorModel': 'ClassVar[type[BaseNodeModel] | None]', '_MODEL_MAP': 'ClassVar[dict[str, type[OrmModel]]]', '__plugin_type_string': 'ClassVar[str]', '__query_type_string': 'ClassVar[str]', '_export_format_replacements': 'dict[str, str]', '_hash_ignored_attributes': 'tuple[str, ...]', '_logger': 'AiidaLoggerType', '_updatable_attributes': 'tuple[str, ...]', 'fields': 'ClassVar[QbFields]'}¶
- __init__(file: str | Path, architecture: str, filename: str | None = None, **kwargs: Any) None[source]¶
Initialize the ModelData object.
- Parameters:
- filestr | Path
Absolute path to the file.
- architecturestr
Architecture of the mlip model.
- filenamestr | None
Name to be used for the file. Default is the name of provided file.
- Other Parameters:
- **kwargsAny
Additional keyword arguments.
- __module__ = 'aiida_mlip.data.model'¶
- __parameters__ = ()¶
- _abc_impl = <_abc._abc_data object>¶
- static _calculate_hash(file: str | Path) str[source]¶
Calculate the hash of a file.
- Parameters:
- filestr | Path
Path to the file for which hash needs to be calculated.
- Returns:
- str
The SHA-256 hash of the file.
- _logger: AiidaLoggerType = <Logger aiida_mlip.data.model.ModelData (WARNING)>¶
- fields: ClassVar[QbFields] = {'attributes': "QbAttributesField('attributes', dtype=<class 'aiida_mlip.data.model.ModelData.AttributesModel'>, doc='The node attributes')", 'computer': "QbNumericField('computer', dtype=int | None, doc='The PK of the computer')", 'ctime': "QbNumericField('ctime', dtype=<class 'datetime.datetime'>, doc='The creation time of the node')", 'description': "QbStrField('description', dtype=<class 'str'>, doc='The node description')", 'extras': "QbDictField('extras', dtype=dict[str, typing.Any], doc='The node extras')", 'filename': "QbStrField('attributes.filename', dtype=<class 'str'>, doc='The name of the stored file')", 'label': "QbStrField('label', dtype=<class 'str'>, doc='The node label')", 'mtime': "QbNumericField('mtime', dtype=<class 'datetime.datetime'>, doc='The modification time of the node')", 'node_type': "QbStrField('node_type', dtype=typing.Literal['data.mlip.modeldata.ModelData.'], doc='The type of the node.')", 'pk': "QbNumericField('pk', dtype=<class 'int'>, doc='The primary key of the entity')", 'process_type': "QbStrField('process_type', dtype=str | None, doc='The process type of the node')", 'repository_metadata': "QbDictField('repository_metadata', dtype=dict[str, typing.Any], doc='Virtual hierarchy of the file repository')", 'source': "QbDictField('attributes.source', dtype=dict | None, doc='Source of the data')", 'user': "QbNumericField('user', dtype=<class 'int'>, doc='The PK of the user who owns the node')", 'uuid': "QbStrField('uuid', dtype=<class 'uuid.UUID'>, doc='The UUID of the node')"}¶
- classmethod from_local(file: str | Path, architecture: str, filename: str | None = None)[source]¶
Create a ModelData instance from a local file.
- Parameters:
- filestr | Path
Path to the file.
- architecturestr
Architecture of the mlip model.
- filenamestr | None
Name to be used for the file. Default is the name of provided file.
- Returns:
- ModelData
A ModelData instance.
- classmethod from_uri(uri: str, architecture: str, filename: str | None = 'tmp_file.model', cache_dir: str | Path | None = None, keep_file: bool | None = False)[source]¶
Download a file from a URI and save it as ModelData.
- Parameters:
- uristr
URI of the file to download.
- architecturestr
Architecture of the mlip model.
- filenamestr | None
Name to be used for the file defaults to tmp_file.model.
- cache_dirstr | Path | None
Path to the folder where the file has to be saved. Defaults is “~/.cache/mlips/”.
- keep_filebool | None
True to keep the downloaded model, even if there are duplicates. Default is False, so the file is deleted and only saved in the database.
- Returns:
- ModelData
A ModelData instance.
- set_file(file: str | Path, filename: str | None = None, architecture: str | None = None, **kwargs: Any) None[source]¶
Set the file for the node.
- Parameters:
- filestr | Path
Absolute path to the file.
- filenamestr | None
Name to be used for the file. Defaults is the name of provided file.
- architecturestr | None
Architecture of the mlip model. Default is None.
- Other Parameters:
- **kwargsAny
Additional keyword arguments.
Module contents¶
Data types for MLIPs calculations.