Skip to content

Incorrect type of start and stop keys in StartStopEntry #610

@yousefmoazzam

Description

@yousefmoazzam

The values of the start and stop keys have the following constraints:

  1. can be omitted
  2. can be None
  3. can be an int
  4. 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"]]].

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions