aiida_restapi.common package#
Submodules#
aiida_restapi.common.exceptions module#
Common exception classes.
- exception aiida_restapi.common.exceptions.JsonApiException[source]#
Bases:
ExceptionBase exception for JSON:API related errors.
- __module__ = 'aiida_restapi.common.exceptions'#
- __weakref__#
list of weak references to the object
aiida_restapi.common.pagination module#
Pagination utilities.
- class aiida_restapi.common.pagination.PaginatedResults(*, total, page, page_size, data)[source]#
Bases:
BaseModel,Generic[ResultType]- __abstractmethods__ = frozenset({})#
- __annotations__ = {'data': 'list[ResultType]', 'page': 'int', 'page_size': 'int', 'total': 'int'}#
- __class_vars__ = {}#
The names of the class variables defined on the model.
- __dict__#
- __module__ = 'aiida_restapi.common.pagination'#
- __orig_bases__ = (<class 'pydantic.main.BaseModel'>, typing.Generic[~ResultType])#
- __parameters__ = (~ResultType,)#
- __private_attributes__ = {}#
Metadata about the private attributes of the model.
- __pydantic_complete__ = True#
Whether model building is completed, or if there are still undefined fields.
- __pydantic_computed_fields__ = {}#
A dictionary of computed field names and their corresponding [ComputedFieldInfo][pydantic.fields.ComputedFieldInfo] objects.
- __pydantic_core_schema__ = {'cls': <class 'aiida_restapi.common.pagination.PaginatedResults'>, 'config': {'title': 'PaginatedResults'}, 'custom_init': False, 'metadata': {'pydantic_js_functions': [<bound method BaseModel.__get_pydantic_json_schema__ of <class 'aiida_restapi.common.pagination.PaginatedResults'>>]}, 'ref': 'aiida_restapi.common.pagination.PaginatedResults:102854669204752', 'root_model': False, 'schema': {'computed_fields': [], 'fields': {'data': {'metadata': {}, 'schema': {'items_schema': {'type': 'any'}, 'type': 'list'}, 'type': 'model-field'}, 'page': {'metadata': {}, 'schema': {'type': 'int'}, 'type': 'model-field'}, 'page_size': {'metadata': {}, 'schema': {'type': 'int'}, 'type': 'model-field'}, 'total': {'metadata': {}, 'schema': {'type': 'int'}, 'type': 'model-field'}}, 'model_name': 'PaginatedResults', 'type': 'model-fields'}, 'type': 'model'}#
The core schema of the model.
- __pydantic_custom_init__ = False#
Whether the model has a custom __init__ method.
- __pydantic_decorators__ = 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__#
A dictionary containing extra values, if [extra][pydantic.config.ConfigDict.extra] is set to ‘allow’.
- __pydantic_extra_info__ = 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__ = {'data': FieldInfo(annotation=list[~ResultType], required=True), 'page': FieldInfo(annotation=int, required=True), 'page_size': FieldInfo(annotation=int, required=True), 'total': FieldInfo(annotation=int, required=True)}#
A dictionary of field names and their corresponding [FieldInfo][pydantic.fields.FieldInfo] objects. This replaces Model.__fields__ from Pydantic V1.
- __pydantic_fields_set__#
The names of fields explicitly set during instantiation.
- __pydantic_generic_metadata__ = {'args': (), 'origin': None, 'parameters': (~ResultType,)}#
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_parent_namespace__ = None#
Parent namespace of the model, used for automatic rebuilding of models.
- __pydantic_post_init__ = None#
The name of the post-init method for the model, if defined.
- __pydantic_private__#
Values of private attributes set on the model instance.
- __pydantic_serializer__ = SchemaSerializer(serializer=PolymorphismTrampoline( PolymorphismTrampoline { class: Py( 0x00005d8bb8057d10, ), serializer: PolymorphismTrampoline( PolymorphismTrampoline { class: Py( 0x00005d8bb8057d10, ), serializer: Model( ModelSerializer { class: Py( 0x00005d8bb8057d10, ), serializer: Fields( GeneralFieldsSerializer { fields: { "data": SerField { key: "data", alias: None, serializer: Some( List( ListSerializer { item_serializer: Any( AnySerializer, ), filter: SchemaFilter { include: None, exclude: None, }, name: "list[any]", }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "total": SerField { key: "total", alias: None, serializer: Some( Int( IntSerializer, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "page": SerField { key: "page", alias: None, serializer: Some( Int( IntSerializer, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "page_size": SerField { key: "page_size", alias: None, serializer: Some( Int( IntSerializer, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 4, }, ), has_extra: false, root_model: false, name: "PaginatedResults", }, ), enabled_from_config: false, }, ), enabled_from_config: false, }, ), definitions=[])#
The pydantic-core SchemaSerializer used to dump instances of the model.
- __pydantic_setattr_handlers__ = {}#
__setattr__ handlers. Memoizing the handlers leads to a dramatic performance improvement in __setattr__
- __pydantic_validator__ = SchemaValidator(title="PaginatedResults", validator=Model( ModelValidator { revalidate: Never, validator: ModelFields( ModelFieldsValidator { fields: [ Field { name: "total", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "total", ), rest: [], }, by_alias: [], }, validator: Int( IntValidator { strict: false, }, ), frozen: false, }, Field { name: "page", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "page", ), rest: [], }, by_alias: [], }, validator: Int( IntValidator { strict: false, }, ), frozen: false, }, Field { name: "page_size", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "page_size", ), rest: [], }, by_alias: [], }, validator: Int( IntValidator { strict: false, }, ), frozen: false, }, Field { name: "data", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "data", ), rest: [], }, by_alias: [], }, validator: List( ListValidator { strict: false, item_validator: None, min_length: None, max_length: None, name: OnceLock( <uninit>, ), fail_fast: false, }, ), frozen: false, }, ], model_name: "PaginatedResults", extra_behavior: Ignore, extras_validator: None, extras_keys_validator: None, strict: false, from_attributes: false, loc_by_alias: true, lookup: LookupTree { inner: { PathItemString( "data", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 3, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "page", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 1, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "total", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 0, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "page_size", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 2, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, }, }, validate_by_alias: None, validate_by_name: None, }, ), class: Py( 0x00005d8bb8057d10, ), generic_origin: None, post_init: None, frozen: false, custom_init: false, root_model: false, undefined: Py( 0x0000781933fd64d0, ), name: "PaginatedResults", }, ), definitions=[], cache_strings=True)#
The pydantic-core SchemaValidator used to validate instances of the model.
- __signature__ = <Signature (*, total: int, page: int, page_size: int, data: list[~ResultType]) -> None>#
The synthesized __init__ [Signature][inspect.Signature] of the model.
- __weakref__#
list of weak references to the object
- _abc_impl = <_abc._abc_data object>#
- data#
- model_config = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- page#
- page_size#
- total#
aiida_restapi.common.query module#
REST API query utilities.
- class aiida_restapi.common.query.CollectionQueryParams(*, include=<factory>, page_size=10, page=1, offset=0, order_by=None, filters=<factory>)[source]#
Bases:
QueryBuilderParams,IncludeQuery parameters for a collection resource: filters, sorting, pagination, include.
- __abstractmethods__ = frozenset({})#
- __annotations__ = {}#
- __class_vars__ = {}#
The names of the class variables defined on the model.
- __dict__#
- __module__ = 'aiida_restapi.common.query'#
- __private_attributes__ = {}#
Metadata about the private attributes of the model.
- __pydantic_complete__ = True#
Whether model building is completed, or if there are still undefined fields.
- __pydantic_computed_fields__ = {}#
A dictionary of computed field names and their corresponding [ComputedFieldInfo][pydantic.fields.ComputedFieldInfo] objects.
- __pydantic_core_schema__ = {'cls': <class 'aiida_restapi.common.query.CollectionQueryParams'>, 'config': {'title': 'CollectionQueryParams'}, 'custom_init': False, 'metadata': {'pydantic_js_functions': [<bound method BaseModel.__get_pydantic_json_schema__ of <class 'aiida_restapi.common.query.CollectionQueryParams'>>]}, 'ref': 'aiida_restapi.common.query.CollectionQueryParams:102854668976592', 'root_model': False, 'schema': {'computed_fields': [], 'fields': {'filters': {'metadata': {'pydantic_js_updates': {'description': 'AiiDA QueryBuilder filters', 'examples': [{'node_type': {'==': 'data.core.int.Int.'}}, {'attributes.value': {'>': 42}}]}}, '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'}, 'include': {'metadata': {'pydantic_js_updates': {'description': 'Related resources to include', 'examples': ['nodes', 'users,computers']}}, 'schema': {'default_factory': <class 'list'>, 'default_factory_takes_data': False, 'schema': {'items_schema': {'type': 'str'}, 'type': 'list'}, 'type': 'default'}, 'type': 'model-field'}, 'offset': {'metadata': {'pydantic_js_updates': {'description': 'Offset for results', 'examples': [0]}}, 'schema': {'default': 0, 'schema': {'ge': 0, 'type': 'int'}, 'type': 'default'}, 'type': 'model-field'}, 'order_by': {'metadata': {'pydantic_js_updates': {'description': 'Fields to sort by', 'examples': [{'attributes.value': 'desc'}]}}, 'schema': {'default': None, 'schema': {'schema': {'choices': [{'type': 'str'}, {'items_schema': {'type': 'str'}, 'type': 'list'}, {'keys_schema': {'type': 'str'}, 'type': 'dict', 'values_schema': {'type': 'any'}}], 'type': 'union'}, 'type': 'nullable'}, 'type': 'default'}, 'type': 'model-field'}, 'page': {'metadata': {'pydantic_js_updates': {'description': 'Page number', 'examples': [1]}}, 'schema': {'default': 1, 'schema': {'gt': 0, 'type': 'int'}, 'type': 'default'}, 'type': 'model-field'}, 'page_size': {'metadata': {'pydantic_js_updates': {'description': 'Number of results per page', 'examples': [10]}}, 'schema': {'default': 10, 'schema': {'gt': 0, 'type': 'int'}, 'type': 'default'}, 'type': 'model-field'}}, 'model_name': 'CollectionQueryParams', 'type': 'model-fields'}, 'type': 'model'}#
The core schema of the model.
- __pydantic_custom_init__ = False#
Whether the model has a custom __init__ method.
- __pydantic_decorators__ = 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__#
A dictionary containing extra values, if [extra][pydantic.config.ConfigDict.extra] is set to ‘allow’.
- __pydantic_extra_info__ = 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__ = {'filters': FieldInfo(annotation=dict[str, Any], required=False, default_factory=dict, description='AiiDA QueryBuilder filters', examples=[{'node_type': {'==': 'data.core.int.Int.'}}, {'attributes.value': {'>': 42}}]), 'include': FieldInfo(annotation=list[str], required=False, default_factory=list, description='Related resources to include', examples=['nodes', 'users,computers']), 'offset': FieldInfo(annotation=int, required=False, default=0, description='Offset for results', examples=[0], metadata=[Ge(ge=0)]), 'order_by': FieldInfo(annotation=Union[str, list[str], dict[str, Any], NoneType], required=False, default=None, description='Fields to sort by', examples=[{'attributes.value': 'desc'}]), 'page': FieldInfo(annotation=int, required=False, default=1, description='Page number', examples=[1], metadata=[Gt(gt=0)]), 'page_size': FieldInfo(annotation=int, required=False, default=10, description='Number of results per page', examples=[10], metadata=[Gt(gt=0)])}#
A dictionary of field names and their corresponding [FieldInfo][pydantic.fields.FieldInfo] objects. This replaces Model.__fields__ from Pydantic V1.
- __pydantic_fields_set__#
The names of fields explicitly set during instantiation.
- __pydantic_generic_metadata__ = {'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_parent_namespace__ = None#
Parent namespace of the model, used for automatic rebuilding of models.
- __pydantic_post_init__ = None#
The name of the post-init method for the model, if defined.
- __pydantic_private__#
Values of private attributes set on the model instance.
- __pydantic_serializer__ = SchemaSerializer(serializer=PolymorphismTrampoline( PolymorphismTrampoline { class: Py( 0x00005d8bb80201d0, ), serializer: PolymorphismTrampoline( PolymorphismTrampoline { class: Py( 0x00005d8bb80201d0, ), serializer: Model( ModelSerializer { class: Py( 0x00005d8bb80201d0, ), serializer: Fields( GeneralFieldsSerializer { fields: { "include": SerField { key: "include", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: DefaultFactory( Py( 0x000078193608c380, ), false, ), serializer: List( ListSerializer { item_serializer: Str( StrSerializer, ), filter: SchemaFilter { include: None, exclude: None, }, name: "list[str]", }, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "page_size": SerField { key: "page_size", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x0000781936184c68, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "offset": SerField { key: "offset", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x0000781936184b28, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "order_by": SerField { key: "order_by", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x0000781936090c20, ), ), serializer: Nullable( NullableSerializer { serializer: Union( UnionSerializer { choices: UnionChoices { choices: [ Str( StrSerializer, ), List( ListSerializer { item_serializer: Str( StrSerializer, ), filter: SchemaFilter { include: None, exclude: None, }, name: "list[str]", }, ), Dict( DictSerializer { key_serializer: Str( StrSerializer, ), value_serializer: Any( AnySerializer, ), filter: SchemaFilter { include: None, exclude: None, }, name: "dict[str, any]", }, ), ], }, name: "Union[str, list[str], dict[str, any]]", }, ), }, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "filters": SerField { key: "filters", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: DefaultFactory( Py( 0x000078193608dee0, ), 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: None, serialization_exclude_if: None, }, "page": SerField { key: "page", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x0000781936184b48, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, 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: "CollectionQueryParams", }, ), enabled_from_config: false, }, ), enabled_from_config: false, }, ), definitions=[])#
The pydantic-core SchemaSerializer used to dump instances of the model.
- __pydantic_setattr_handlers__ = {}#
__setattr__ handlers. Memoizing the handlers leads to a dramatic performance improvement in __setattr__
- __pydantic_validator__ = SchemaValidator(title="CollectionQueryParams", validator=Model( ModelValidator { revalidate: Never, validator: ModelFields( ModelFieldsValidator { fields: [ Field { name: "include", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "include", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: DefaultFactory( Py( 0x000078193608c380, ), false, ), on_error: Raise, validator: List( ListValidator { strict: false, item_validator: Some( Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), ), min_length: None, max_length: None, name: OnceLock( "list[str]", ), fail_fast: false, }, ), validate_default: false, copy_default: false, name: "default[list[str]]", undefined: Py( 0x0000781933fd64d0, ), }, ), frozen: false, }, Field { name: "page_size", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "page_size", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x0000781936184c68, ), ), on_error: Raise, validator: ConstrainedInt( ConstrainedIntValidator { strict: false, multiple_of: None, le: None, lt: None, ge: None, gt: Some( I64( 0, ), ), }, ), validate_default: false, copy_default: false, name: "default[constrained-int]", undefined: Py( 0x0000781933fd64d0, ), }, ), frozen: false, }, Field { name: "page", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "page", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x0000781936184b48, ), ), on_error: Raise, validator: ConstrainedInt( ConstrainedIntValidator { strict: false, multiple_of: None, le: None, lt: None, ge: None, gt: Some( I64( 0, ), ), }, ), validate_default: false, copy_default: false, name: "default[constrained-int]", undefined: Py( 0x0000781933fd64d0, ), }, ), frozen: false, }, Field { name: "offset", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "offset", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x0000781936184b28, ), ), on_error: Raise, validator: ConstrainedInt( ConstrainedIntValidator { strict: false, multiple_of: None, le: None, lt: None, ge: Some( I64( 0, ), ), gt: None, }, ), validate_default: false, copy_default: false, name: "default[constrained-int]", undefined: Py( 0x0000781933fd64d0, ), }, ), frozen: false, }, Field { name: "order_by", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "order_by", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x0000781936090c20, ), ), on_error: Raise, validator: Nullable( NullableValidator { validator: Union( UnionValidator { mode: Smart, choices: [ ( Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), None, ), ( List( ListValidator { strict: false, item_validator: Some( Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), ), min_length: None, max_length: None, name: OnceLock( "list[str]", ), fail_fast: false, }, ), None, ), ( 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]", }, ), None, ), ], custom_error: None, name: "union[str,list[str],dict[str,any]]", }, ), name: "nullable[union[str,list[str],dict[str,any]]]", }, ), validate_default: false, copy_default: false, name: "default[nullable[union[str,list[str],dict[str,any]]]]", undefined: Py( 0x0000781933fd64d0, ), }, ), frozen: false, }, Field { name: "filters", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "filters", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: DefaultFactory( Py( 0x000078193608dee0, ), 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( 0x0000781933fd64d0, ), }, ), frozen: false, }, ], model_name: "CollectionQueryParams", extra_behavior: Ignore, extras_validator: None, extras_keys_validator: None, strict: false, from_attributes: false, loc_by_alias: true, lookup: LookupTree { inner: { PathItemString( "order_by", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 4, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "offset", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 3, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "filters", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 5, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "include", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 0, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "page_size", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 1, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "page", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 2, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, }, }, validate_by_alias: None, validate_by_name: None, }, ), class: Py( 0x00005d8bb80201d0, ), generic_origin: None, post_init: None, frozen: false, custom_init: false, root_model: false, undefined: Py( 0x0000781933fd64d0, ), name: "CollectionQueryParams", }, ), definitions=[], cache_strings=True)#
The pydantic-core SchemaValidator used to validate instances of the model.
- __signature__ = <Signature (*, include: list[str] = <factory>, page_size: typing.Annotated[int, Gt(gt=0)] = 10, page: typing.Annotated[int, Gt(gt=0)] = 1, offset: typing.Annotated[int, Ge(ge=0)] = 0, order_by: str | list[str] | dict[str, typing.Any] | None = None, filters: dict[str, typing.Any] = <factory>) -> None>#
The synthesized __init__ [Signature][inspect.Signature] of the model.
- _abc_impl = <_abc._abc_data object>#
- model_config = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class aiida_restapi.common.query.QueryBuilderParams(*, page_size=10, page=1, offset=0, order_by=None, filters=<factory>)[source]#
Bases:
Filtering,Sorting,PaginationQueryBuilder parameters: filters, sorting, pagination.
- __abstractmethods__ = frozenset({})#
- __annotations__ = {}#
- __class_vars__ = {}#
The names of the class variables defined on the model.
- __dict__#
- __module__ = 'aiida_restapi.common.query'#
- __private_attributes__ = {}#
Metadata about the private attributes of the model.
- __pydantic_complete__ = True#
Whether model building is completed, or if there are still undefined fields.
- __pydantic_computed_fields__ = {}#
A dictionary of computed field names and their corresponding [ComputedFieldInfo][pydantic.fields.ComputedFieldInfo] objects.
- __pydantic_core_schema__ = {'cls': <class 'aiida_restapi.common.query.QueryBuilderParams'>, 'config': {'title': 'QueryBuilderParams'}, 'custom_init': False, 'metadata': {'pydantic_js_functions': [<bound method BaseModel.__get_pydantic_json_schema__ of <class 'aiida_restapi.common.query.QueryBuilderParams'>>]}, 'ref': 'aiida_restapi.common.query.QueryBuilderParams:102854668861840', 'root_model': False, 'schema': {'computed_fields': [], 'fields': {'filters': {'metadata': {'pydantic_js_updates': {'description': 'AiiDA QueryBuilder filters', 'examples': [{'node_type': {'==': 'data.core.int.Int.'}}, {'attributes.value': {'>': 42}}]}}, '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'}, 'offset': {'metadata': {'pydantic_js_updates': {'description': 'Offset for results', 'examples': [0]}}, 'schema': {'default': 0, 'schema': {'ge': 0, 'type': 'int'}, 'type': 'default'}, 'type': 'model-field'}, 'order_by': {'metadata': {'pydantic_js_updates': {'description': 'Fields to sort by', 'examples': [{'attributes.value': 'desc'}]}}, 'schema': {'default': None, 'schema': {'schema': {'choices': [{'type': 'str'}, {'items_schema': {'type': 'str'}, 'type': 'list'}, {'keys_schema': {'type': 'str'}, 'type': 'dict', 'values_schema': {'type': 'any'}}], 'type': 'union'}, 'type': 'nullable'}, 'type': 'default'}, 'type': 'model-field'}, 'page': {'metadata': {'pydantic_js_updates': {'description': 'Page number', 'examples': [1]}}, 'schema': {'default': 1, 'schema': {'gt': 0, 'type': 'int'}, 'type': 'default'}, 'type': 'model-field'}, 'page_size': {'metadata': {'pydantic_js_updates': {'description': 'Number of results per page', 'examples': [10]}}, 'schema': {'default': 10, 'schema': {'gt': 0, 'type': 'int'}, 'type': 'default'}, 'type': 'model-field'}}, 'model_name': 'QueryBuilderParams', 'type': 'model-fields'}, 'type': 'model'}#
The core schema of the model.
- __pydantic_custom_init__ = False#
Whether the model has a custom __init__ method.
- __pydantic_decorators__ = 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__#
A dictionary containing extra values, if [extra][pydantic.config.ConfigDict.extra] is set to ‘allow’.
- __pydantic_extra_info__ = 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__ = {'filters': FieldInfo(annotation=dict[str, Any], required=False, default_factory=dict, description='AiiDA QueryBuilder filters', examples=[{'node_type': {'==': 'data.core.int.Int.'}}, {'attributes.value': {'>': 42}}]), 'offset': FieldInfo(annotation=int, required=False, default=0, description='Offset for results', examples=[0], metadata=[Ge(ge=0)]), 'order_by': FieldInfo(annotation=Union[str, list[str], dict[str, Any], NoneType], required=False, default=None, description='Fields to sort by', examples=[{'attributes.value': 'desc'}]), 'page': FieldInfo(annotation=int, required=False, default=1, description='Page number', examples=[1], metadata=[Gt(gt=0)]), 'page_size': FieldInfo(annotation=int, required=False, default=10, description='Number of results per page', examples=[10], metadata=[Gt(gt=0)])}#
A dictionary of field names and their corresponding [FieldInfo][pydantic.fields.FieldInfo] objects. This replaces Model.__fields__ from Pydantic V1.
- __pydantic_fields_set__#
The names of fields explicitly set during instantiation.
- __pydantic_generic_metadata__ = {'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_parent_namespace__ = None#
Parent namespace of the model, used for automatic rebuilding of models.
- __pydantic_post_init__ = None#
The name of the post-init method for the model, if defined.
- __pydantic_private__#
Values of private attributes set on the model instance.
- __pydantic_serializer__ = SchemaSerializer(serializer=PolymorphismTrampoline( PolymorphismTrampoline { class: Py( 0x00005d8bb8004190, ), serializer: PolymorphismTrampoline( PolymorphismTrampoline { class: Py( 0x00005d8bb8004190, ), serializer: Model( ModelSerializer { class: Py( 0x00005d8bb8004190, ), serializer: Fields( GeneralFieldsSerializer { fields: { "page": SerField { key: "page", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x0000781936184b48, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "filters": SerField { key: "filters", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: DefaultFactory( Py( 0x000078193608dee0, ), 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: None, serialization_exclude_if: None, }, "page_size": SerField { key: "page_size", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x0000781936184c68, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "order_by": SerField { key: "order_by", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x0000781936090c20, ), ), serializer: Nullable( NullableSerializer { serializer: Union( UnionSerializer { choices: UnionChoices { choices: [ Str( StrSerializer, ), List( ListSerializer { item_serializer: Str( StrSerializer, ), filter: SchemaFilter { include: None, exclude: None, }, name: "list[str]", }, ), Dict( DictSerializer { key_serializer: Str( StrSerializer, ), value_serializer: Any( AnySerializer, ), filter: SchemaFilter { include: None, exclude: None, }, name: "dict[str, any]", }, ), ], }, name: "Union[str, list[str], dict[str, any]]", }, ), }, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "offset": SerField { key: "offset", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x0000781936184b28, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 5, }, ), has_extra: false, root_model: false, name: "QueryBuilderParams", }, ), enabled_from_config: false, }, ), enabled_from_config: false, }, ), definitions=[])#
The pydantic-core SchemaSerializer used to dump instances of the model.
- __pydantic_setattr_handlers__ = {}#
__setattr__ handlers. Memoizing the handlers leads to a dramatic performance improvement in __setattr__
- __pydantic_validator__ = SchemaValidator(title="QueryBuilderParams", validator=Model( ModelValidator { revalidate: Never, validator: ModelFields( ModelFieldsValidator { fields: [ Field { name: "page_size", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "page_size", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x0000781936184c68, ), ), on_error: Raise, validator: ConstrainedInt( ConstrainedIntValidator { strict: false, multiple_of: None, le: None, lt: None, ge: None, gt: Some( I64( 0, ), ), }, ), validate_default: false, copy_default: false, name: "default[constrained-int]", undefined: Py( 0x0000781933fd64d0, ), }, ), frozen: false, }, Field { name: "page", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "page", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x0000781936184b48, ), ), on_error: Raise, validator: ConstrainedInt( ConstrainedIntValidator { strict: false, multiple_of: None, le: None, lt: None, ge: None, gt: Some( I64( 0, ), ), }, ), validate_default: false, copy_default: false, name: "default[constrained-int]", undefined: Py( 0x0000781933fd64d0, ), }, ), frozen: false, }, Field { name: "offset", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "offset", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x0000781936184b28, ), ), on_error: Raise, validator: ConstrainedInt( ConstrainedIntValidator { strict: false, multiple_of: None, le: None, lt: None, ge: Some( I64( 0, ), ), gt: None, }, ), validate_default: false, copy_default: false, name: "default[constrained-int]", undefined: Py( 0x0000781933fd64d0, ), }, ), frozen: false, }, Field { name: "order_by", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "order_by", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x0000781936090c20, ), ), on_error: Raise, validator: Nullable( NullableValidator { validator: Union( UnionValidator { mode: Smart, choices: [ ( Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), None, ), ( List( ListValidator { strict: false, item_validator: Some( Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), ), min_length: None, max_length: None, name: OnceLock( "list[str]", ), fail_fast: false, }, ), None, ), ( 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]", }, ), None, ), ], custom_error: None, name: "union[str,list[str],dict[str,any]]", }, ), name: "nullable[union[str,list[str],dict[str,any]]]", }, ), validate_default: false, copy_default: false, name: "default[nullable[union[str,list[str],dict[str,any]]]]", undefined: Py( 0x0000781933fd64d0, ), }, ), frozen: false, }, Field { name: "filters", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "filters", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: DefaultFactory( Py( 0x000078193608dee0, ), 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( 0x0000781933fd64d0, ), }, ), frozen: false, }, ], model_name: "QueryBuilderParams", extra_behavior: Ignore, extras_validator: None, extras_keys_validator: None, strict: false, from_attributes: false, loc_by_alias: true, lookup: LookupTree { inner: { PathItemString( "filters", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 4, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "offset", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 2, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "page_size", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 0, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "page", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 1, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, PathItemString( "order_by", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 3, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, }, }, validate_by_alias: None, validate_by_name: None, }, ), class: Py( 0x00005d8bb8004190, ), generic_origin: None, post_init: None, frozen: false, custom_init: false, root_model: false, undefined: Py( 0x0000781933fd64d0, ), name: "QueryBuilderParams", }, ), definitions=[], cache_strings=True)#
The pydantic-core SchemaValidator used to validate instances of the model.
- __signature__ = <Signature (*, page_size: typing.Annotated[int, Gt(gt=0)] = 10, page: typing.Annotated[int, Gt(gt=0)] = 1, offset: typing.Annotated[int, Ge(ge=0)] = 0, order_by: str | list[str] | dict[str, typing.Any] | None = None, filters: dict[str, typing.Any] = <factory>) -> None>#
The synthesized __init__ [Signature][inspect.Signature] of the model.
- _abc_impl = <_abc._abc_data object>#
- model_config = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class aiida_restapi.common.query.ResourceQueryParams(*, include=<factory>)[source]#
Bases:
IncludeQuery parameters for a single resource: include.
- __abstractmethods__ = frozenset({})#
- __annotations__ = {}#
- __class_vars__ = {}#
The names of the class variables defined on the model.
- __dict__#
- __module__ = 'aiida_restapi.common.query'#
- __private_attributes__ = {}#
Metadata about the private attributes of the model.
- __pydantic_complete__ = True#
Whether model building is completed, or if there are still undefined fields.
- __pydantic_computed_fields__ = {}#
A dictionary of computed field names and their corresponding [ComputedFieldInfo][pydantic.fields.ComputedFieldInfo] objects.
- __pydantic_core_schema__ = {'cls': <class 'aiida_restapi.common.query.ResourceQueryParams'>, 'config': {'title': 'ResourceQueryParams'}, 'custom_init': False, 'metadata': {'pydantic_js_functions': [<bound method BaseModel.__get_pydantic_json_schema__ of <class 'aiida_restapi.common.query.ResourceQueryParams'>>]}, 'ref': 'aiida_restapi.common.query.ResourceQueryParams:102854669093120', 'root_model': False, 'schema': {'computed_fields': [], 'fields': {'include': {'metadata': {'pydantic_js_updates': {'description': 'Related resources to include', 'examples': ['nodes', 'users,computers']}}, 'schema': {'default_factory': <class 'list'>, 'default_factory_takes_data': False, 'schema': {'items_schema': {'type': 'str'}, 'type': 'list'}, 'type': 'default'}, 'type': 'model-field'}}, 'model_name': 'ResourceQueryParams', 'type': 'model-fields'}, 'type': 'model'}#
The core schema of the model.
- __pydantic_custom_init__ = False#
Whether the model has a custom __init__ method.
- __pydantic_decorators__ = 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__#
A dictionary containing extra values, if [extra][pydantic.config.ConfigDict.extra] is set to ‘allow’.
- __pydantic_extra_info__ = 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__ = {'include': FieldInfo(annotation=list[str], required=False, default_factory=list, description='Related resources to include', examples=['nodes', 'users,computers'])}#
A dictionary of field names and their corresponding [FieldInfo][pydantic.fields.FieldInfo] objects. This replaces Model.__fields__ from Pydantic V1.
- __pydantic_fields_set__#
The names of fields explicitly set during instantiation.
- __pydantic_generic_metadata__ = {'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_parent_namespace__ = None#
Parent namespace of the model, used for automatic rebuilding of models.
- __pydantic_post_init__ = None#
The name of the post-init method for the model, if defined.
- __pydantic_private__#
Values of private attributes set on the model instance.
- __pydantic_serializer__ = SchemaSerializer(serializer=PolymorphismTrampoline( PolymorphismTrampoline { class: Py( 0x00005d8bb803c900, ), serializer: PolymorphismTrampoline( PolymorphismTrampoline { class: Py( 0x00005d8bb803c900, ), serializer: Model( ModelSerializer { class: Py( 0x00005d8bb803c900, ), serializer: Fields( GeneralFieldsSerializer { fields: { "include": SerField { key: "include", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: DefaultFactory( Py( 0x000078193608c380, ), false, ), serializer: List( ListSerializer { item_serializer: Str( StrSerializer, ), filter: SchemaFilter { include: None, exclude: None, }, name: "list[str]", }, ), }, ), ), required: true, serialize_by_alias: None, 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: "ResourceQueryParams", }, ), enabled_from_config: false, }, ), enabled_from_config: false, }, ), definitions=[])#
The pydantic-core SchemaSerializer used to dump instances of the model.
- __pydantic_setattr_handlers__ = {}#
__setattr__ handlers. Memoizing the handlers leads to a dramatic performance improvement in __setattr__
- __pydantic_validator__ = SchemaValidator(title="ResourceQueryParams", validator=Model( ModelValidator { revalidate: Never, validator: ModelFields( ModelFieldsValidator { fields: [ Field { name: "include", lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "include", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: DefaultFactory( Py( 0x000078193608c380, ), false, ), on_error: Raise, validator: List( ListValidator { strict: false, item_validator: Some( Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), ), min_length: None, max_length: None, name: OnceLock( "list[str]", ), fail_fast: false, }, ), validate_default: false, copy_default: false, name: "default[list[str]]", undefined: Py( 0x0000781933fd64d0, ), }, ), frozen: false, }, ], model_name: "ResourceQueryParams", extra_behavior: Ignore, extras_validator: None, extras_keys_validator: None, strict: false, from_attributes: false, loc_by_alias: true, lookup: LookupTree { inner: { PathItemString( "include", ): LookupTreeNode { fields: [ LookupFieldInfo { field_index: 0, lookup_priority: LookupFieldPriority { lookup_type: Both, alias_index: 0, }, }, ], map: {}, list: {}, }, }, }, validate_by_alias: None, validate_by_name: None, }, ), class: Py( 0x00005d8bb803c900, ), generic_origin: None, post_init: None, frozen: false, custom_init: false, root_model: false, undefined: Py( 0x0000781933fd64d0, ), name: "ResourceQueryParams", }, ), definitions=[], cache_strings=True)#
The pydantic-core SchemaValidator used to validate instances of the model.
- __signature__ = <Signature (*, include: list[str] = <factory>) -> None>#
The synthesized __init__ [Signature][inspect.Signature] of the model.
- _abc_impl = <_abc._abc_data object>#
- model_config = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- aiida_restapi.common.query.collection_query_params(qb_params, include)[source]#
Dependency to parse collection query parameters.
- Parameters:
qb_params (QueryBuilderParams) – The query builder parameters.
include (Include) – The include parameters.
- Returns:
The combined collection query parameters.
- Return type:
- aiida_restapi.common.query.querybuilder_params(filters=None, order_by=None, page_size=10, page=1, offset=0)[source]#
Dependency to parse QueryBuilder parameters.
- Parameters:
- Returns:
Structured query parameters.
- Return type:
- Raises:
HTTPException – If arguments cannot be parsed as JSON.
aiida_restapi.common.types module#
Common type variables.