mirror of
https://github.com/p2p-ld/nwb-linkml.git
synced 2024-11-14 10:44:28 +00:00
model checkpoint before fixing group generation
This commit is contained in:
parent
911a3ddb61
commit
886d3db860
235 changed files with 5356 additions and 1385 deletions
|
@ -27,12 +27,7 @@ BASEMODEL_COERCE_VALUE = """
|
||||||
try:
|
try:
|
||||||
return handler(v["value"])
|
return handler(v["value"])
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise ValueError(
|
raise e1
|
||||||
f"coerce_value: Could not use the value field of {type(v)} "
|
|
||||||
f"to construct {cls.__name__}.{info.field_name}, "
|
|
||||||
f"expected type: {cls.model_fields[info.field_name].annotation}\\n"
|
|
||||||
f"inner error: {str(e1)}"
|
|
||||||
) from e1
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
BASEMODEL_CAST_WITH_VALUE = """
|
BASEMODEL_CAST_WITH_VALUE = """
|
||||||
|
@ -46,12 +41,7 @@ BASEMODEL_CAST_WITH_VALUE = """
|
||||||
try:
|
try:
|
||||||
return handler({"value": v})
|
return handler({"value": v})
|
||||||
except Exception:
|
except Exception:
|
||||||
raise ValueError(
|
raise e1
|
||||||
f"cast_with_value: Could not cast {type(v)} as value field for "
|
|
||||||
f"{cls.__name__}.{info.field_name},"
|
|
||||||
f" expected_type: {cls.model_fields[info.field_name].annotation}\\n"
|
|
||||||
f"inner error: {str(e1)}"
|
|
||||||
) from e1
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
BASEMODEL_COERCE_CHILD = """
|
BASEMODEL_COERCE_CHILD = """
|
||||||
|
|
|
@ -43,7 +43,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -56,6 +56,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -66,7 +78,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -49,7 +49,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -62,6 +62,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -72,7 +84,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -42,7 +42,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -55,6 +55,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -65,7 +77,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -59,7 +59,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -72,6 +72,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -82,7 +94,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -57,7 +57,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -70,6 +70,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -80,7 +92,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -61,7 +61,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -74,6 +74,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -84,7 +96,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -63,7 +63,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -76,6 +76,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -86,7 +98,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -43,7 +43,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -56,6 +56,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -66,7 +78,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -59,7 +59,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -72,6 +72,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -82,7 +94,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -49,7 +49,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -62,6 +62,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -72,7 +84,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -60,7 +60,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -73,6 +73,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -83,7 +95,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -52,7 +52,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -65,6 +65,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -75,7 +87,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -170,7 +170,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -183,6 +183,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -193,7 +205,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -43,7 +43,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -56,6 +56,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -66,7 +78,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -49,7 +49,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -62,6 +62,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -72,7 +84,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -42,7 +42,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -55,6 +55,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -65,7 +77,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -59,7 +59,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -72,6 +72,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -82,7 +94,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -57,7 +57,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -70,6 +70,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -80,7 +92,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -61,7 +61,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -74,6 +74,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -84,7 +96,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -63,7 +63,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -76,6 +76,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -86,7 +98,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -43,7 +43,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -56,6 +56,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -66,7 +78,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -59,7 +59,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -72,6 +72,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -82,7 +94,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -49,7 +49,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -62,6 +62,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -72,7 +84,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -60,7 +60,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -73,6 +73,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -83,7 +95,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -52,7 +52,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -65,6 +65,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -75,7 +87,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -170,7 +170,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -183,6 +183,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -193,7 +205,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -43,7 +43,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -56,6 +56,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -66,7 +78,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -49,7 +49,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -62,6 +62,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -72,7 +84,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -42,7 +42,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -55,6 +55,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -65,7 +77,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -59,7 +59,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -72,6 +72,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -82,7 +94,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -57,7 +57,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -70,6 +70,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -80,7 +92,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -61,7 +61,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -74,6 +74,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -84,7 +96,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -63,7 +63,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -76,6 +76,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -86,7 +98,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -43,7 +43,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -56,6 +56,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -66,7 +78,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -59,7 +59,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -72,6 +72,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -82,7 +94,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -49,7 +49,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -62,6 +62,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -72,7 +84,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -60,7 +60,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -73,6 +73,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -83,7 +95,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -43,7 +43,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -56,6 +56,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -66,7 +78,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -173,7 +173,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -186,6 +186,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -196,7 +208,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -43,7 +43,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -56,6 +56,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -66,7 +78,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -49,7 +49,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -62,6 +62,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -72,7 +84,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -42,7 +42,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -55,6 +55,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -65,7 +77,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -59,7 +59,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -72,6 +72,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -82,7 +94,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -57,7 +57,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -70,6 +70,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -80,7 +92,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -62,7 +62,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -75,6 +75,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -85,7 +97,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -63,7 +63,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -76,6 +76,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -86,7 +98,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -43,7 +43,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -56,6 +56,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -66,7 +78,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -59,7 +59,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -72,6 +72,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -82,7 +94,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -49,7 +49,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -62,6 +62,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -72,7 +84,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -66,7 +66,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -79,6 +79,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -89,7 +101,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -43,7 +43,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -56,6 +56,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -66,7 +78,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -180,7 +180,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -193,6 +193,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -203,7 +215,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -43,7 +43,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -56,6 +56,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -66,7 +78,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -49,7 +49,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -62,6 +62,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -72,7 +84,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -42,7 +42,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -55,6 +55,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -65,7 +77,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -59,7 +59,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -72,6 +72,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -82,7 +94,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -57,7 +57,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -70,6 +70,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -80,7 +92,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -62,7 +62,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -75,6 +75,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -85,7 +97,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -63,7 +63,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -76,6 +76,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -86,7 +98,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -43,7 +43,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -56,6 +56,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -66,7 +78,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -59,7 +59,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -72,6 +72,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -82,7 +94,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -49,7 +49,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -62,6 +62,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -72,7 +84,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -66,7 +66,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -79,6 +79,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -89,7 +101,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -43,7 +43,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -56,6 +56,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -66,7 +78,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -180,7 +180,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -193,6 +193,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -203,7 +215,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -44,7 +44,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -57,6 +57,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -67,7 +79,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
@ -138,9 +153,9 @@ class Image(NWBData):
|
||||||
description: Optional[str] = Field(None, description="""Description of the image.""")
|
description: Optional[str] = Field(None, description="""Description of the image.""")
|
||||||
value: Optional[
|
value: Optional[
|
||||||
Union[
|
Union[
|
||||||
NDArray[Shape["* x, * y"], float],
|
NDArray[Shape["* x, * y"], float | int],
|
||||||
NDArray[Shape["* x, * y, 3 r_g_b"], float],
|
NDArray[Shape["* x, * y, 3 r_g_b"], float | int],
|
||||||
NDArray[Shape["* x, * y, 4 r_g_b_a"], float],
|
NDArray[Shape["* x, * y, 4 r_g_b_a"], float | int],
|
||||||
]
|
]
|
||||||
] = Field(None)
|
] = Field(None)
|
||||||
|
|
||||||
|
@ -305,13 +320,16 @@ class ProcessingModule(NWBContainer):
|
||||||
{"from_schema": "core.nwb.base", "tree_root": True}
|
{"from_schema": "core.nwb.base", "tree_root": True}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
name: str = Field(...)
|
||||||
|
description: str = Field(
|
||||||
|
..., description="""Description of this collection of processed data."""
|
||||||
|
)
|
||||||
value: Optional[Dict[str, Union[DynamicTable, NWBDataInterface]]] = Field(
|
value: Optional[Dict[str, Union[DynamicTable, NWBDataInterface]]] = Field(
|
||||||
None,
|
None,
|
||||||
json_schema_extra={
|
json_schema_extra={
|
||||||
"linkml_meta": {"any_of": [{"range": "NWBDataInterface"}, {"range": "DynamicTable"}]}
|
"linkml_meta": {"any_of": [{"range": "NWBDataInterface"}, {"range": "DynamicTable"}]}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
name: str = Field(...)
|
|
||||||
|
|
||||||
|
|
||||||
class Images(NWBDataInterface):
|
class Images(NWBDataInterface):
|
||||||
|
|
|
@ -49,7 +49,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -62,6 +62,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -72,7 +84,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
@ -197,8 +212,8 @@ class SpatialSeriesData(ConfiguredBaseModel):
|
||||||
)
|
)
|
||||||
value: Optional[
|
value: Optional[
|
||||||
Union[
|
Union[
|
||||||
NDArray[Shape["* num_times"], float],
|
NDArray[Shape["* num_times"], float | int],
|
||||||
NDArray[Shape["* num_times, * num_features"], float],
|
NDArray[Shape["* num_times, * num_features"], float | int],
|
||||||
]
|
]
|
||||||
] = Field(None)
|
] = Field(None)
|
||||||
|
|
||||||
|
@ -212,10 +227,13 @@ class BehavioralEpochs(NWBDataInterface):
|
||||||
{"from_schema": "core.nwb.behavior", "tree_root": True}
|
{"from_schema": "core.nwb.behavior", "tree_root": True}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
name: str = Field(
|
||||||
|
"BehavioralEpochs",
|
||||||
|
json_schema_extra={"linkml_meta": {"ifabsent": "string(BehavioralEpochs)"}},
|
||||||
|
)
|
||||||
value: Optional[Dict[str, IntervalSeries]] = Field(
|
value: Optional[Dict[str, IntervalSeries]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "IntervalSeries"}]}}
|
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "IntervalSeries"}]}}
|
||||||
)
|
)
|
||||||
name: str = Field(...)
|
|
||||||
|
|
||||||
|
|
||||||
class BehavioralEvents(NWBDataInterface):
|
class BehavioralEvents(NWBDataInterface):
|
||||||
|
@ -227,10 +245,13 @@ class BehavioralEvents(NWBDataInterface):
|
||||||
{"from_schema": "core.nwb.behavior", "tree_root": True}
|
{"from_schema": "core.nwb.behavior", "tree_root": True}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
name: str = Field(
|
||||||
|
"BehavioralEvents",
|
||||||
|
json_schema_extra={"linkml_meta": {"ifabsent": "string(BehavioralEvents)"}},
|
||||||
|
)
|
||||||
value: Optional[Dict[str, TimeSeries]] = Field(
|
value: Optional[Dict[str, TimeSeries]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "TimeSeries"}]}}
|
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "TimeSeries"}]}}
|
||||||
)
|
)
|
||||||
name: str = Field(...)
|
|
||||||
|
|
||||||
|
|
||||||
class BehavioralTimeSeries(NWBDataInterface):
|
class BehavioralTimeSeries(NWBDataInterface):
|
||||||
|
@ -242,10 +263,13 @@ class BehavioralTimeSeries(NWBDataInterface):
|
||||||
{"from_schema": "core.nwb.behavior", "tree_root": True}
|
{"from_schema": "core.nwb.behavior", "tree_root": True}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
name: str = Field(
|
||||||
|
"BehavioralTimeSeries",
|
||||||
|
json_schema_extra={"linkml_meta": {"ifabsent": "string(BehavioralTimeSeries)"}},
|
||||||
|
)
|
||||||
value: Optional[Dict[str, TimeSeries]] = Field(
|
value: Optional[Dict[str, TimeSeries]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "TimeSeries"}]}}
|
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "TimeSeries"}]}}
|
||||||
)
|
)
|
||||||
name: str = Field(...)
|
|
||||||
|
|
||||||
|
|
||||||
class PupilTracking(NWBDataInterface):
|
class PupilTracking(NWBDataInterface):
|
||||||
|
@ -257,10 +281,12 @@ class PupilTracking(NWBDataInterface):
|
||||||
{"from_schema": "core.nwb.behavior", "tree_root": True}
|
{"from_schema": "core.nwb.behavior", "tree_root": True}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
name: str = Field(
|
||||||
|
"PupilTracking", json_schema_extra={"linkml_meta": {"ifabsent": "string(PupilTracking)"}}
|
||||||
|
)
|
||||||
value: Optional[Dict[str, TimeSeries]] = Field(
|
value: Optional[Dict[str, TimeSeries]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "TimeSeries"}]}}
|
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "TimeSeries"}]}}
|
||||||
)
|
)
|
||||||
name: str = Field(...)
|
|
||||||
|
|
||||||
|
|
||||||
class EyeTracking(NWBDataInterface):
|
class EyeTracking(NWBDataInterface):
|
||||||
|
@ -272,10 +298,12 @@ class EyeTracking(NWBDataInterface):
|
||||||
{"from_schema": "core.nwb.behavior", "tree_root": True}
|
{"from_schema": "core.nwb.behavior", "tree_root": True}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
name: str = Field(
|
||||||
|
"EyeTracking", json_schema_extra={"linkml_meta": {"ifabsent": "string(EyeTracking)"}}
|
||||||
|
)
|
||||||
value: Optional[Dict[str, SpatialSeries]] = Field(
|
value: Optional[Dict[str, SpatialSeries]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "SpatialSeries"}]}}
|
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "SpatialSeries"}]}}
|
||||||
)
|
)
|
||||||
name: str = Field(...)
|
|
||||||
|
|
||||||
|
|
||||||
class CompassDirection(NWBDataInterface):
|
class CompassDirection(NWBDataInterface):
|
||||||
|
@ -287,10 +315,13 @@ class CompassDirection(NWBDataInterface):
|
||||||
{"from_schema": "core.nwb.behavior", "tree_root": True}
|
{"from_schema": "core.nwb.behavior", "tree_root": True}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
name: str = Field(
|
||||||
|
"CompassDirection",
|
||||||
|
json_schema_extra={"linkml_meta": {"ifabsent": "string(CompassDirection)"}},
|
||||||
|
)
|
||||||
value: Optional[Dict[str, SpatialSeries]] = Field(
|
value: Optional[Dict[str, SpatialSeries]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "SpatialSeries"}]}}
|
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "SpatialSeries"}]}}
|
||||||
)
|
)
|
||||||
name: str = Field(...)
|
|
||||||
|
|
||||||
|
|
||||||
class Position(NWBDataInterface):
|
class Position(NWBDataInterface):
|
||||||
|
@ -302,10 +333,12 @@ class Position(NWBDataInterface):
|
||||||
{"from_schema": "core.nwb.behavior", "tree_root": True}
|
{"from_schema": "core.nwb.behavior", "tree_root": True}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
name: str = Field(
|
||||||
|
"Position", json_schema_extra={"linkml_meta": {"ifabsent": "string(Position)"}}
|
||||||
|
)
|
||||||
value: Optional[Dict[str, SpatialSeries]] = Field(
|
value: Optional[Dict[str, SpatialSeries]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "SpatialSeries"}]}}
|
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "SpatialSeries"}]}}
|
||||||
)
|
)
|
||||||
name: str = Field(...)
|
|
||||||
|
|
||||||
|
|
||||||
# Model rebuild
|
# Model rebuild
|
||||||
|
|
|
@ -42,7 +42,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -55,6 +55,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -65,7 +77,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -59,7 +59,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -72,6 +72,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -82,7 +94,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
@ -243,9 +258,9 @@ class ElectricalSeriesData(ConfiguredBaseModel):
|
||||||
)
|
)
|
||||||
value: Optional[
|
value: Optional[
|
||||||
Union[
|
Union[
|
||||||
NDArray[Shape["* num_times"], float],
|
NDArray[Shape["* num_times"], float | int],
|
||||||
NDArray[Shape["* num_times, * num_channels"], float],
|
NDArray[Shape["* num_times, * num_channels"], float | int],
|
||||||
NDArray[Shape["* num_times, * num_channels, * num_samples"], float],
|
NDArray[Shape["* num_times, * num_channels, * num_samples"], float | int],
|
||||||
]
|
]
|
||||||
] = Field(None)
|
] = Field(None)
|
||||||
|
|
||||||
|
@ -351,8 +366,8 @@ class SpikeEventSeriesData(ConfiguredBaseModel):
|
||||||
)
|
)
|
||||||
value: Optional[
|
value: Optional[
|
||||||
Union[
|
Union[
|
||||||
NDArray[Shape["* num_events, * num_samples"], float],
|
NDArray[Shape["* num_events, * num_samples"], float | int],
|
||||||
NDArray[Shape["* num_events, * num_channels, * num_samples"], float],
|
NDArray[Shape["* num_events, * num_channels, * num_samples"], float | int],
|
||||||
]
|
]
|
||||||
] = Field(None)
|
] = Field(None)
|
||||||
|
|
||||||
|
@ -455,10 +470,12 @@ class EventWaveform(NWBDataInterface):
|
||||||
{"from_schema": "core.nwb.ecephys", "tree_root": True}
|
{"from_schema": "core.nwb.ecephys", "tree_root": True}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
name: str = Field(
|
||||||
|
"EventWaveform", json_schema_extra={"linkml_meta": {"ifabsent": "string(EventWaveform)"}}
|
||||||
|
)
|
||||||
value: Optional[Dict[str, SpikeEventSeries]] = Field(
|
value: Optional[Dict[str, SpikeEventSeries]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "SpikeEventSeries"}]}}
|
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "SpikeEventSeries"}]}}
|
||||||
)
|
)
|
||||||
name: str = Field(...)
|
|
||||||
|
|
||||||
|
|
||||||
class FilteredEphys(NWBDataInterface):
|
class FilteredEphys(NWBDataInterface):
|
||||||
|
@ -470,10 +487,12 @@ class FilteredEphys(NWBDataInterface):
|
||||||
{"from_schema": "core.nwb.ecephys", "tree_root": True}
|
{"from_schema": "core.nwb.ecephys", "tree_root": True}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
name: str = Field(
|
||||||
|
"FilteredEphys", json_schema_extra={"linkml_meta": {"ifabsent": "string(FilteredEphys)"}}
|
||||||
|
)
|
||||||
value: Optional[Dict[str, ElectricalSeries]] = Field(
|
value: Optional[Dict[str, ElectricalSeries]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "ElectricalSeries"}]}}
|
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "ElectricalSeries"}]}}
|
||||||
)
|
)
|
||||||
name: str = Field(...)
|
|
||||||
|
|
||||||
|
|
||||||
class LFP(NWBDataInterface):
|
class LFP(NWBDataInterface):
|
||||||
|
@ -485,10 +504,10 @@ class LFP(NWBDataInterface):
|
||||||
{"from_schema": "core.nwb.ecephys", "tree_root": True}
|
{"from_schema": "core.nwb.ecephys", "tree_root": True}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
name: str = Field("LFP", json_schema_extra={"linkml_meta": {"ifabsent": "string(LFP)"}})
|
||||||
value: Optional[Dict[str, ElectricalSeries]] = Field(
|
value: Optional[Dict[str, ElectricalSeries]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "ElectricalSeries"}]}}
|
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "ElectricalSeries"}]}}
|
||||||
)
|
)
|
||||||
name: str = Field(...)
|
|
||||||
|
|
||||||
|
|
||||||
class ElectrodeGroup(NWBContainer):
|
class ElectrodeGroup(NWBContainer):
|
||||||
|
|
|
@ -57,7 +57,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -70,6 +70,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -80,7 +92,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -62,7 +62,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -75,6 +75,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -85,7 +97,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -63,7 +63,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -76,6 +76,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -86,7 +98,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
@ -242,7 +257,7 @@ class PatchClampSeriesData(ConfiguredBaseModel):
|
||||||
...,
|
...,
|
||||||
description="""Base unit of measurement for working with the data. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion'.""",
|
description="""Base unit of measurement for working with the data. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion'.""",
|
||||||
)
|
)
|
||||||
value: Optional[NDArray[Shape["* num_times"], float]] = Field(
|
value: Optional[NDArray[Shape["* num_times"], float | int]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_times"}]}}}
|
None, json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_times"}]}}}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -349,7 +364,7 @@ class CurrentClampSeriesData(ConfiguredBaseModel):
|
||||||
description="""Base unit of measurement for working with the data. which is fixed to 'volts'. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion'.""",
|
description="""Base unit of measurement for working with the data. which is fixed to 'volts'. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion'.""",
|
||||||
json_schema_extra={"linkml_meta": {"equals_string": "volts", "ifabsent": "string(volts)"}},
|
json_schema_extra={"linkml_meta": {"equals_string": "volts", "ifabsent": "string(volts)"}},
|
||||||
)
|
)
|
||||||
value: Optional[NDArray[Shape["* num_times"], float]] = Field(
|
value: Optional[NDArray[Shape["* num_times"], float | int]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_times"}]}}}
|
None, json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_times"}]}}}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -527,7 +542,7 @@ class CurrentClampStimulusSeriesData(ConfiguredBaseModel):
|
||||||
"linkml_meta": {"equals_string": "amperes", "ifabsent": "string(amperes)"}
|
"linkml_meta": {"equals_string": "amperes", "ifabsent": "string(amperes)"}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
value: Optional[NDArray[Shape["* num_times"], float]] = Field(
|
value: Optional[NDArray[Shape["* num_times"], float | int]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_times"}]}}}
|
None, json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_times"}]}}}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -704,7 +719,7 @@ class VoltageClampSeriesData(ConfiguredBaseModel):
|
||||||
"linkml_meta": {"equals_string": "amperes", "ifabsent": "string(amperes)"}
|
"linkml_meta": {"equals_string": "amperes", "ifabsent": "string(amperes)"}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
value: Optional[NDArray[Shape["* num_times"], float]] = Field(
|
value: Optional[NDArray[Shape["* num_times"], float | int]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_times"}]}}}
|
None, json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_times"}]}}}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -932,7 +947,7 @@ class VoltageClampStimulusSeriesData(ConfiguredBaseModel):
|
||||||
description="""Base unit of measurement for working with the data. which is fixed to 'volts'. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion'.""",
|
description="""Base unit of measurement for working with the data. which is fixed to 'volts'. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion'.""",
|
||||||
json_schema_extra={"linkml_meta": {"equals_string": "volts", "ifabsent": "string(volts)"}},
|
json_schema_extra={"linkml_meta": {"equals_string": "volts", "ifabsent": "string(volts)"}},
|
||||||
)
|
)
|
||||||
value: Optional[NDArray[Shape["* num_times"], float]] = Field(
|
value: Optional[NDArray[Shape["* num_times"], float | int]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_times"}]}}}
|
None, json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_times"}]}}}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -57,6 +57,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -67,7 +79,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
@ -116,7 +131,7 @@ class GrayscaleImage(Image):
|
||||||
)
|
)
|
||||||
|
|
||||||
name: str = Field(...)
|
name: str = Field(...)
|
||||||
value: Optional[NDArray[Shape["* x, * y"], float]] = Field(
|
value: Optional[NDArray[Shape["* x, * y"], float | int]] = Field(
|
||||||
None,
|
None,
|
||||||
json_schema_extra={
|
json_schema_extra={
|
||||||
"linkml_meta": {"array": {"dimensions": [{"alias": "x"}, {"alias": "y"}]}}
|
"linkml_meta": {"array": {"dimensions": [{"alias": "x"}, {"alias": "y"}]}}
|
||||||
|
@ -138,7 +153,7 @@ class RGBImage(Image):
|
||||||
)
|
)
|
||||||
|
|
||||||
name: str = Field(...)
|
name: str = Field(...)
|
||||||
value: Optional[NDArray[Shape["* x, * y, 3 r_g_b"], float]] = Field(
|
value: Optional[NDArray[Shape["* x, * y, 3 r_g_b"], float | int]] = Field(
|
||||||
None,
|
None,
|
||||||
json_schema_extra={
|
json_schema_extra={
|
||||||
"linkml_meta": {
|
"linkml_meta": {
|
||||||
|
@ -168,7 +183,7 @@ class RGBAImage(Image):
|
||||||
)
|
)
|
||||||
|
|
||||||
name: str = Field(...)
|
name: str = Field(...)
|
||||||
value: Optional[NDArray[Shape["* x, * y, 4 r_g_b_a"], float]] = Field(
|
value: Optional[NDArray[Shape["* x, * y, 4 r_g_b_a"], float | int]] = Field(
|
||||||
None,
|
None,
|
||||||
json_schema_extra={
|
json_schema_extra={
|
||||||
"linkml_meta": {
|
"linkml_meta": {
|
||||||
|
@ -292,8 +307,8 @@ class ImageSeriesData(ConfiguredBaseModel):
|
||||||
)
|
)
|
||||||
value: Optional[
|
value: Optional[
|
||||||
Union[
|
Union[
|
||||||
NDArray[Shape["* frame, * x, * y"], float],
|
NDArray[Shape["* frame, * x, * y"], float | int],
|
||||||
NDArray[Shape["* frame, * x, * y, * z"], float],
|
NDArray[Shape["* frame, * x, * y, * z"], float | int],
|
||||||
]
|
]
|
||||||
] = Field(None)
|
] = Field(None)
|
||||||
|
|
||||||
|
@ -518,8 +533,8 @@ class OpticalSeriesData(ConfiguredBaseModel):
|
||||||
)
|
)
|
||||||
value: Optional[
|
value: Optional[
|
||||||
Union[
|
Union[
|
||||||
NDArray[Shape["* frame, * x, * y"], float],
|
NDArray[Shape["* frame, * x, * y"], float | int],
|
||||||
NDArray[Shape["* frame, * x, * y, 3 r_g_b"], float],
|
NDArray[Shape["* frame, * x, * y, 3 r_g_b"], float | int],
|
||||||
]
|
]
|
||||||
] = Field(None)
|
] = Field(None)
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -72,6 +72,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -82,7 +94,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
@ -234,8 +249,8 @@ class AbstractFeatureSeriesData(ConfiguredBaseModel):
|
||||||
)
|
)
|
||||||
value: Optional[
|
value: Optional[
|
||||||
Union[
|
Union[
|
||||||
NDArray[Shape["* num_times"], float],
|
NDArray[Shape["* num_times"], float | int],
|
||||||
NDArray[Shape["* num_times, * num_features"], float],
|
NDArray[Shape["* num_times, * num_features"], float | int],
|
||||||
]
|
]
|
||||||
] = Field(None)
|
] = Field(None)
|
||||||
|
|
||||||
|
@ -520,19 +535,21 @@ class DecompositionSeriesData(ConfiguredBaseModel):
|
||||||
description="""Base unit of measurement for working with the data. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion'.""",
|
description="""Base unit of measurement for working with the data. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion'.""",
|
||||||
json_schema_extra={"linkml_meta": {"ifabsent": "string(no unit)"}},
|
json_schema_extra={"linkml_meta": {"ifabsent": "string(no unit)"}},
|
||||||
)
|
)
|
||||||
value: Optional[NDArray[Shape["* num_times, * num_channels, * num_bands"], float]] = Field(
|
value: Optional[NDArray[Shape["* num_times, * num_channels, * num_bands"], float | int]] = (
|
||||||
None,
|
Field(
|
||||||
json_schema_extra={
|
None,
|
||||||
"linkml_meta": {
|
json_schema_extra={
|
||||||
"array": {
|
"linkml_meta": {
|
||||||
"dimensions": [
|
"array": {
|
||||||
{"alias": "num_times"},
|
"dimensions": [
|
||||||
{"alias": "num_channels"},
|
{"alias": "num_times"},
|
||||||
{"alias": "num_bands"},
|
{"alias": "num_channels"},
|
||||||
]
|
{"alias": "num_bands"},
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -62,6 +62,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -72,7 +84,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
@ -200,7 +215,7 @@ class OptogeneticSeriesData(ConfiguredBaseModel):
|
||||||
description="""Unit of measurement for data, which is fixed to 'watts'.""",
|
description="""Unit of measurement for data, which is fixed to 'watts'.""",
|
||||||
json_schema_extra={"linkml_meta": {"equals_string": "watts", "ifabsent": "string(watts)"}},
|
json_schema_extra={"linkml_meta": {"equals_string": "watts", "ifabsent": "string(watts)"}},
|
||||||
)
|
)
|
||||||
value: Optional[NDArray[Shape["* num_times"], float]] = Field(
|
value: Optional[NDArray[Shape["* num_times"], float | int]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_times"}]}}}
|
None, json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_times"}]}}}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -79,6 +79,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -89,7 +101,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
@ -333,7 +348,8 @@ class RoiResponseSeriesData(ConfiguredBaseModel):
|
||||||
)
|
)
|
||||||
value: Optional[
|
value: Optional[
|
||||||
Union[
|
Union[
|
||||||
NDArray[Shape["* num_times"], float], NDArray[Shape["* num_times, * num_rois"], float]
|
NDArray[Shape["* num_times"], float | int],
|
||||||
|
NDArray[Shape["* num_times, * num_rois"], float | int],
|
||||||
]
|
]
|
||||||
] = Field(None)
|
] = Field(None)
|
||||||
|
|
||||||
|
@ -347,10 +363,10 @@ class DfOverF(NWBDataInterface):
|
||||||
{"from_schema": "core.nwb.ophys", "tree_root": True}
|
{"from_schema": "core.nwb.ophys", "tree_root": True}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
name: str = Field("DfOverF", json_schema_extra={"linkml_meta": {"ifabsent": "string(DfOverF)"}})
|
||||||
value: Optional[Dict[str, RoiResponseSeries]] = Field(
|
value: Optional[Dict[str, RoiResponseSeries]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "RoiResponseSeries"}]}}
|
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "RoiResponseSeries"}]}}
|
||||||
)
|
)
|
||||||
name: str = Field(...)
|
|
||||||
|
|
||||||
|
|
||||||
class Fluorescence(NWBDataInterface):
|
class Fluorescence(NWBDataInterface):
|
||||||
|
@ -362,10 +378,12 @@ class Fluorescence(NWBDataInterface):
|
||||||
{"from_schema": "core.nwb.ophys", "tree_root": True}
|
{"from_schema": "core.nwb.ophys", "tree_root": True}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
name: str = Field(
|
||||||
|
"Fluorescence", json_schema_extra={"linkml_meta": {"ifabsent": "string(Fluorescence)"}}
|
||||||
|
)
|
||||||
value: Optional[Dict[str, RoiResponseSeries]] = Field(
|
value: Optional[Dict[str, RoiResponseSeries]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "RoiResponseSeries"}]}}
|
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "RoiResponseSeries"}]}}
|
||||||
)
|
)
|
||||||
name: str = Field(...)
|
|
||||||
|
|
||||||
|
|
||||||
class ImageSegmentation(NWBDataInterface):
|
class ImageSegmentation(NWBDataInterface):
|
||||||
|
@ -377,10 +395,13 @@ class ImageSegmentation(NWBDataInterface):
|
||||||
{"from_schema": "core.nwb.ophys", "tree_root": True}
|
{"from_schema": "core.nwb.ophys", "tree_root": True}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
name: str = Field(
|
||||||
|
"ImageSegmentation",
|
||||||
|
json_schema_extra={"linkml_meta": {"ifabsent": "string(ImageSegmentation)"}},
|
||||||
|
)
|
||||||
value: Optional[Dict[str, PlaneSegmentation]] = Field(
|
value: Optional[Dict[str, PlaneSegmentation]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "PlaneSegmentation"}]}}
|
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "PlaneSegmentation"}]}}
|
||||||
)
|
)
|
||||||
name: str = Field(...)
|
|
||||||
|
|
||||||
|
|
||||||
class PlaneSegmentation(DynamicTable):
|
class PlaneSegmentation(DynamicTable):
|
||||||
|
@ -696,10 +717,13 @@ class MotionCorrection(NWBDataInterface):
|
||||||
{"from_schema": "core.nwb.ophys", "tree_root": True}
|
{"from_schema": "core.nwb.ophys", "tree_root": True}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
name: str = Field(
|
||||||
|
"MotionCorrection",
|
||||||
|
json_schema_extra={"linkml_meta": {"ifabsent": "string(MotionCorrection)"}},
|
||||||
|
)
|
||||||
value: Optional[Dict[str, CorrectedImageStack]] = Field(
|
value: Optional[Dict[str, CorrectedImageStack]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "CorrectedImageStack"}]}}
|
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "CorrectedImageStack"}]}}
|
||||||
)
|
)
|
||||||
name: str = Field(...)
|
|
||||||
|
|
||||||
|
|
||||||
class CorrectedImageStack(NWBDataInterface):
|
class CorrectedImageStack(NWBDataInterface):
|
||||||
|
|
|
@ -43,7 +43,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -56,6 +56,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -66,7 +78,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -197,7 +197,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -210,6 +210,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -220,7 +232,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -57,7 +57,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -70,6 +70,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -80,7 +92,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
@ -109,7 +124,7 @@ NUMPYDANTIC_VERSION = "1.2.1"
|
||||||
T = TypeVar("T", bound=NDArray)
|
T = TypeVar("T", bound=NDArray)
|
||||||
|
|
||||||
|
|
||||||
class VectorDataMixin(BaseModel, Generic[T]):
|
class VectorDataMixin(ConfiguredBaseModel, Generic[T]):
|
||||||
"""
|
"""
|
||||||
Mixin class to give VectorData indexing abilities
|
Mixin class to give VectorData indexing abilities
|
||||||
"""
|
"""
|
||||||
|
@ -333,9 +348,9 @@ class Image(NWBData):
|
||||||
description: Optional[str] = Field(None, description="""Description of the image.""")
|
description: Optional[str] = Field(None, description="""Description of the image.""")
|
||||||
value: Optional[
|
value: Optional[
|
||||||
Union[
|
Union[
|
||||||
NDArray[Shape["* x, * y"], float],
|
NDArray[Shape["* x, * y"], float | int],
|
||||||
NDArray[Shape["* x, * y, 3 r_g_b"], float],
|
NDArray[Shape["* x, * y, 3 r_g_b"], float | int],
|
||||||
NDArray[Shape["* x, * y, 4 r_g_b_a"], float],
|
NDArray[Shape["* x, * y, 4 r_g_b_a"], float | int],
|
||||||
]
|
]
|
||||||
] = Field(None)
|
] = Field(None)
|
||||||
|
|
||||||
|
@ -500,13 +515,16 @@ class ProcessingModule(NWBContainer):
|
||||||
{"from_schema": "core.nwb.base", "tree_root": True}
|
{"from_schema": "core.nwb.base", "tree_root": True}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
name: str = Field(...)
|
||||||
|
description: str = Field(
|
||||||
|
..., description="""Description of this collection of processed data."""
|
||||||
|
)
|
||||||
value: Optional[Dict[str, Union[DynamicTable, NWBDataInterface]]] = Field(
|
value: Optional[Dict[str, Union[DynamicTable, NWBDataInterface]]] = Field(
|
||||||
None,
|
None,
|
||||||
json_schema_extra={
|
json_schema_extra={
|
||||||
"linkml_meta": {"any_of": [{"range": "NWBDataInterface"}, {"range": "DynamicTable"}]}
|
"linkml_meta": {"any_of": [{"range": "NWBDataInterface"}, {"range": "DynamicTable"}]}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
name: str = Field(...)
|
|
||||||
|
|
||||||
|
|
||||||
class Images(NWBDataInterface):
|
class Images(NWBDataInterface):
|
||||||
|
|
|
@ -49,7 +49,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -62,6 +62,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -72,7 +84,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
@ -197,8 +212,8 @@ class SpatialSeriesData(ConfiguredBaseModel):
|
||||||
)
|
)
|
||||||
value: Optional[
|
value: Optional[
|
||||||
Union[
|
Union[
|
||||||
NDArray[Shape["* num_times"], float],
|
NDArray[Shape["* num_times"], float | int],
|
||||||
NDArray[Shape["* num_times, * num_features"], float],
|
NDArray[Shape["* num_times, * num_features"], float | int],
|
||||||
]
|
]
|
||||||
] = Field(None)
|
] = Field(None)
|
||||||
|
|
||||||
|
@ -212,10 +227,13 @@ class BehavioralEpochs(NWBDataInterface):
|
||||||
{"from_schema": "core.nwb.behavior", "tree_root": True}
|
{"from_schema": "core.nwb.behavior", "tree_root": True}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
name: str = Field(
|
||||||
|
"BehavioralEpochs",
|
||||||
|
json_schema_extra={"linkml_meta": {"ifabsent": "string(BehavioralEpochs)"}},
|
||||||
|
)
|
||||||
value: Optional[Dict[str, IntervalSeries]] = Field(
|
value: Optional[Dict[str, IntervalSeries]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "IntervalSeries"}]}}
|
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "IntervalSeries"}]}}
|
||||||
)
|
)
|
||||||
name: str = Field(...)
|
|
||||||
|
|
||||||
|
|
||||||
class BehavioralEvents(NWBDataInterface):
|
class BehavioralEvents(NWBDataInterface):
|
||||||
|
@ -227,10 +245,13 @@ class BehavioralEvents(NWBDataInterface):
|
||||||
{"from_schema": "core.nwb.behavior", "tree_root": True}
|
{"from_schema": "core.nwb.behavior", "tree_root": True}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
name: str = Field(
|
||||||
|
"BehavioralEvents",
|
||||||
|
json_schema_extra={"linkml_meta": {"ifabsent": "string(BehavioralEvents)"}},
|
||||||
|
)
|
||||||
value: Optional[Dict[str, TimeSeries]] = Field(
|
value: Optional[Dict[str, TimeSeries]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "TimeSeries"}]}}
|
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "TimeSeries"}]}}
|
||||||
)
|
)
|
||||||
name: str = Field(...)
|
|
||||||
|
|
||||||
|
|
||||||
class BehavioralTimeSeries(NWBDataInterface):
|
class BehavioralTimeSeries(NWBDataInterface):
|
||||||
|
@ -242,10 +263,13 @@ class BehavioralTimeSeries(NWBDataInterface):
|
||||||
{"from_schema": "core.nwb.behavior", "tree_root": True}
|
{"from_schema": "core.nwb.behavior", "tree_root": True}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
name: str = Field(
|
||||||
|
"BehavioralTimeSeries",
|
||||||
|
json_schema_extra={"linkml_meta": {"ifabsent": "string(BehavioralTimeSeries)"}},
|
||||||
|
)
|
||||||
value: Optional[Dict[str, TimeSeries]] = Field(
|
value: Optional[Dict[str, TimeSeries]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "TimeSeries"}]}}
|
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "TimeSeries"}]}}
|
||||||
)
|
)
|
||||||
name: str = Field(...)
|
|
||||||
|
|
||||||
|
|
||||||
class PupilTracking(NWBDataInterface):
|
class PupilTracking(NWBDataInterface):
|
||||||
|
@ -257,10 +281,12 @@ class PupilTracking(NWBDataInterface):
|
||||||
{"from_schema": "core.nwb.behavior", "tree_root": True}
|
{"from_schema": "core.nwb.behavior", "tree_root": True}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
name: str = Field(
|
||||||
|
"PupilTracking", json_schema_extra={"linkml_meta": {"ifabsent": "string(PupilTracking)"}}
|
||||||
|
)
|
||||||
value: Optional[Dict[str, TimeSeries]] = Field(
|
value: Optional[Dict[str, TimeSeries]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "TimeSeries"}]}}
|
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "TimeSeries"}]}}
|
||||||
)
|
)
|
||||||
name: str = Field(...)
|
|
||||||
|
|
||||||
|
|
||||||
class EyeTracking(NWBDataInterface):
|
class EyeTracking(NWBDataInterface):
|
||||||
|
@ -272,10 +298,12 @@ class EyeTracking(NWBDataInterface):
|
||||||
{"from_schema": "core.nwb.behavior", "tree_root": True}
|
{"from_schema": "core.nwb.behavior", "tree_root": True}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
name: str = Field(
|
||||||
|
"EyeTracking", json_schema_extra={"linkml_meta": {"ifabsent": "string(EyeTracking)"}}
|
||||||
|
)
|
||||||
value: Optional[Dict[str, SpatialSeries]] = Field(
|
value: Optional[Dict[str, SpatialSeries]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "SpatialSeries"}]}}
|
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "SpatialSeries"}]}}
|
||||||
)
|
)
|
||||||
name: str = Field(...)
|
|
||||||
|
|
||||||
|
|
||||||
class CompassDirection(NWBDataInterface):
|
class CompassDirection(NWBDataInterface):
|
||||||
|
@ -287,10 +315,13 @@ class CompassDirection(NWBDataInterface):
|
||||||
{"from_schema": "core.nwb.behavior", "tree_root": True}
|
{"from_schema": "core.nwb.behavior", "tree_root": True}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
name: str = Field(
|
||||||
|
"CompassDirection",
|
||||||
|
json_schema_extra={"linkml_meta": {"ifabsent": "string(CompassDirection)"}},
|
||||||
|
)
|
||||||
value: Optional[Dict[str, SpatialSeries]] = Field(
|
value: Optional[Dict[str, SpatialSeries]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "SpatialSeries"}]}}
|
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "SpatialSeries"}]}}
|
||||||
)
|
)
|
||||||
name: str = Field(...)
|
|
||||||
|
|
||||||
|
|
||||||
class Position(NWBDataInterface):
|
class Position(NWBDataInterface):
|
||||||
|
@ -302,10 +333,12 @@ class Position(NWBDataInterface):
|
||||||
{"from_schema": "core.nwb.behavior", "tree_root": True}
|
{"from_schema": "core.nwb.behavior", "tree_root": True}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
name: str = Field(
|
||||||
|
"Position", json_schema_extra={"linkml_meta": {"ifabsent": "string(Position)"}}
|
||||||
|
)
|
||||||
value: Optional[Dict[str, SpatialSeries]] = Field(
|
value: Optional[Dict[str, SpatialSeries]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "SpatialSeries"}]}}
|
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "SpatialSeries"}]}}
|
||||||
)
|
)
|
||||||
name: str = Field(...)
|
|
||||||
|
|
||||||
|
|
||||||
# Model rebuild
|
# Model rebuild
|
||||||
|
|
|
@ -42,7 +42,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -55,6 +55,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -65,7 +77,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -59,7 +59,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -72,6 +72,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -82,7 +94,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
@ -243,9 +258,9 @@ class ElectricalSeriesData(ConfiguredBaseModel):
|
||||||
)
|
)
|
||||||
value: Optional[
|
value: Optional[
|
||||||
Union[
|
Union[
|
||||||
NDArray[Shape["* num_times"], float],
|
NDArray[Shape["* num_times"], float | int],
|
||||||
NDArray[Shape["* num_times, * num_channels"], float],
|
NDArray[Shape["* num_times, * num_channels"], float | int],
|
||||||
NDArray[Shape["* num_times, * num_channels, * num_samples"], float],
|
NDArray[Shape["* num_times, * num_channels, * num_samples"], float | int],
|
||||||
]
|
]
|
||||||
] = Field(None)
|
] = Field(None)
|
||||||
|
|
||||||
|
@ -351,8 +366,8 @@ class SpikeEventSeriesData(ConfiguredBaseModel):
|
||||||
)
|
)
|
||||||
value: Optional[
|
value: Optional[
|
||||||
Union[
|
Union[
|
||||||
NDArray[Shape["* num_events, * num_samples"], float],
|
NDArray[Shape["* num_events, * num_samples"], float | int],
|
||||||
NDArray[Shape["* num_events, * num_channels, * num_samples"], float],
|
NDArray[Shape["* num_events, * num_channels, * num_samples"], float | int],
|
||||||
]
|
]
|
||||||
] = Field(None)
|
] = Field(None)
|
||||||
|
|
||||||
|
@ -455,10 +470,12 @@ class EventWaveform(NWBDataInterface):
|
||||||
{"from_schema": "core.nwb.ecephys", "tree_root": True}
|
{"from_schema": "core.nwb.ecephys", "tree_root": True}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
name: str = Field(
|
||||||
|
"EventWaveform", json_schema_extra={"linkml_meta": {"ifabsent": "string(EventWaveform)"}}
|
||||||
|
)
|
||||||
value: Optional[Dict[str, SpikeEventSeries]] = Field(
|
value: Optional[Dict[str, SpikeEventSeries]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "SpikeEventSeries"}]}}
|
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "SpikeEventSeries"}]}}
|
||||||
)
|
)
|
||||||
name: str = Field(...)
|
|
||||||
|
|
||||||
|
|
||||||
class FilteredEphys(NWBDataInterface):
|
class FilteredEphys(NWBDataInterface):
|
||||||
|
@ -470,10 +487,12 @@ class FilteredEphys(NWBDataInterface):
|
||||||
{"from_schema": "core.nwb.ecephys", "tree_root": True}
|
{"from_schema": "core.nwb.ecephys", "tree_root": True}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
name: str = Field(
|
||||||
|
"FilteredEphys", json_schema_extra={"linkml_meta": {"ifabsent": "string(FilteredEphys)"}}
|
||||||
|
)
|
||||||
value: Optional[Dict[str, ElectricalSeries]] = Field(
|
value: Optional[Dict[str, ElectricalSeries]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "ElectricalSeries"}]}}
|
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "ElectricalSeries"}]}}
|
||||||
)
|
)
|
||||||
name: str = Field(...)
|
|
||||||
|
|
||||||
|
|
||||||
class LFP(NWBDataInterface):
|
class LFP(NWBDataInterface):
|
||||||
|
@ -485,10 +504,10 @@ class LFP(NWBDataInterface):
|
||||||
{"from_schema": "core.nwb.ecephys", "tree_root": True}
|
{"from_schema": "core.nwb.ecephys", "tree_root": True}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
name: str = Field("LFP", json_schema_extra={"linkml_meta": {"ifabsent": "string(LFP)"}})
|
||||||
value: Optional[Dict[str, ElectricalSeries]] = Field(
|
value: Optional[Dict[str, ElectricalSeries]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "ElectricalSeries"}]}}
|
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "ElectricalSeries"}]}}
|
||||||
)
|
)
|
||||||
name: str = Field(...)
|
|
||||||
|
|
||||||
|
|
||||||
class ElectrodeGroup(NWBContainer):
|
class ElectrodeGroup(NWBContainer):
|
||||||
|
|
|
@ -57,7 +57,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -70,6 +70,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -80,7 +92,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -70,7 +70,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -83,6 +83,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -93,7 +105,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -66,7 +66,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -79,6 +79,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -89,7 +101,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
@ -245,7 +260,7 @@ class PatchClampSeriesData(ConfiguredBaseModel):
|
||||||
...,
|
...,
|
||||||
description="""Base unit of measurement for working with the data. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion'.""",
|
description="""Base unit of measurement for working with the data. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion'.""",
|
||||||
)
|
)
|
||||||
value: Optional[NDArray[Shape["* num_times"], float]] = Field(
|
value: Optional[NDArray[Shape["* num_times"], float | int]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_times"}]}}}
|
None, json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_times"}]}}}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -352,7 +367,7 @@ class CurrentClampSeriesData(ConfiguredBaseModel):
|
||||||
description="""Base unit of measurement for working with the data. which is fixed to 'volts'. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion'.""",
|
description="""Base unit of measurement for working with the data. which is fixed to 'volts'. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion'.""",
|
||||||
json_schema_extra={"linkml_meta": {"equals_string": "volts", "ifabsent": "string(volts)"}},
|
json_schema_extra={"linkml_meta": {"equals_string": "volts", "ifabsent": "string(volts)"}},
|
||||||
)
|
)
|
||||||
value: Optional[NDArray[Shape["* num_times"], float]] = Field(
|
value: Optional[NDArray[Shape["* num_times"], float | int]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_times"}]}}}
|
None, json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_times"}]}}}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -530,7 +545,7 @@ class CurrentClampStimulusSeriesData(ConfiguredBaseModel):
|
||||||
"linkml_meta": {"equals_string": "amperes", "ifabsent": "string(amperes)"}
|
"linkml_meta": {"equals_string": "amperes", "ifabsent": "string(amperes)"}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
value: Optional[NDArray[Shape["* num_times"], float]] = Field(
|
value: Optional[NDArray[Shape["* num_times"], float | int]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_times"}]}}}
|
None, json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_times"}]}}}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -707,7 +722,7 @@ class VoltageClampSeriesData(ConfiguredBaseModel):
|
||||||
"linkml_meta": {"equals_string": "amperes", "ifabsent": "string(amperes)"}
|
"linkml_meta": {"equals_string": "amperes", "ifabsent": "string(amperes)"}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
value: Optional[NDArray[Shape["* num_times"], float]] = Field(
|
value: Optional[NDArray[Shape["* num_times"], float | int]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_times"}]}}}
|
None, json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_times"}]}}}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -935,7 +950,7 @@ class VoltageClampStimulusSeriesData(ConfiguredBaseModel):
|
||||||
description="""Base unit of measurement for working with the data. which is fixed to 'volts'. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion'.""",
|
description="""Base unit of measurement for working with the data. which is fixed to 'volts'. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion'.""",
|
||||||
json_schema_extra={"linkml_meta": {"equals_string": "volts", "ifabsent": "string(volts)"}},
|
json_schema_extra={"linkml_meta": {"equals_string": "volts", "ifabsent": "string(volts)"}},
|
||||||
)
|
)
|
||||||
value: Optional[NDArray[Shape["* num_times"], float]] = Field(
|
value: Optional[NDArray[Shape["* num_times"], float | int]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_times"}]}}}
|
None, json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_times"}]}}}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1204,6 +1219,10 @@ class IntracellularRecordingsTable(AlignedDynamicTable):
|
||||||
stimuli: IntracellularStimuliTable = Field(
|
stimuli: IntracellularStimuliTable = Field(
|
||||||
..., description="""Table for storing intracellular stimulus related metadata."""
|
..., description="""Table for storing intracellular stimulus related metadata."""
|
||||||
)
|
)
|
||||||
|
categories: List[str] = Field(
|
||||||
|
...,
|
||||||
|
description="""The names of the categories in this AlignedDynamicTable. Each category is represented by one DynamicTable stored in the parent group. This attribute should be used to specify an order of categories and the category names must match the names of the corresponding DynamicTable in the group.""",
|
||||||
|
)
|
||||||
value: Optional[Dict[str, DynamicTable]] = Field(
|
value: Optional[Dict[str, DynamicTable]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "DynamicTable"}]}}
|
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "DynamicTable"}]}}
|
||||||
)
|
)
|
||||||
|
|
|
@ -44,7 +44,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -57,6 +57,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -67,7 +79,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
@ -116,7 +131,7 @@ class GrayscaleImage(Image):
|
||||||
)
|
)
|
||||||
|
|
||||||
name: str = Field(...)
|
name: str = Field(...)
|
||||||
value: Optional[NDArray[Shape["* x, * y"], float]] = Field(
|
value: Optional[NDArray[Shape["* x, * y"], float | int]] = Field(
|
||||||
None,
|
None,
|
||||||
json_schema_extra={
|
json_schema_extra={
|
||||||
"linkml_meta": {"array": {"dimensions": [{"alias": "x"}, {"alias": "y"}]}}
|
"linkml_meta": {"array": {"dimensions": [{"alias": "x"}, {"alias": "y"}]}}
|
||||||
|
@ -138,7 +153,7 @@ class RGBImage(Image):
|
||||||
)
|
)
|
||||||
|
|
||||||
name: str = Field(...)
|
name: str = Field(...)
|
||||||
value: Optional[NDArray[Shape["* x, * y, 3 r_g_b"], float]] = Field(
|
value: Optional[NDArray[Shape["* x, * y, 3 r_g_b"], float | int]] = Field(
|
||||||
None,
|
None,
|
||||||
json_schema_extra={
|
json_schema_extra={
|
||||||
"linkml_meta": {
|
"linkml_meta": {
|
||||||
|
@ -168,7 +183,7 @@ class RGBAImage(Image):
|
||||||
)
|
)
|
||||||
|
|
||||||
name: str = Field(...)
|
name: str = Field(...)
|
||||||
value: Optional[NDArray[Shape["* x, * y, 4 r_g_b_a"], float]] = Field(
|
value: Optional[NDArray[Shape["* x, * y, 4 r_g_b_a"], float | int]] = Field(
|
||||||
None,
|
None,
|
||||||
json_schema_extra={
|
json_schema_extra={
|
||||||
"linkml_meta": {
|
"linkml_meta": {
|
||||||
|
@ -293,8 +308,8 @@ class ImageSeriesData(ConfiguredBaseModel):
|
||||||
)
|
)
|
||||||
value: Optional[
|
value: Optional[
|
||||||
Union[
|
Union[
|
||||||
NDArray[Shape["* frame, * x, * y"], float],
|
NDArray[Shape["* frame, * x, * y"], float | int],
|
||||||
NDArray[Shape["* frame, * x, * y, * z"], float],
|
NDArray[Shape["* frame, * x, * y, * z"], float | int],
|
||||||
]
|
]
|
||||||
] = Field(None)
|
] = Field(None)
|
||||||
|
|
||||||
|
@ -520,8 +535,8 @@ class OpticalSeriesData(ConfiguredBaseModel):
|
||||||
)
|
)
|
||||||
value: Optional[
|
value: Optional[
|
||||||
Union[
|
Union[
|
||||||
NDArray[Shape["* frame, * x, * y"], float],
|
NDArray[Shape["* frame, * x, * y"], float | int],
|
||||||
NDArray[Shape["* frame, * x, * y, 3 r_g_b"], float],
|
NDArray[Shape["* frame, * x, * y, 3 r_g_b"], float | int],
|
||||||
]
|
]
|
||||||
] = Field(None)
|
] = Field(None)
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -72,6 +72,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -82,7 +94,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
@ -234,8 +249,8 @@ class AbstractFeatureSeriesData(ConfiguredBaseModel):
|
||||||
)
|
)
|
||||||
value: Optional[
|
value: Optional[
|
||||||
Union[
|
Union[
|
||||||
NDArray[Shape["* num_times"], float],
|
NDArray[Shape["* num_times"], float | int],
|
||||||
NDArray[Shape["* num_times, * num_features"], float],
|
NDArray[Shape["* num_times, * num_features"], float | int],
|
||||||
]
|
]
|
||||||
] = Field(None)
|
] = Field(None)
|
||||||
|
|
||||||
|
@ -520,19 +535,21 @@ class DecompositionSeriesData(ConfiguredBaseModel):
|
||||||
description="""Base unit of measurement for working with the data. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion'.""",
|
description="""Base unit of measurement for working with the data. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion'.""",
|
||||||
json_schema_extra={"linkml_meta": {"ifabsent": "string(no unit)"}},
|
json_schema_extra={"linkml_meta": {"ifabsent": "string(no unit)"}},
|
||||||
)
|
)
|
||||||
value: Optional[NDArray[Shape["* num_times, * num_channels, * num_bands"], float]] = Field(
|
value: Optional[NDArray[Shape["* num_times, * num_channels, * num_bands"], float | int]] = (
|
||||||
None,
|
Field(
|
||||||
json_schema_extra={
|
None,
|
||||||
"linkml_meta": {
|
json_schema_extra={
|
||||||
"array": {
|
"linkml_meta": {
|
||||||
"dimensions": [
|
"array": {
|
||||||
{"alias": "num_times"},
|
"dimensions": [
|
||||||
{"alias": "num_channels"},
|
{"alias": "num_times"},
|
||||||
{"alias": "num_bands"},
|
{"alias": "num_channels"},
|
||||||
]
|
{"alias": "num_bands"},
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -62,6 +62,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -72,7 +84,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
@ -200,7 +215,7 @@ class OptogeneticSeriesData(ConfiguredBaseModel):
|
||||||
description="""Unit of measurement for data, which is fixed to 'watts'.""",
|
description="""Unit of measurement for data, which is fixed to 'watts'.""",
|
||||||
json_schema_extra={"linkml_meta": {"equals_string": "watts", "ifabsent": "string(watts)"}},
|
json_schema_extra={"linkml_meta": {"equals_string": "watts", "ifabsent": "string(watts)"}},
|
||||||
)
|
)
|
||||||
value: Optional[NDArray[Shape["* num_times"], float]] = Field(
|
value: Optional[NDArray[Shape["* num_times"], float | int]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_times"}]}}}
|
None, json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_times"}]}}}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -79,6 +79,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -89,7 +101,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
@ -334,7 +349,8 @@ class RoiResponseSeriesData(ConfiguredBaseModel):
|
||||||
)
|
)
|
||||||
value: Optional[
|
value: Optional[
|
||||||
Union[
|
Union[
|
||||||
NDArray[Shape["* num_times"], float], NDArray[Shape["* num_times, * num_rois"], float]
|
NDArray[Shape["* num_times"], float | int],
|
||||||
|
NDArray[Shape["* num_times, * num_rois"], float | int],
|
||||||
]
|
]
|
||||||
] = Field(None)
|
] = Field(None)
|
||||||
|
|
||||||
|
@ -348,10 +364,10 @@ class DfOverF(NWBDataInterface):
|
||||||
{"from_schema": "core.nwb.ophys", "tree_root": True}
|
{"from_schema": "core.nwb.ophys", "tree_root": True}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
name: str = Field("DfOverF", json_schema_extra={"linkml_meta": {"ifabsent": "string(DfOverF)"}})
|
||||||
value: Optional[Dict[str, RoiResponseSeries]] = Field(
|
value: Optional[Dict[str, RoiResponseSeries]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "RoiResponseSeries"}]}}
|
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "RoiResponseSeries"}]}}
|
||||||
)
|
)
|
||||||
name: str = Field(...)
|
|
||||||
|
|
||||||
|
|
||||||
class Fluorescence(NWBDataInterface):
|
class Fluorescence(NWBDataInterface):
|
||||||
|
@ -363,10 +379,12 @@ class Fluorescence(NWBDataInterface):
|
||||||
{"from_schema": "core.nwb.ophys", "tree_root": True}
|
{"from_schema": "core.nwb.ophys", "tree_root": True}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
name: str = Field(
|
||||||
|
"Fluorescence", json_schema_extra={"linkml_meta": {"ifabsent": "string(Fluorescence)"}}
|
||||||
|
)
|
||||||
value: Optional[Dict[str, RoiResponseSeries]] = Field(
|
value: Optional[Dict[str, RoiResponseSeries]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "RoiResponseSeries"}]}}
|
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "RoiResponseSeries"}]}}
|
||||||
)
|
)
|
||||||
name: str = Field(...)
|
|
||||||
|
|
||||||
|
|
||||||
class ImageSegmentation(NWBDataInterface):
|
class ImageSegmentation(NWBDataInterface):
|
||||||
|
@ -378,10 +396,13 @@ class ImageSegmentation(NWBDataInterface):
|
||||||
{"from_schema": "core.nwb.ophys", "tree_root": True}
|
{"from_schema": "core.nwb.ophys", "tree_root": True}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
name: str = Field(
|
||||||
|
"ImageSegmentation",
|
||||||
|
json_schema_extra={"linkml_meta": {"ifabsent": "string(ImageSegmentation)"}},
|
||||||
|
)
|
||||||
value: Optional[Dict[str, PlaneSegmentation]] = Field(
|
value: Optional[Dict[str, PlaneSegmentation]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "PlaneSegmentation"}]}}
|
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "PlaneSegmentation"}]}}
|
||||||
)
|
)
|
||||||
name: str = Field(...)
|
|
||||||
|
|
||||||
|
|
||||||
class PlaneSegmentation(DynamicTable):
|
class PlaneSegmentation(DynamicTable):
|
||||||
|
@ -697,10 +718,13 @@ class MotionCorrection(NWBDataInterface):
|
||||||
{"from_schema": "core.nwb.ophys", "tree_root": True}
|
{"from_schema": "core.nwb.ophys", "tree_root": True}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
name: str = Field(
|
||||||
|
"MotionCorrection",
|
||||||
|
json_schema_extra={"linkml_meta": {"ifabsent": "string(MotionCorrection)"}},
|
||||||
|
)
|
||||||
value: Optional[Dict[str, CorrectedImageStack]] = Field(
|
value: Optional[Dict[str, CorrectedImageStack]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "CorrectedImageStack"}]}}
|
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "CorrectedImageStack"}]}}
|
||||||
)
|
)
|
||||||
name: str = Field(...)
|
|
||||||
|
|
||||||
|
|
||||||
class CorrectedImageStack(NWBDataInterface):
|
class CorrectedImageStack(NWBDataInterface):
|
||||||
|
|
|
@ -43,7 +43,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -56,6 +56,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -66,7 +78,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -210,7 +210,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -223,6 +223,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -233,7 +245,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -68,7 +68,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -81,6 +81,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -91,7 +103,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
@ -120,7 +135,7 @@ NUMPYDANTIC_VERSION = "1.2.1"
|
||||||
T = TypeVar("T", bound=NDArray)
|
T = TypeVar("T", bound=NDArray)
|
||||||
|
|
||||||
|
|
||||||
class VectorDataMixin(BaseModel, Generic[T]):
|
class VectorDataMixin(ConfiguredBaseModel, Generic[T]):
|
||||||
"""
|
"""
|
||||||
Mixin class to give VectorData indexing abilities
|
Mixin class to give VectorData indexing abilities
|
||||||
"""
|
"""
|
||||||
|
@ -359,9 +374,9 @@ class Image(NWBData):
|
||||||
description: Optional[str] = Field(None, description="""Description of the image.""")
|
description: Optional[str] = Field(None, description="""Description of the image.""")
|
||||||
value: Optional[
|
value: Optional[
|
||||||
Union[
|
Union[
|
||||||
NDArray[Shape["* x, * y"], float],
|
NDArray[Shape["* x, * y"], float | int],
|
||||||
NDArray[Shape["* x, * y, 3 r_g_b"], float],
|
NDArray[Shape["* x, * y, 3 r_g_b"], float | int],
|
||||||
NDArray[Shape["* x, * y, 4 r_g_b_a"], float],
|
NDArray[Shape["* x, * y, 4 r_g_b_a"], float | int],
|
||||||
]
|
]
|
||||||
] = Field(None)
|
] = Field(None)
|
||||||
|
|
||||||
|
@ -551,13 +566,16 @@ class ProcessingModule(NWBContainer):
|
||||||
{"from_schema": "core.nwb.base", "tree_root": True}
|
{"from_schema": "core.nwb.base", "tree_root": True}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
name: str = Field(...)
|
||||||
|
description: str = Field(
|
||||||
|
..., description="""Description of this collection of processed data."""
|
||||||
|
)
|
||||||
value: Optional[Dict[str, Union[DynamicTable, NWBDataInterface]]] = Field(
|
value: Optional[Dict[str, Union[DynamicTable, NWBDataInterface]]] = Field(
|
||||||
None,
|
None,
|
||||||
json_schema_extra={
|
json_schema_extra={
|
||||||
"linkml_meta": {"any_of": [{"range": "NWBDataInterface"}, {"range": "DynamicTable"}]}
|
"linkml_meta": {"any_of": [{"range": "NWBDataInterface"}, {"range": "DynamicTable"}]}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
name: str = Field(...)
|
|
||||||
|
|
||||||
|
|
||||||
class Images(NWBDataInterface):
|
class Images(NWBDataInterface):
|
||||||
|
|
|
@ -49,7 +49,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -62,6 +62,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -72,7 +84,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
@ -201,10 +216,10 @@ class SpatialSeriesData(ConfiguredBaseModel):
|
||||||
)
|
)
|
||||||
value: Optional[
|
value: Optional[
|
||||||
Union[
|
Union[
|
||||||
NDArray[Shape["* num_times"], float],
|
NDArray[Shape["* num_times"], float | int],
|
||||||
NDArray[Shape["* num_times, 1 x"], float],
|
NDArray[Shape["* num_times, 1 x"], float | int],
|
||||||
NDArray[Shape["* num_times, 2 x_y"], float],
|
NDArray[Shape["* num_times, 2 x_y"], float | int],
|
||||||
NDArray[Shape["* num_times, 3 x_y_z"], float],
|
NDArray[Shape["* num_times, 3 x_y_z"], float | int],
|
||||||
]
|
]
|
||||||
] = Field(None)
|
] = Field(None)
|
||||||
|
|
||||||
|
@ -218,10 +233,13 @@ class BehavioralEpochs(NWBDataInterface):
|
||||||
{"from_schema": "core.nwb.behavior", "tree_root": True}
|
{"from_schema": "core.nwb.behavior", "tree_root": True}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
name: str = Field(
|
||||||
|
"BehavioralEpochs",
|
||||||
|
json_schema_extra={"linkml_meta": {"ifabsent": "string(BehavioralEpochs)"}},
|
||||||
|
)
|
||||||
value: Optional[Dict[str, IntervalSeries]] = Field(
|
value: Optional[Dict[str, IntervalSeries]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "IntervalSeries"}]}}
|
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "IntervalSeries"}]}}
|
||||||
)
|
)
|
||||||
name: str = Field(...)
|
|
||||||
|
|
||||||
|
|
||||||
class BehavioralEvents(NWBDataInterface):
|
class BehavioralEvents(NWBDataInterface):
|
||||||
|
@ -233,10 +251,13 @@ class BehavioralEvents(NWBDataInterface):
|
||||||
{"from_schema": "core.nwb.behavior", "tree_root": True}
|
{"from_schema": "core.nwb.behavior", "tree_root": True}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
name: str = Field(
|
||||||
|
"BehavioralEvents",
|
||||||
|
json_schema_extra={"linkml_meta": {"ifabsent": "string(BehavioralEvents)"}},
|
||||||
|
)
|
||||||
value: Optional[Dict[str, TimeSeries]] = Field(
|
value: Optional[Dict[str, TimeSeries]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "TimeSeries"}]}}
|
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "TimeSeries"}]}}
|
||||||
)
|
)
|
||||||
name: str = Field(...)
|
|
||||||
|
|
||||||
|
|
||||||
class BehavioralTimeSeries(NWBDataInterface):
|
class BehavioralTimeSeries(NWBDataInterface):
|
||||||
|
@ -248,10 +269,13 @@ class BehavioralTimeSeries(NWBDataInterface):
|
||||||
{"from_schema": "core.nwb.behavior", "tree_root": True}
|
{"from_schema": "core.nwb.behavior", "tree_root": True}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
name: str = Field(
|
||||||
|
"BehavioralTimeSeries",
|
||||||
|
json_schema_extra={"linkml_meta": {"ifabsent": "string(BehavioralTimeSeries)"}},
|
||||||
|
)
|
||||||
value: Optional[Dict[str, TimeSeries]] = Field(
|
value: Optional[Dict[str, TimeSeries]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "TimeSeries"}]}}
|
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "TimeSeries"}]}}
|
||||||
)
|
)
|
||||||
name: str = Field(...)
|
|
||||||
|
|
||||||
|
|
||||||
class PupilTracking(NWBDataInterface):
|
class PupilTracking(NWBDataInterface):
|
||||||
|
@ -263,10 +287,12 @@ class PupilTracking(NWBDataInterface):
|
||||||
{"from_schema": "core.nwb.behavior", "tree_root": True}
|
{"from_schema": "core.nwb.behavior", "tree_root": True}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
name: str = Field(
|
||||||
|
"PupilTracking", json_schema_extra={"linkml_meta": {"ifabsent": "string(PupilTracking)"}}
|
||||||
|
)
|
||||||
value: Optional[Dict[str, TimeSeries]] = Field(
|
value: Optional[Dict[str, TimeSeries]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "TimeSeries"}]}}
|
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "TimeSeries"}]}}
|
||||||
)
|
)
|
||||||
name: str = Field(...)
|
|
||||||
|
|
||||||
|
|
||||||
class EyeTracking(NWBDataInterface):
|
class EyeTracking(NWBDataInterface):
|
||||||
|
@ -278,10 +304,12 @@ class EyeTracking(NWBDataInterface):
|
||||||
{"from_schema": "core.nwb.behavior", "tree_root": True}
|
{"from_schema": "core.nwb.behavior", "tree_root": True}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
name: str = Field(
|
||||||
|
"EyeTracking", json_schema_extra={"linkml_meta": {"ifabsent": "string(EyeTracking)"}}
|
||||||
|
)
|
||||||
value: Optional[Dict[str, SpatialSeries]] = Field(
|
value: Optional[Dict[str, SpatialSeries]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "SpatialSeries"}]}}
|
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "SpatialSeries"}]}}
|
||||||
)
|
)
|
||||||
name: str = Field(...)
|
|
||||||
|
|
||||||
|
|
||||||
class CompassDirection(NWBDataInterface):
|
class CompassDirection(NWBDataInterface):
|
||||||
|
@ -293,10 +321,13 @@ class CompassDirection(NWBDataInterface):
|
||||||
{"from_schema": "core.nwb.behavior", "tree_root": True}
|
{"from_schema": "core.nwb.behavior", "tree_root": True}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
name: str = Field(
|
||||||
|
"CompassDirection",
|
||||||
|
json_schema_extra={"linkml_meta": {"ifabsent": "string(CompassDirection)"}},
|
||||||
|
)
|
||||||
value: Optional[Dict[str, SpatialSeries]] = Field(
|
value: Optional[Dict[str, SpatialSeries]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "SpatialSeries"}]}}
|
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "SpatialSeries"}]}}
|
||||||
)
|
)
|
||||||
name: str = Field(...)
|
|
||||||
|
|
||||||
|
|
||||||
class Position(NWBDataInterface):
|
class Position(NWBDataInterface):
|
||||||
|
@ -308,10 +339,12 @@ class Position(NWBDataInterface):
|
||||||
{"from_schema": "core.nwb.behavior", "tree_root": True}
|
{"from_schema": "core.nwb.behavior", "tree_root": True}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
name: str = Field(
|
||||||
|
"Position", json_schema_extra={"linkml_meta": {"ifabsent": "string(Position)"}}
|
||||||
|
)
|
||||||
value: Optional[Dict[str, SpatialSeries]] = Field(
|
value: Optional[Dict[str, SpatialSeries]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "SpatialSeries"}]}}
|
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "SpatialSeries"}]}}
|
||||||
)
|
)
|
||||||
name: str = Field(...)
|
|
||||||
|
|
||||||
|
|
||||||
# Model rebuild
|
# Model rebuild
|
||||||
|
|
|
@ -42,7 +42,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -55,6 +55,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -65,7 +77,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -59,7 +59,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -72,6 +72,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -82,7 +94,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
@ -247,9 +262,9 @@ class ElectricalSeriesData(ConfiguredBaseModel):
|
||||||
)
|
)
|
||||||
value: Optional[
|
value: Optional[
|
||||||
Union[
|
Union[
|
||||||
NDArray[Shape["* num_times"], float],
|
NDArray[Shape["* num_times"], float | int],
|
||||||
NDArray[Shape["* num_times, * num_channels"], float],
|
NDArray[Shape["* num_times, * num_channels"], float | int],
|
||||||
NDArray[Shape["* num_times, * num_channels, * num_samples"], float],
|
NDArray[Shape["* num_times, * num_channels, * num_samples"], float | int],
|
||||||
]
|
]
|
||||||
] = Field(None)
|
] = Field(None)
|
||||||
|
|
||||||
|
@ -359,8 +374,8 @@ class SpikeEventSeriesData(ConfiguredBaseModel):
|
||||||
)
|
)
|
||||||
value: Optional[
|
value: Optional[
|
||||||
Union[
|
Union[
|
||||||
NDArray[Shape["* num_events, * num_samples"], float],
|
NDArray[Shape["* num_events, * num_samples"], float | int],
|
||||||
NDArray[Shape["* num_events, * num_channels, * num_samples"], float],
|
NDArray[Shape["* num_events, * num_channels, * num_samples"], float | int],
|
||||||
]
|
]
|
||||||
] = Field(None)
|
] = Field(None)
|
||||||
|
|
||||||
|
@ -463,10 +478,12 @@ class EventWaveform(NWBDataInterface):
|
||||||
{"from_schema": "core.nwb.ecephys", "tree_root": True}
|
{"from_schema": "core.nwb.ecephys", "tree_root": True}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
name: str = Field(
|
||||||
|
"EventWaveform", json_schema_extra={"linkml_meta": {"ifabsent": "string(EventWaveform)"}}
|
||||||
|
)
|
||||||
value: Optional[Dict[str, SpikeEventSeries]] = Field(
|
value: Optional[Dict[str, SpikeEventSeries]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "SpikeEventSeries"}]}}
|
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "SpikeEventSeries"}]}}
|
||||||
)
|
)
|
||||||
name: str = Field(...)
|
|
||||||
|
|
||||||
|
|
||||||
class FilteredEphys(NWBDataInterface):
|
class FilteredEphys(NWBDataInterface):
|
||||||
|
@ -478,10 +495,12 @@ class FilteredEphys(NWBDataInterface):
|
||||||
{"from_schema": "core.nwb.ecephys", "tree_root": True}
|
{"from_schema": "core.nwb.ecephys", "tree_root": True}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
name: str = Field(
|
||||||
|
"FilteredEphys", json_schema_extra={"linkml_meta": {"ifabsent": "string(FilteredEphys)"}}
|
||||||
|
)
|
||||||
value: Optional[Dict[str, ElectricalSeries]] = Field(
|
value: Optional[Dict[str, ElectricalSeries]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "ElectricalSeries"}]}}
|
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "ElectricalSeries"}]}}
|
||||||
)
|
)
|
||||||
name: str = Field(...)
|
|
||||||
|
|
||||||
|
|
||||||
class LFP(NWBDataInterface):
|
class LFP(NWBDataInterface):
|
||||||
|
@ -493,10 +512,10 @@ class LFP(NWBDataInterface):
|
||||||
{"from_schema": "core.nwb.ecephys", "tree_root": True}
|
{"from_schema": "core.nwb.ecephys", "tree_root": True}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
name: str = Field("LFP", json_schema_extra={"linkml_meta": {"ifabsent": "string(LFP)"}})
|
||||||
value: Optional[Dict[str, ElectricalSeries]] = Field(
|
value: Optional[Dict[str, ElectricalSeries]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "ElectricalSeries"}]}}
|
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "ElectricalSeries"}]}}
|
||||||
)
|
)
|
||||||
name: str = Field(...)
|
|
||||||
|
|
||||||
|
|
||||||
class ElectrodeGroup(NWBContainer):
|
class ElectrodeGroup(NWBContainer):
|
||||||
|
|
|
@ -57,7 +57,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -70,6 +70,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -80,7 +92,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -71,7 +71,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -84,6 +84,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -94,7 +106,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -66,7 +66,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -79,6 +79,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -89,7 +101,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
@ -249,7 +264,7 @@ class PatchClampSeriesData(ConfiguredBaseModel):
|
||||||
...,
|
...,
|
||||||
description="""Base unit of measurement for working with the data. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion' and add 'offset'.""",
|
description="""Base unit of measurement for working with the data. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion' and add 'offset'.""",
|
||||||
)
|
)
|
||||||
value: Optional[NDArray[Shape["* num_times"], float]] = Field(
|
value: Optional[NDArray[Shape["* num_times"], float | int]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_times"}]}}}
|
None, json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_times"}]}}}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -360,7 +375,7 @@ class CurrentClampSeriesData(ConfiguredBaseModel):
|
||||||
description="""Base unit of measurement for working with the data. which is fixed to 'volts'. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion' and add 'offset'.""",
|
description="""Base unit of measurement for working with the data. which is fixed to 'volts'. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion' and add 'offset'.""",
|
||||||
json_schema_extra={"linkml_meta": {"equals_string": "volts", "ifabsent": "string(volts)"}},
|
json_schema_extra={"linkml_meta": {"equals_string": "volts", "ifabsent": "string(volts)"}},
|
||||||
)
|
)
|
||||||
value: Optional[NDArray[Shape["* num_times"], float]] = Field(
|
value: Optional[NDArray[Shape["* num_times"], float | int]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_times"}]}}}
|
None, json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_times"}]}}}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -542,7 +557,7 @@ class CurrentClampStimulusSeriesData(ConfiguredBaseModel):
|
||||||
"linkml_meta": {"equals_string": "amperes", "ifabsent": "string(amperes)"}
|
"linkml_meta": {"equals_string": "amperes", "ifabsent": "string(amperes)"}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
value: Optional[NDArray[Shape["* num_times"], float]] = Field(
|
value: Optional[NDArray[Shape["* num_times"], float | int]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_times"}]}}}
|
None, json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_times"}]}}}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -723,7 +738,7 @@ class VoltageClampSeriesData(ConfiguredBaseModel):
|
||||||
"linkml_meta": {"equals_string": "amperes", "ifabsent": "string(amperes)"}
|
"linkml_meta": {"equals_string": "amperes", "ifabsent": "string(amperes)"}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
value: Optional[NDArray[Shape["* num_times"], float]] = Field(
|
value: Optional[NDArray[Shape["* num_times"], float | int]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_times"}]}}}
|
None, json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_times"}]}}}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -955,7 +970,7 @@ class VoltageClampStimulusSeriesData(ConfiguredBaseModel):
|
||||||
description="""Base unit of measurement for working with the data. which is fixed to 'volts'. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion' and add 'offset'.""",
|
description="""Base unit of measurement for working with the data. which is fixed to 'volts'. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion' and add 'offset'.""",
|
||||||
json_schema_extra={"linkml_meta": {"equals_string": "volts", "ifabsent": "string(volts)"}},
|
json_schema_extra={"linkml_meta": {"equals_string": "volts", "ifabsent": "string(volts)"}},
|
||||||
)
|
)
|
||||||
value: Optional[NDArray[Shape["* num_times"], float]] = Field(
|
value: Optional[NDArray[Shape["* num_times"], float | int]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_times"}]}}}
|
None, json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_times"}]}}}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1225,6 +1240,10 @@ class IntracellularRecordingsTable(AlignedDynamicTable):
|
||||||
stimuli: IntracellularStimuliTable = Field(
|
stimuli: IntracellularStimuliTable = Field(
|
||||||
..., description="""Table for storing intracellular stimulus related metadata."""
|
..., description="""Table for storing intracellular stimulus related metadata."""
|
||||||
)
|
)
|
||||||
|
categories: List[str] = Field(
|
||||||
|
...,
|
||||||
|
description="""The names of the categories in this AlignedDynamicTable. Each category is represented by one DynamicTable stored in the parent group. This attribute should be used to specify an order of categories and the category names must match the names of the corresponding DynamicTable in the group.""",
|
||||||
|
)
|
||||||
value: Optional[Dict[str, DynamicTable]] = Field(
|
value: Optional[Dict[str, DynamicTable]] = Field(
|
||||||
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "DynamicTable"}]}}
|
None, json_schema_extra={"linkml_meta": {"any_of": [{"range": "DynamicTable"}]}}
|
||||||
)
|
)
|
||||||
|
|
|
@ -50,7 +50,7 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
|
|
||||||
@field_validator("*", mode="wrap")
|
@field_validator("*", mode="wrap")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_value(cls, v: Any, handler) -> Any:
|
def coerce_value(cls, v: Any, handler, info) -> Any:
|
||||||
"""Try to rescue instantiation by using the value field"""
|
"""Try to rescue instantiation by using the value field"""
|
||||||
try:
|
try:
|
||||||
return handler(v)
|
return handler(v)
|
||||||
|
@ -63,6 +63,18 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
except (IndexError, KeyError, TypeError):
|
except (IndexError, KeyError, TypeError):
|
||||||
raise e1
|
raise e1
|
||||||
|
|
||||||
|
@field_validator("*", mode="wrap")
|
||||||
|
@classmethod
|
||||||
|
def cast_with_value(cls, v: Any, handler, info) -> Any:
|
||||||
|
"""Try to rescue instantiation by casting into the model's value fiel"""
|
||||||
|
try:
|
||||||
|
return handler(v)
|
||||||
|
except Exception as e1:
|
||||||
|
try:
|
||||||
|
return handler({"value": v})
|
||||||
|
except Exception:
|
||||||
|
raise e1
|
||||||
|
|
||||||
@field_validator("*", mode="before")
|
@field_validator("*", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def coerce_subclass(cls, v: Any, info) -> Any:
|
def coerce_subclass(cls, v: Any, info) -> Any:
|
||||||
|
@ -73,7 +85,10 @@ class ConfiguredBaseModel(BaseModel):
|
||||||
annotation = annotation.__args__[0]
|
annotation = annotation.__args__[0]
|
||||||
try:
|
try:
|
||||||
if issubclass(annotation, type(v)) and annotation is not type(v):
|
if issubclass(annotation, type(v)) and annotation is not type(v):
|
||||||
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
if v.__pydantic_extra__:
|
||||||
|
v = annotation(**{**v.__dict__, **v.__pydantic_extra__})
|
||||||
|
else:
|
||||||
|
v = annotation(**v.__dict__)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# fine, annotation is a non-class type like a TypeVar
|
# fine, annotation is a non-class type like a TypeVar
|
||||||
pass
|
pass
|
||||||
|
@ -122,7 +137,7 @@ class GrayscaleImage(Image):
|
||||||
)
|
)
|
||||||
|
|
||||||
name: str = Field(...)
|
name: str = Field(...)
|
||||||
value: Optional[NDArray[Shape["* x, * y"], float]] = Field(
|
value: Optional[NDArray[Shape["* x, * y"], float | int]] = Field(
|
||||||
None,
|
None,
|
||||||
json_schema_extra={
|
json_schema_extra={
|
||||||
"linkml_meta": {"array": {"dimensions": [{"alias": "x"}, {"alias": "y"}]}}
|
"linkml_meta": {"array": {"dimensions": [{"alias": "x"}, {"alias": "y"}]}}
|
||||||
|
@ -144,7 +159,7 @@ class RGBImage(Image):
|
||||||
)
|
)
|
||||||
|
|
||||||
name: str = Field(...)
|
name: str = Field(...)
|
||||||
value: Optional[NDArray[Shape["* x, * y, 3 r_g_b"], float]] = Field(
|
value: Optional[NDArray[Shape["* x, * y, 3 r_g_b"], float | int]] = Field(
|
||||||
None,
|
None,
|
||||||
json_schema_extra={
|
json_schema_extra={
|
||||||
"linkml_meta": {
|
"linkml_meta": {
|
||||||
|
@ -174,7 +189,7 @@ class RGBAImage(Image):
|
||||||
)
|
)
|
||||||
|
|
||||||
name: str = Field(...)
|
name: str = Field(...)
|
||||||
value: Optional[NDArray[Shape["* x, * y, 4 r_g_b_a"], float]] = Field(
|
value: Optional[NDArray[Shape["* x, * y, 4 r_g_b_a"], float | int]] = Field(
|
||||||
None,
|
None,
|
||||||
json_schema_extra={
|
json_schema_extra={
|
||||||
"linkml_meta": {
|
"linkml_meta": {
|
||||||
|
@ -303,8 +318,8 @@ class ImageSeriesData(ConfiguredBaseModel):
|
||||||
)
|
)
|
||||||
value: Optional[
|
value: Optional[
|
||||||
Union[
|
Union[
|
||||||
NDArray[Shape["* frame, * x, * y"], float],
|
NDArray[Shape["* frame, * x, * y"], float | int],
|
||||||
NDArray[Shape["* frame, * x, * y, * z"], float],
|
NDArray[Shape["* frame, * x, * y, * z"], float | int],
|
||||||
]
|
]
|
||||||
] = Field(None)
|
] = Field(None)
|
||||||
|
|
||||||
|
@ -534,8 +549,8 @@ class OpticalSeriesData(ConfiguredBaseModel):
|
||||||
)
|
)
|
||||||
value: Optional[
|
value: Optional[
|
||||||
Union[
|
Union[
|
||||||
NDArray[Shape["* frame, * x, * y"], float],
|
NDArray[Shape["* frame, * x, * y"], float | int],
|
||||||
NDArray[Shape["* frame, * x, * y, 3 r_g_b"], float],
|
NDArray[Shape["* frame, * x, * y, 3 r_g_b"], float | int],
|
||||||
]
|
]
|
||||||
] = Field(None)
|
] = Field(None)
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue