wei.types.base_types

Base Dataclasses and Enums for WEI

Functions

ulid_factory()

Generates a ulid

pydantic model wei.types.base_types.BaseModel

Allows any sub-class to inherit methods allowing for programmatic description of protocols Can load a yaml into a class and write a class into a yaml file.

Show JSON schema
{
   "title": "BaseModel",
   "description": "Allows any sub-class to inherit methods allowing for programmatic description of protocols\nCan load a yaml into a class and write a class into a yaml file.",
   "type": "object",
   "properties": {}
}

Config:
  • use_enum_values: bool = True

Validators:
classmethod from_yaml(path: str | Path) _T

Allows all derived data models to be loaded from yaml. :Parameters: path (PathLike) – Path to a yaml file to be read.

validator validate_ulids  »  all fields

Validates that all ULID fields are valid

write_yaml(path: str | Path) None

Allows all derived data models to be exported into yaml. :Parameters: path (PathLike) – Path to dump the yaml file.

Returns:

None

pydantic model wei.types.base_types.Metadata

Metadata container

Show JSON schema
{
   "title": "Metadata",
   "description": "Metadata container",
   "type": "object",
   "properties": {
      "author": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Author"
      },
      "description": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Description"
      },
      "version": {
         "anyOf": [
            {
               "type": "number"
            },
            {
               "type": "string"
            }
         ],
         "default": "",
         "title": "Version"
      }
   },
   "additionalProperties": true
}

Config:
  • use_enum_values: bool = True

  • extra: str = allow

Fields:
Validators:

field author: str | None = None

Who wrote this object

Validated by:
field description: str | None = None (alias 'AliasChoices(choices=['description', 'info'])')

Description of the object

Validated by:
field version: float | str = ''

Version of the object

Validated by:
wei.types.base_types.ulid_factory() str

Generates a ulid