mirror of
https://github.com/p2p-ld/nwb-linkml.git
synced 2024-11-10 00:34:29 +00:00
sneakers-the-rat
be21325123
- split off generated subclasses into "include" files, not sure if that's good, but in any case we have them separable now. - more work on cleanly un-nesting scalar and 1D-vector data into attributes and lists, respectively - brought the pydantic generator in-repo to do a bunch of overrides
65 lines
1.9 KiB
Python
65 lines
1.9 KiB
Python
from __future__ import annotations
|
|
from datetime import datetime, date
|
|
from enum import Enum
|
|
from typing import List, Dict, Optional, Any, Union
|
|
from pydantic import BaseModel as BaseModel, Field
|
|
from nptyping import NDArray, Shape, Float, Float32, Double, Float64, LongLong, Int64, Int, Int32, Int16, Short, Int8, UInt, UInt32, UInt16, UInt8, UInt64, Number, String, Unicode, Unicode, Unicode, String, Bool, Datetime64
|
|
import sys
|
|
if sys.version_info >= (3, 8):
|
|
from typing import Literal
|
|
else:
|
|
from typing_extensions import Literal
|
|
|
|
|
|
# from .hdmf_common_table import (
|
|
# ElementIdentifiers
|
|
# )
|
|
|
|
from .nwb_language import (
|
|
Arraylike
|
|
)
|
|
|
|
|
|
metamodel_version = "None"
|
|
version = "None"
|
|
|
|
class WeakRefShimBaseModel(BaseModel):
|
|
__slots__ = '__weakref__'
|
|
|
|
class ConfiguredBaseModel(WeakRefShimBaseModel,
|
|
validate_assignment = True,
|
|
validate_all = True,
|
|
underscore_attrs_are_private = True,
|
|
extra = 'forbid',
|
|
arbitrary_types_allowed = True,
|
|
use_enum_values = True):
|
|
pass
|
|
|
|
|
|
class VectorDataArray(Arraylike):
|
|
|
|
dim0: Any = Field(...)
|
|
dim1: Optional[Any] = Field(None)
|
|
dim2: Optional[Any] = Field(None)
|
|
dim3: Optional[Any] = Field(None)
|
|
|
|
|
|
class ElementIdentifiersArray(Arraylike):
|
|
|
|
num_elements: int = Field(...)
|
|
|
|
|
|
# class DynamicTableId(ElementIdentifiers):
|
|
# """
|
|
# Array of unique identifiers for the rows of this dynamic table.
|
|
# """
|
|
# id: List[int] = Field(default_factory=list, description="""Array of unique identifiers for the rows of this dynamic table.""")
|
|
# array: Optional[NDArray[Shape["* num_elements"], Int]] = Field(None)
|
|
#
|
|
|
|
|
|
# Update forward refs
|
|
# see https://pydantic-docs.helpmanual.io/usage/postponed_annotations/
|
|
VectorDataArray.update_forward_refs()
|
|
ElementIdentifiersArray.update_forward_refs()
|
|
DynamicTableId.update_forward_refs()
|