The values of the start and stop keys have the following constraints:
- can be omitted
- can be
None
- can be an
int
- can be any of the following "keywords":
begin, mid, and end
The current type for them is Union[int, str]:
|
class StartStopEntry(TypedDict): |
|
""" |
|
Configuration for a single dimension's previewing in terms of start/stop values. |
|
""" |
|
|
|
start: Union[int, str] |
|
start_offset: Optional[int] |
|
stop: Union[int, str] |
|
stop_offset: Optional[int] |
which doesn't reflect all those constraints: it misses 1 and 2, and doesn't constraint the possible strings to be only the three available in 4.
I think the correct type would be NotRequired[Optional[Literal["begin"] | Literal["mid"] | Literal["end"]]].
The values of the
startandstopkeys have the following constraints:Noneintbegin,mid, andendThe current type for them is
Union[int, str]:httomo/httomo/transform_loader_params.py
Lines 34 to 42 in 584e15c
which doesn't reflect all those constraints: it misses 1 and 2, and doesn't constraint the possible strings to be only the three available in 4.
I think the correct type would be
NotRequired[Optional[Literal["begin"] | Literal["mid"] | Literal["end"]]].