mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-12-16 04:41:15 +00:00
fic: Improve type safety for annotationType
This commit is contained in:
@@ -6,7 +6,6 @@ from typing_extensions import TypedDict
|
|||||||
|
|
||||||
|
|
||||||
class _BaseAnnotationType(TypedDict, total=False):
|
class _BaseAnnotationType(TypedDict, total=False):
|
||||||
type: Required[Literal["area", "line"]]
|
|
||||||
start: str | datetime
|
start: str | datetime
|
||||||
end: str | datetime
|
end: str | datetime
|
||||||
y_start: float
|
y_start: float
|
||||||
@@ -20,12 +19,12 @@ class AreaAnnotationType(_BaseAnnotationType, total=False):
|
|||||||
type: Literal["area"]
|
type: Literal["area"]
|
||||||
|
|
||||||
|
|
||||||
class LinenAnnotationType(_BaseAnnotationType, total=False):
|
class LineAnnotationType(_BaseAnnotationType, total=False):
|
||||||
type: Literal["line"]
|
type: Literal["line"]
|
||||||
width: int
|
width: int
|
||||||
line_style: Literal["solid", "dashed", "dotted"]
|
line_style: Literal["solid", "dashed", "dotted"]
|
||||||
|
|
||||||
|
|
||||||
AnnotationType = AreaAnnotationType | LinenAnnotationType
|
AnnotationType = AreaAnnotationType | LineAnnotationType
|
||||||
|
|
||||||
AnnotationTypeTA = TypeAdapter(AnnotationType)
|
AnnotationTypeTA: TypeAdapter[AnnotationType] = TypeAdapter(AnnotationType)
|
||||||
|
|||||||
Reference in New Issue
Block a user