mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-10 22:11:54 +08:00
Use TypeAlias where possible for type aliases (#7630)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from _typeshed import Self
|
||||
from tkinter import Canvas, Frame, Misc, PhotoImage, Scrollbar
|
||||
from typing import Any, Callable, ClassVar, Sequence, Union, overload
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
__all__ = [
|
||||
"ScrolledCanvas",
|
||||
@@ -131,18 +132,18 @@ __all__ = [
|
||||
# alias we use for return types. Really, these two aliases should be the
|
||||
# same, but as per the "no union returns" typeshed policy, we'll return
|
||||
# Any instead.
|
||||
_Color = Union[str, tuple[float, float, float]]
|
||||
_Color: TypeAlias = Union[str, tuple[float, float, float]]
|
||||
_AnyColor = Any
|
||||
|
||||
# TODO: Replace this with a TypedDict once it becomes standardized.
|
||||
_PenState = dict[str, Any]
|
||||
_PenState: TypeAlias = dict[str, Any]
|
||||
|
||||
_Speed = str | float
|
||||
_PolygonCoords = Sequence[tuple[float, float]]
|
||||
_Speed: TypeAlias = str | float
|
||||
_PolygonCoords: TypeAlias = Sequence[tuple[float, float]]
|
||||
|
||||
# TODO: Type this more accurately
|
||||
# Vec2D is actually a custom subclass of 'tuple'.
|
||||
Vec2D = tuple[float, float]
|
||||
Vec2D: TypeAlias = tuple[float, float]
|
||||
|
||||
# Does not actually inherit from Canvas, but dynamically gets all methods of Canvas
|
||||
class ScrolledCanvas(Canvas, Frame): # type: ignore[misc]
|
||||
|
||||
Reference in New Issue
Block a user