DType

Dtype mappings

flat_to_linkml = {'ascii': 'string', 'bool': 'boolean', 'double': 'double', 'float': 'float', 'float32': 'float', 'float64': 'double', 'int': 'integer', 'int16': 'integer', 'int32': 'integer', 'int64': 'integer', 'int8': 'integer', 'isodatetime': 'datetime', 'long': 'integer', 'numeric': 'float', 'short': 'integer', 'text': 'string', 'uint': 'integer', 'uint16': 'integer', 'uint32': 'integer', 'uint64': 'integer', 'uint8': 'integer', 'utf': 'string', 'utf8': 'string', 'utf_8': 'string'}

Map between the flat data types and the simpler linkml base types

linkml_reprs = {'numeric': 'float | int'}

repr fields used in the nwb language elements injected in every namespace that give the nwb type a specific representation in the generated pydantic models

allowed_precisions = {'datetime64': ['object'], 'float': ['double'], 'float16': ['float16', 'float32', 'float64'], 'float32': ['float32', 'float64'], 'int': ['long'], 'int8': ['short', 'int', 'long', 'int16', 'int32', 'int64'], 'number': ['short', 'int', 'long', 'int16', 'int32', 'int64', 'uint', 'uint8', 'uint16', 'uint32', 'uint64', 'float', 'float16', 'float32', 'float64'], 'short': ['int', 'long'], 'uint16': ['uint16', 'uint32', 'uint64'], 'uint32': ['uint32', 'uint64'], 'uint8': ['uint8', 'uint16', 'uint32', 'uint64'], 'utf': ['ascii']}

Following HDMF, it turns out that specifying precision actually specifies minimum precision https://github.com/hdmf-dev/hdmf/blob/ddc842b5c81d96e0b957b96e88533b16c137e206/src/hdmf/validate/validator.py#L22 https://github.com/hdmf-dev/hdmf/blob/ddc842b5c81d96e0b957b96e88533b16c137e206/src/hdmf/spec/spec.py#L694-L714

handle_dtype(dtype: List[CompoundDtype] | FlatDtype | ReferenceDtype | None) str

Get the string form of a dtype

Parameters:

dtype (DTypeType) – Dtype to stringify

Returns:

str

inlined(dtype: List[CompoundDtype] | FlatDtype | ReferenceDtype | None) bool | None

Check if a slot should be inlined based on its dtype

for now that is equivalent to checking whether that dtype is another a reference dtype, but the function remains semantically reserved for answering this question w.r.t. dtype.

Returns None if not inlined to not clutter generated models with unnecessary props