base

Classes:

Interface_Map

Statement of equivalence between two things, potentially with some translation or parameterization, such that a base type can be written to.

Interface_Mapset

Metaclass for mapping base types to another format.

Interface

Create a representation of a given Schema

Functions:

resolve_type(type_[, resolve_literal])

Get the "inner" type of a model field, sans Optionals and Unions and the like

pydantic model Interface_Map[source]

Bases: autopilot.root.Autopilot_Type

Statement of equivalence between two things, potentially with some translation or parameterization, such that a base type can be written to.

Show JSON schema
{
   "title": "Interface_Map",
   "description": "Statement of equivalence between two things, potentially with some\ntranslation or parameterization, such that a base type can be written\nto.",
   "type": "object",
   "properties": {
      "equals": {
         "title": "Equals"
      },
      "args": {
         "title": "Args",
         "type": "array",
         "items": {}
      },
      "kwargs": {
         "title": "Kwargs",
         "type": "object"
      }
   }
}

Fields
field equals: Type [Required]
field args: Optional[List] = None
field kwargs: Optional[Dict] = None
field conversion: Optional[Callable] = None
pydantic model Interface_Mapset[source]

Bases: autopilot.root.Autopilot_Type

Metaclass for mapping base types to another format.

Each field can be a Type (if it is instantiated without arguments, or can use the Interface_Map to specify them.

The special types group and node correspond to Group and Node classes, for when a given interface needs to do something to create an abstract representation of a group or node in a schema’s hierarchy.

Todo

This will need to be generalized, eg. NWB doesn’t need a mapping between types and objects, but mappings between annotated types and paths (eg. something within the /data/trial_data makes a behavioral series, etc).

Show JSON schema
{
   "title": "Interface_Mapset",
   "description": "Metaclass for mapping base types to another format.\n\nEach field can be a Type (if it is instantiated without arguments, or\ncan use the :class:`.Interface_Map` to specify them.\n\nThe special types ``group`` and ``node`` correspond to\n:class:`~.data.modeling.base.Group` and :class:`~.data.modeling.base.Node`\nclasses, for when a given interface needs to do something to create an\nabstract representation of a group or node in a schema's hierarchy.\n\n.. todo::\n\n    This will need to be generalized, eg. NWB doesn't need a mapping between types and objects,\n    but mappings between annotated types and paths (eg. something within the `/data/trial_data` makes\n    a behavioral series, etc).",
   "type": "object",
   "properties": {
      "bool": {
         "title": "Bool"
      },
      "int": {
         "title": "Int"
      },
      "float": {
         "title": "Float"
      },
      "str": {
         "title": "Str"
      },
      "bytes": {
         "title": "Bytes"
      },
      "datetime": {
         "title": "Datetime"
      },
      "group": {
         "title": "Group"
      },
      "node": {
         "title": "Node"
      }
   }
}

Fields
field bool: Union[autopilot.data.interfaces.base.Interface_Map, Type] [Required]
field int: Union[autopilot.data.interfaces.base.Interface_Map, Type] [Required]
field float: Union[autopilot.data.interfaces.base.Interface_Map, Type] [Required]
field str: Union[autopilot.data.interfaces.base.Interface_Map, Type] [Required]
field bytes: Optional[Union[autopilot.data.interfaces.base.Interface_Map, Type]] = None
field datetime: Union[autopilot.data.interfaces.base.Interface_Map, Type] [Required]
field group: Optional[Union[autopilot.data.interfaces.base.Interface_Map, Type]] = None
field node: Optional[Union[autopilot.data.interfaces.base.Interface_Map, Type]] = None
get(key, args: Optional[list] = None, kwargs: Optional[dict] = None)[source]
pydantic model Interface[source]

Bases: autopilot.root.Autopilot_Type

Create a representation of a given Schema

Show JSON schema
{
   "title": "Interface",
   "description": "Create a representation of a given Schema",
   "type": "object",
   "properties": {
      "map": {
         "title": "Map"
      },
      "schema": {
         "$ref": "#/definitions/Schema"
      }
   },
   "required": [
      "schema"
   ],
   "definitions": {
      "Schema": {
         "title": "Schema",
         "description": "A special type of type intended to be a representation of an\nabstract structure/schema of data, rather than a live container of\ndata objects themselves. This class is used for constructing data containers,\ntranslating between formats, etc. rather than momentary data handling",
         "type": "object",
         "properties": {}
      }
   }
}

Fields
field map: autopilot.data.interfaces.base.Interface_Mapset [Required]
field schema_: autopilot.data.modeling.base.Schema [Required] (alias 'schema')
abstract make(input: Any) bool[source]

Make a given schema using the interface mapping given.

Returns

True if successful

Return type

bool

resolve_type(type_, resolve_literal=False) Type[source]

Get the “inner” type of a model field, sans Optionals and Unions and the like

Parameters

resolve_literal (bool) – If True, return the type of the inside of Literals, rather than the Literal type itself.