diff --git a/libs/pyglet/__init__.py b/libs/pyglet/__init__.py index 82e8730..db48773 100644 --- a/libs/pyglet/__init__.py +++ b/libs/pyglet/__init__.py @@ -9,7 +9,7 @@ import sys from typing import TYPE_CHECKING #: The release version -version = '2.0.8' +version = '2.0.9' __version__ = version MIN_PYTHON_VERSION = 3, 8 diff --git a/libs/pyglet/image/atlas.py b/libs/pyglet/image/atlas.py index 05bbddd..63e9e80 100644 --- a/libs/pyglet/image/atlas.py +++ b/libs/pyglet/image/atlas.py @@ -23,7 +23,7 @@ the application's responsibility to keep track of the regions returned by the .. versionadded:: 1.1 """ -from typing import TYPE_CHECKING, Tuple +from typing import TYPE_CHECKING, Tuple, Optional import pyglet @@ -40,13 +40,13 @@ class AllocatorException(Exception): class _Strip: __slots__ = 'x', 'y', 'max_height', 'y2' - def __init__(self, y: int, max_height: int): + def __init__(self, y: int, max_height: int) -> None: self.x = 0 self.y = y self.max_height = max_height self.y2 = y - def add(self, width: int, height: int): + def add(self, width: int, height: int) -> Tuple[int, int]: assert width > 0 and height > 0 assert height <= self.max_height @@ -55,7 +55,7 @@ class _Strip: self.y2 = max(self.y + height, self.y2) return x, y - def compact(self): + def compact(self) -> None: self.max_height = self.y2 - self.y @@ -71,7 +71,7 @@ class Allocator: """ __slots__ = 'width', 'height', 'strips', 'used_area' - def __init__(self, width: int, height: int): + def __init__(self, width: int, height: int) -> None: """Create an `Allocator` of the given size. :Parameters: @@ -139,13 +139,13 @@ class Allocator: if not self.strips: return 0.0 possible_area = self.strips[-1].y2 * self.width - return 1.0 - self.used_area / float(possible_area) + return 1.0 - self.used_area / possible_area class TextureAtlas: """Collection of images within a texture.""" - def __init__(self, width: int = 2048, height: int = 2048): + def __init__(self, width: int=2048, height: int=2048) -> None: """Create a texture atlas of the given size. :Parameters: @@ -194,7 +194,7 @@ class TextureBin: ones as necessary to accommodate images added to the bin. """ - def __init__(self, texture_width: int = 2048, texture_height: int = 2048): + def __init__(self, texture_width: int = 2048, texture_height: int = 2048) -> None: """Create a texture bin for holding atlases of the given size. :Parameters: @@ -252,7 +252,7 @@ class TextureArrayBin: ones as necessary as the depth is exceeded. """ - def __init__(self, texture_width=2048, texture_height=2048, max_depth=None): + def __init__(self, texture_width: int=2048, texture_height: int=2048, max_depth: Optional[int]=None) -> None: max_texture_size = pyglet.image.get_max_texture_size() self.max_depth = max_depth or pyglet.image.get_max_array_texture_layers() self.texture_width = min(texture_width, max_texture_size)