base¶
Base resource mapper.
Based on the
BaseResourceMapper
in OPTIMADE Python tools.
BaseResourceMapper
¶
Bases: BaseResourceMapper
Generic Resource Mapper that defines and performs the mapping between objects in the database and the resource objects defined by the specification.
Note
This is a "wrapped" sub-class to make certain methods asynchronous.
Attributes:
Name | Type | Description |
---|---|---|
ALIASES |
a tuple of aliases between
OPTIMADE field names and the field names in the database ,
e.g. |
|
LENGTH_ALIASES |
a tuple of aliases between
a field name and another field that defines its length, to be used
when querying, e.g. |
|
ENTRY_RESOURCE_CLASS |
The entry type that this mapper corresponds to. |
|
PROVIDER_FIELDS |
a tuple of extra field names that this mapper should support when querying with the database prefix. |
|
TOP_LEVEL_NON_ATTRIBUTES_FIELDS |
the set of top-level field names common to all endpoints. |
|
SUPPORTED_PREFIXES |
The set of prefixes registered by this mapper. |
|
ALL_ATTRIBUTES |
The set of attributes defined across the entry resource class and the server configuration. |
|
ENTRY_RESOURCE_ATTRIBUTES |
A dictionary of attributes and their definitions defined by the schema of the entry resource class. |
|
ENDPOINT |
The expected endpoint name for this resource, as defined by
the |
Source code in optimade_gateway/mappers/base.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
|
adeserialize(results)
async
classmethod
¶
Asynchronous version of the deserialize()
class method.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
results
|
dict | Iterable[dict]
|
A list of or a single dictionary, representing an entry-endpoint resource. |
required |
Returns:
Type | Description |
---|---|
list[EntryResource] | EntryResource
|
The deserialized list of or single pydantic resource model for the input |
list[EntryResource] | EntryResource
|
|
Source code in optimade_gateway/mappers/base.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
|