mirror of
https://github.com/p2p-ld/nwb-linkml.git
synced 2024-11-12 17:54:29 +00:00
fix hdmf forwardrefs, remove numpy types temporarily
This commit is contained in:
parent
776078ae67
commit
1d527d8f71
2 changed files with 10 additions and 9 deletions
|
@ -22,7 +22,7 @@ class DynamicTableMixin(BaseModel):
|
|||
"""
|
||||
|
||||
model_config = ConfigDict(extra="allow")
|
||||
__pydantic_extra__: Dict[str, Union[list, "NDArray", "VectorData"]]
|
||||
__pydantic_extra__: Dict[str, Union[list, "NDArray", "VectorDataMixin"]]
|
||||
NON_COLUMN_FIELDS: ClassVar[tuple[str]] = (
|
||||
"name",
|
||||
"colnames",
|
||||
|
@ -33,15 +33,15 @@ class DynamicTableMixin(BaseModel):
|
|||
colnames: List[str] = Field(default_factory=list)
|
||||
|
||||
@property
|
||||
def _columns(self) -> Dict[str, Union[list, "NDArray", "VectorData"]]:
|
||||
def _columns(self) -> Dict[str, Union[list, "NDArray", "VectorDataMixin"]]:
|
||||
return {k: getattr(self, k) for i, k in enumerate(self.colnames)}
|
||||
|
||||
@property
|
||||
def _columns_list(self) -> List[Union[list, "NDArray", "VectorData"]]:
|
||||
def _columns_list(self) -> List[Union[list, "NDArray", "VectorDataMixin"]]:
|
||||
return [getattr(self, k) for i, k in enumerate(self.colnames)]
|
||||
|
||||
@overload
|
||||
def __getitem__(self, item: str) -> Union[list, "NDArray", "VectorData"]: ...
|
||||
def __getitem__(self, item: str) -> Union[list, "NDArray", "VectorDataMixin"]: ...
|
||||
|
||||
@overload
|
||||
def __getitem__(self, item: int) -> DataFrame: ...
|
||||
|
@ -54,7 +54,7 @@ class DynamicTableMixin(BaseModel):
|
|||
DataFrame,
|
||||
list,
|
||||
"NDArray",
|
||||
"VectorData",
|
||||
"VectorDataMixin",
|
||||
]: ...
|
||||
|
||||
@overload
|
||||
|
|
|
@ -12,7 +12,7 @@ from linkml_runtime.linkml_model import (
|
|||
TypeDefinition,
|
||||
)
|
||||
|
||||
from nwb_linkml.maps import flat_to_linkml, flat_to_np
|
||||
from nwb_linkml.maps import flat_to_linkml
|
||||
|
||||
|
||||
def _make_dtypes() -> List[TypeDefinition]:
|
||||
|
@ -27,12 +27,13 @@ def _make_dtypes() -> List[TypeDefinition]:
|
|||
if nwbtype.startswith("uint"):
|
||||
amin = 0
|
||||
|
||||
np_type = flat_to_np[nwbtype]
|
||||
# FIXME: Restore numpy types when we wrap them :)
|
||||
# np_type = flat_to_np[nwbtype]
|
||||
|
||||
repr_string = f"np.{np_type.__name__}" if np_type.__module__ == "numpy" else None
|
||||
# repr_string = f"np.{np_type.__name__}" if np_type.__module__ == "numpy" else None
|
||||
|
||||
atype = TypeDefinition(
|
||||
name=nwbtype, minimum_value=amin, typeof=linkmltype, repr=repr_string
|
||||
name=nwbtype, minimum_value=amin, typeof=linkmltype, # repr=repr_string
|
||||
)
|
||||
DTypeTypes.append(atype)
|
||||
return DTypeTypes
|
||||
|
|
Loading…
Reference in a new issue