Skip to content

Commit 8414fed

Browse files
committed
Revert TypeAlias usage in typing
1 parent d374db2 commit 8414fed

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

buildconfig/stubs/pygame/typing.pyi

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ __all__ = [
1414

1515
import sys
1616
from abc import abstractmethod
17-
from typing import IO, Callable, Tuple, Union, TypeVar, Protocol, TypeAlias
17+
from typing import IO, Callable, Tuple, Union, TypeVar, Protocol
1818

1919
if sys.version_info >= (3, 9):
2020
from os import PathLike as _PathProtocol
@@ -27,9 +27,9 @@ else:
2727

2828

2929
# For functions that take a file name
30-
_PathLike: TypeAlias = Union[str, bytes, _PathProtocol[str], _PathProtocol[bytes]]
30+
_PathLike = Union[str, bytes, _PathProtocol[str], _PathProtocol[bytes]]
3131
# Most pygame functions that take a file argument should be able to handle a FileLike type
32-
FileLike: TypeAlias = Union[_PathLike, IO[bytes], IO[str]]
32+
FileLike = Union[_PathLike, IO[bytes], IO[str]]
3333

3434
_T_co = TypeVar("_T_co", covariant=True)
3535

@@ -49,11 +49,11 @@ class SequenceLike(Protocol[_T_co]):
4949

5050
# Pygame handles float without errors in most cases where a point is expected,
5151
# usually rounding to int. Also, 'Union[int, float] == float'
52-
Point: TypeAlias = SequenceLike[float]
52+
Point = SequenceLike[float]
5353
# This is used where ints are strictly required
54-
IntPoint: TypeAlias = SequenceLike[int]
54+
IntPoint = SequenceLike[int]
5555

56-
ColorLike: TypeAlias = Union[int, str, SequenceLike[int]]
56+
ColorLike = Union[int, str, SequenceLike[int]]
5757

5858

5959
class _HasRectAttribute(Protocol):
@@ -63,8 +63,8 @@ class _HasRectAttribute(Protocol):
6363
def rect(self) -> Union["RectLike", Callable[[], "RectLike"]]: ...
6464

6565

66-
RectLike: TypeAlias = Union[SequenceLike[float], SequenceLike[Point], _HasRectAttribute]
66+
RectLike = Union[SequenceLike[float], SequenceLike[Point], _HasRectAttribute]
6767

6868

6969
# cleanup namespace
70-
del sys, abstractmethod, IO, Callable, Tuple, Union, TypeVar, Protocol, TypeAlias
70+
del sys, abstractmethod, IO, Callable, Tuple, Union, TypeVar, Protocol

src_py/typing.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
import sys
1616
from abc import abstractmethod
17-
from typing import IO, Callable, Tuple, Union, TypeVar, Protocol, TypeAlias
17+
from typing import IO, Callable, Tuple, Union, TypeVar, Protocol
1818

1919
if sys.version_info >= (3, 9):
2020
from os import PathLike as _PathProtocol
@@ -27,9 +27,9 @@ def __fspath__(self) -> _AnyStr_co: ...
2727

2828

2929
# For functions that take a file name
30-
_PathLike: TypeAlias = Union[str, bytes, _PathProtocol[str], _PathProtocol[bytes]]
30+
_PathLike = Union[str, bytes, _PathProtocol[str], _PathProtocol[bytes]]
3131
# Most pygame functions that take a file argument should be able to handle a FileLike type
32-
FileLike: TypeAlias = Union[_PathLike, IO[bytes], IO[str]]
32+
FileLike = Union[_PathLike, IO[bytes], IO[str]]
3333

3434
_T_co = TypeVar("_T_co", covariant=True)
3535

@@ -49,11 +49,11 @@ def __len__(self) -> int: ...
4949

5050
# Pygame handles float without errors in most cases where a point is expected,
5151
# usually rounding to int. Also, 'Union[int, float] == float'
52-
Point: TypeAlias = SequenceLike[float]
52+
Point = SequenceLike[float]
5353
# This is used where ints are strictly required
54-
IntPoint: TypeAlias = SequenceLike[int]
54+
IntPoint = SequenceLike[int]
5555

56-
ColorLike: TypeAlias = Union[int, str, SequenceLike[int]]
56+
ColorLike = Union[int, str, SequenceLike[int]]
5757

5858

5959
class _HasRectAttribute(Protocol):
@@ -63,8 +63,8 @@ class _HasRectAttribute(Protocol):
6363
def rect(self) -> Union["RectLike", Callable[[], "RectLike"]]: ...
6464

6565

66-
RectLike: TypeAlias = Union[SequenceLike[float], SequenceLike[Point], _HasRectAttribute]
66+
RectLike = Union[SequenceLike[float], SequenceLike[Point], _HasRectAttribute]
6767

6868

6969
# cleanup namespace
70-
del sys, abstractmethod, IO, Callable, Tuple, Union, TypeVar, Protocol, TypeAlias
70+
del sys, abstractmethod, IO, Callable, Tuple, Union, TypeVar, Protocol

0 commit comments

Comments
 (0)