@@ -6,25 +6,36 @@ from typing_extensions import TypedDict
|
|||||||
|
|
||||||
|
|
||||||
class _BaseAnnotationType(TypedDict, total=False):
|
class _BaseAnnotationType(TypedDict, total=False):
|
||||||
start: str | datetime
|
|
||||||
end: str | datetime
|
|
||||||
y_start: float
|
|
||||||
y_end: float
|
|
||||||
color: str
|
color: str
|
||||||
label: str
|
label: str
|
||||||
z_level: int
|
z_level: int
|
||||||
|
|
||||||
|
|
||||||
class AreaAnnotationType(_BaseAnnotationType, total=False):
|
class _Base2DAnnotationType(_BaseAnnotationType, total=False):
|
||||||
|
start: str | datetime
|
||||||
|
end: str | datetime
|
||||||
|
y_start: float
|
||||||
|
y_end: float
|
||||||
|
|
||||||
|
|
||||||
|
class AreaAnnotationType(_Base2DAnnotationType, total=False):
|
||||||
type: Required[Literal["area"]]
|
type: Required[Literal["area"]]
|
||||||
|
|
||||||
|
|
||||||
class LineAnnotationType(_BaseAnnotationType, total=False):
|
class LineAnnotationType(_Base2DAnnotationType, total=False):
|
||||||
type: Required[Literal["line"]]
|
type: Required[Literal["line"]]
|
||||||
width: int
|
width: int
|
||||||
line_style: Literal["solid", "dashed", "dotted"]
|
line_style: Literal["solid", "dashed", "dotted"]
|
||||||
|
|
||||||
|
|
||||||
AnnotationType = AreaAnnotationType | LineAnnotationType
|
class PointAnnotationType(_BaseAnnotationType, total=False):
|
||||||
|
type: Required[Literal["point"]]
|
||||||
|
x: str | datetime
|
||||||
|
y: float
|
||||||
|
size: int
|
||||||
|
shape: Literal["circle", "rect", "roundRect", "triangle", "pin", "arrow", "none"]
|
||||||
|
|
||||||
|
|
||||||
|
AnnotationType = AreaAnnotationType | LineAnnotationType | PointAnnotationType
|
||||||
|
|
||||||
AnnotationTypeTA: TypeAdapter[AnnotationType] = TypeAdapter(AnnotationType)
|
AnnotationTypeTA: TypeAdapter[AnnotationType] = TypeAdapter(AnnotationType)
|
||||||
|
|||||||
Reference in New Issue
Block a user