sync pyglet update (typing

This commit is contained in:
shenjack 2023-07-07 17:13:42 +08:00
parent a46b46ead6
commit 086bd035e7
2 changed files with 12 additions and 0 deletions

View File

@ -333,6 +333,7 @@ class _ModuleProxy:
# Lazily load all modules, except if performing # Lazily load all modules, except if performing
# type checking or code inspection. # type checking or code inspection.
if TYPE_CHECKING: if TYPE_CHECKING:
from . import types
from . import app from . import app
from . import canvas from . import canvas
from . import clock from . import clock
@ -353,6 +354,7 @@ if TYPE_CHECKING:
from . import text from . import text
from . import window from . import window
else: else:
types = _ModuleProxy('types')
app = _ModuleProxy('app') app = _ModuleProxy('app')
canvas = _ModuleProxy('canvas') canvas = _ModuleProxy('canvas')
clock = _ModuleProxy('clock') clock = _ModuleProxy('clock')

10
libs/pyglet/types.py Normal file
View File

@ -0,0 +1,10 @@
"""Holds type aliases used throughout the codebase."""
import ctypes
from typing import Union
__all__ = [
"Buffer"
]
# Backwards compatible placeholder for `collections.abc.Buffer` from Python 3.12
Buffer = Union[bytes, bytearray, memoryview, ctypes.Array]