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_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"
      }
   },
   "required": [
      "equals"
   ]
}

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

Bases: 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",
         "anyOf": [
            {
               "$ref": "#/definitions/Interface_Map"
            },
            {}
         ]
      },
      "int": {
         "title": "Int",
         "anyOf": [
            {
               "$ref": "#/definitions/Interface_Map"
            },
            {}
         ]
      },
      "float": {
         "title": "Float",
         "anyOf": [
            {
               "$ref": "#/definitions/Interface_Map"
            },
            {}
         ]
      },
      "str": {
         "title": "Str",
         "anyOf": [
            {
               "$ref": "#/definitions/Interface_Map"
            },
            {}
         ]
      },
      "bytes": {
         "title": "Bytes",
         "anyOf": [
            {
               "$ref": "#/definitions/Interface_Map"
            },
            {}
         ]
      },
      "datetime": {
         "title": "Datetime",
         "anyOf": [
            {
               "$ref": "#/definitions/Interface_Map"
            },
            {}
         ]
      },
      "group": {
         "title": "Group",
         "anyOf": [
            {
               "$ref": "#/definitions/Interface_Map"
            },
            {}
         ]
      },
      "node": {
         "title": "Node",
         "anyOf": [
            {
               "$ref": "#/definitions/Interface_Map"
            },
            {}
         ]
      }
   },
   "required": [
      "bool",
      "int",
      "float",
      "str",
      "datetime"
   ],
   "definitions": {
      "Interface_Map": {
         "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"
            }
         },
         "required": [
            "equals"
         ]
      }
   }
}

Fields:
field bool: Interface_Map | Type [Required]
field int: Interface_Map | Type [Required]
field float: Interface_Map | Type [Required]
field str: Interface_Map | Type [Required]
field bytes: Interface_Map | Type | None = None
field datetime: Interface_Map | Type [Required]
field group: Interface_Map | Type | None = None
field node: Interface_Map | Type | None = None
get(key, args: list | None = None, kwargs: dict | None = None)[source]
pydantic model Interface[source]

Bases: 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": {
         "$ref": "#/definitions/Interface_Mapset"
      },
      "schema": {
         "$ref": "#/definitions/Schema"
      }
   },
   "required": [
      "map",
      "schema"
   ],
   "definitions": {
      "Interface_Map": {
         "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"
            }
         },
         "required": [
            "equals"
         ]
      },
      "Interface_Mapset": {
         "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",
               "anyOf": [
                  {
                     "$ref": "#/definitions/Interface_Map"
                  },
                  {}
               ]
            },
            "int": {
               "title": "Int",
               "anyOf": [
                  {
                     "$ref": "#/definitions/Interface_Map"
                  },
                  {}
               ]
            },
            "float": {
               "title": "Float",
               "anyOf": [
                  {
                     "$ref": "#/definitions/Interface_Map"
                  },
                  {}
               ]
            },
            "str": {
               "title": "Str",
               "anyOf": [
                  {
                     "$ref": "#/definitions/Interface_Map"
                  },
                  {}
               ]
            },
            "bytes": {
               "title": "Bytes",
               "anyOf": [
                  {
                     "$ref": "#/definitions/Interface_Map"
                  },
                  {}
               ]
            },
            "datetime": {
               "title": "Datetime",
               "anyOf": [
                  {
                     "$ref": "#/definitions/Interface_Map"
                  },
                  {}
               ]
            },
            "group": {
               "title": "Group",
               "anyOf": [
                  {
                     "$ref": "#/definitions/Interface_Map"
                  },
                  {}
               ]
            },
            "node": {
               "title": "Node",
               "anyOf": [
                  {
                     "$ref": "#/definitions/Interface_Map"
                  },
                  {}
               ]
            }
         },
         "required": [
            "bool",
            "int",
            "float",
            "str",
            "datetime"
         ]
      },
      "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: Interface_Mapset [Required]
field schema_: 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.