We can alias types in python, so instead of littering the codebase with complex types like:
dict[Union[Iterable[Union[int, str]], int, str], Optional[LineSettings]]
Or when we move to only support 3.10+:
dict[Iterable[int | str] | int | str, LineSettings | None]
We can instead do something like:
RequestKey = Union[int, str]
IterableRequestKeys = Iterable[RequestKey]
IterableRequestKeys_or_RequestKey = Union[IterableRequestKeys, RequestKey]
config: dict[IterableRequestKeys_or_RequestKey, Optional[LineSettings]],
The resolved type is equivalent to the previous syntax, but it's maybe a little easier to digest.
https://docs.python.org/3.9/library/typing.html#type-aliases