From 696f1aa1fd117244b18f25cad607d9c0d090be02 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 3 Feb 2025 22:05:45 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/pydiamond/_patch/plugins/environment.py | 9 +- src/pydiamond/audio/mixer.py | 18 +- src/pydiamond/graphics/animation.py | 24 +- src/pydiamond/graphics/drawable.py | 6 +- src/pydiamond/graphics/font.py | 6 +- src/pydiamond/graphics/grid.py | 30 +- src/pydiamond/graphics/image.py | 6 +- src/pydiamond/graphics/movable.py | 30 +- src/pydiamond/graphics/renderer.py | 18 +- src/pydiamond/graphics/shape.py | 6 +- src/pydiamond/graphics/sprite.py | 9 +- src/pydiamond/graphics/surface.py | 9 +- src/pydiamond/graphics/text.py | 15 +- src/pydiamond/graphics/transformable.py | 33 +- src/pydiamond/gui/focus.py | 18 +- src/pydiamond/gui/scene.py | 18 +- src/pydiamond/gui/tools/_grid.py | 3 +- src/pydiamond/gui/tools/view.py | 12 +- src/pydiamond/gui/widgets/abc.py | 15 +- src/pydiamond/gui/widgets/button.py | 33 +- src/pydiamond/gui/widgets/form.py | 6 +- src/pydiamond/gui/widgets/scroll.py | 6 +- src/pydiamond/math/rect.py | 24 +- src/pydiamond/scene/abc.py | 21 +- .../system/collections/_orderedweakset.py | 9 +- src/pydiamond/system/configuration.py | 304 +++++++----------- src/pydiamond/system/non_copyable.py | 12 +- src/pydiamond/system/object.py | 12 +- src/pydiamond/system/path.py | 18 +- src/pydiamond/system/proxy.py | 6 +- src/pydiamond/system/theme.py | 26 +- src/pydiamond/system/threading.py | 36 +-- src/pydiamond/system/utils/_mangling.py | 6 +- src/pydiamond/system/utils/enum.py | 6 +- src/pydiamond/system/utils/functools.py | 39 +-- src/pydiamond/system/utils/itertools.py | 21 +- src/pydiamond/system/utils/os.py | 9 +- src/pydiamond/system/utils/weakref.py | 6 +- src/pydiamond/system/validation.py | 84 ++--- src/pydiamond/window/controller.py | 9 +- src/pydiamond/window/cursor.py | 18 +- src/pydiamond/window/display.py | 15 +- src/pydiamond/window/event.py | 134 +++----- src/pydiamond/window/keyboard.py | 6 +- 44 files changed, 391 insertions(+), 760 deletions(-) diff --git a/src/pydiamond/_patch/plugins/environment.py b/src/pydiamond/_patch/plugins/environment.py index 250d93de..488f93dd 100644 --- a/src/pydiamond/_patch/plugins/environment.py +++ b/src/pydiamond/_patch/plugins/environment.py @@ -70,18 +70,15 @@ def run(self) -> None: @overload -def check_booleans(environ: MutableMapping[str, str]) -> None: - ... +def check_booleans(environ: MutableMapping[str, str]) -> None: ... @overload -def check_booleans(environ: MutableMapping[str, str], *, only: Sequence[str]) -> None: - ... +def check_booleans(environ: MutableMapping[str, str], *, only: Sequence[str]) -> None: ... @overload -def check_booleans(environ: MutableMapping[str, str], *, exclude: Sequence[str]) -> None: - ... +def check_booleans(environ: MutableMapping[str, str], *, exclude: Sequence[str]) -> None: ... def check_booleans( diff --git a/src/pydiamond/audio/mixer.py b/src/pydiamond/audio/mixer.py index 6f38f872..7d677ea1 100644 --- a/src/pydiamond/audio/mixer.py +++ b/src/pydiamond/audio/mixer.py @@ -94,8 +94,7 @@ class Mixer(ClassNamespace, frozen=True): @overload @staticmethod - def pre_init() -> None: - ... + def pre_init() -> None: ... @overload @staticmethod @@ -107,8 +106,7 @@ def pre_init( buffersize: int = ..., allowedchanges: AllowedAudioChanges | Literal[-1, 0] = ..., **kwargs: Any, - ) -> None: - ... + ) -> None: ... @staticmethod def pre_init(**kwargs: Any) -> None: @@ -126,8 +124,7 @@ def pre_init(**kwargs: Any) -> None: @overload @staticmethod - def init() -> _GeneratorContextManager[MixerParams]: - ... + def init() -> _GeneratorContextManager[MixerParams]: ... @overload @staticmethod @@ -139,8 +136,7 @@ def init( buffersize: int = ..., allowedchanges: AllowedAudioChanges | Literal[-1, 0] = ..., **kwargs: Any, - ) -> _GeneratorContextManager[MixerParams]: - ... + ) -> _GeneratorContextManager[MixerParams]: ... # So add 'devicename' breaks you mypy...? @staticmethod @@ -278,13 +274,11 @@ def set_reserved(count: int) -> int: @overload @staticmethod - def find_channel(force: Literal[True]) -> Channel: - ... + def find_channel(force: Literal[True]) -> Channel: ... @overload @staticmethod - def find_channel(force: bool = ...) -> Channel | None: - ... + def find_channel(force: bool = ...) -> Channel | None: ... @staticmethod def find_channel(force: bool = False) -> Channel | None: diff --git a/src/pydiamond/graphics/animation.py b/src/pydiamond/graphics/animation.py index 8963b7ea..538286e4 100644 --- a/src/pydiamond/graphics/animation.py +++ b/src/pydiamond/graphics/animation.py @@ -227,8 +227,7 @@ def __init__(self, movable: Movable) -> None: __Self = TypeVar("__Self", bound="MoveAnimation") @property - def object(self) -> Movable: - ... + def object(self) -> Movable: ... @overload def smooth_set_position( @@ -243,8 +242,7 @@ def smooth_set_position( bottom: float = ..., centerx: float = ..., centery: float = ..., - ) -> __Self: - ... + ) -> __Self: ... @overload def smooth_set_position( @@ -260,8 +258,7 @@ def smooth_set_position( midright: tuple[float, float] = ..., midtop: tuple[float, float] = ..., midbottom: tuple[float, float] = ..., - ) -> __Self: - ... + ) -> __Self: ... def smooth_set_position(self: __Self, speed: float = 100, **position: float | tuple[float, float]) -> __Self: self.__animations["move"] = _AnimationSetPosition(self.object, speed, position) @@ -337,8 +334,7 @@ def __init__(self, transformable: Transformable) -> None: __Self = TypeVar("__Self", bound="TransformAnimation") @property - def object(self) -> Transformable: - ... + def object(self) -> Transformable: ... @overload def smooth_set_position( @@ -353,8 +349,7 @@ def smooth_set_position( bottom: float = ..., centerx: float = ..., centery: float = ..., - ) -> __Self: - ... + ) -> __Self: ... @overload def smooth_set_position( @@ -370,8 +365,7 @@ def smooth_set_position( midright: tuple[float, float] = ..., midtop: tuple[float, float] = ..., midbottom: tuple[float, float] = ..., - ) -> __Self: - ... + ) -> __Self: ... def smooth_set_position(self: __Self, speed: float = 100, **position: float | tuple[float, float]) -> __Self: transformable: Transformable = self.object @@ -607,12 +601,10 @@ class _AbstractTransformableAnimationClass(_AbstractAnimationClass): if TYPE_CHECKING: - def __init__(self, obj: Transformable, speed: float) -> None: - ... + def __init__(self, obj: Transformable, speed: float) -> None: ... @property - def object(self) -> Transformable: - ... + def object(self) -> Transformable: ... class _AnimationSetPosition(_AbstractAnimationClass): diff --git a/src/pydiamond/graphics/drawable.py b/src/pydiamond/graphics/drawable.py index e513e332..878787ef 100644 --- a/src/pydiamond/graphics/drawable.py +++ b/src/pydiamond/graphics/drawable.py @@ -150,12 +150,10 @@ def __contains__(self, value: object) -> bool: return self.data.__contains__(value) @overload - def __getitem__(self, index: SupportsIndex, /) -> _D: - ... + def __getitem__(self, index: SupportsIndex, /) -> _D: ... @overload - def __getitem__(self, index: slice, /) -> list[_D]: - ... + def __getitem__(self, index: slice, /) -> list[_D]: ... def __getitem__(self, index: SupportsIndex | slice, /) -> _D | list[_D]: return self.data[index] diff --git a/src/pydiamond/graphics/font.py b/src/pydiamond/graphics/font.py index fb5fe699..b12783da 100644 --- a/src/pydiamond/graphics/font.py +++ b/src/pydiamond/graphics/font.py @@ -242,8 +242,7 @@ def get_rect( style: int = ..., rotation: int = ..., size: float = ..., - ) -> Rect: - ... + ) -> Rect: ... @overload def get_rect( @@ -270,8 +269,7 @@ def get_rect( center: tuple[float, float] = ..., centerx: float = ..., centery: float = ..., - ) -> Rect: - ... + ) -> Rect: ... def get_rect( self, diff --git a/src/pydiamond/graphics/grid.py b/src/pydiamond/graphics/grid.py index 5a8e02bb..3ebbd059 100644 --- a/src/pydiamond/graphics/grid.py +++ b/src/pydiamond/graphics/grid.py @@ -128,8 +128,7 @@ def get_cell_size(self, row: int, column: int) -> tuple[float, float]: return (self.__max_width_columns.get(column, 0), self.__max_height_rows.get(row, 0)) @overload - def get_cell_rect(self, row: int, column: int) -> Rect: - ... + def get_cell_rect(self, row: int, column: int) -> Rect: ... @overload def get_cell_rect( @@ -159,8 +158,7 @@ def get_cell_rect( height: float = ..., w: float = ..., h: float = ..., - ) -> Rect: - ... + ) -> Rect: ... @final def get_cell_rect(self, row: int, column: int, **kwargs: float | tuple[float, float]) -> Rect: @@ -174,8 +172,7 @@ def get_cell_relative_rect(self, row: int, column: int) -> Rect: return Rect(*self.__compute_cell_rect(row, column, relative=True)) @overload - def get_cell_rect_from_object(self, obj: GridElement) -> Rect: - ... + def get_cell_rect_from_object(self, obj: GridElement) -> Rect: ... @overload def get_cell_rect_from_object( @@ -204,8 +201,7 @@ def get_cell_rect_from_object( height: float = ..., w: float = ..., h: float = ..., - ) -> Rect: - ... + ) -> Rect: ... @final def get_cell_rect_from_object(self, obj: GridElement, **kwargs: float | tuple[float, float]) -> Rect: @@ -286,12 +282,10 @@ def place( return obj @overload - def get(self, row: int, column: int) -> GridElement | None: - ... + def get(self, row: int, column: int) -> GridElement | None: ... @overload - def get(self, row: int, column: int, default: _T) -> GridElement | _T: - ... + def get(self, row: int, column: int, default: _T) -> GridElement | _T: ... def get(self, row: int, column: int, default: Any = None) -> Any: try: @@ -300,12 +294,10 @@ def get(self, row: int, column: int, default: Any = None) -> Any: return default @overload - def pop(self, row: int, column: int) -> GridElement: - ... + def pop(self, row: int, column: int) -> GridElement: ... @overload - def pop(self, row: int, column: int, default: _T) -> GridElement | _T: - ... + def pop(self, row: int, column: int, default: _T) -> GridElement | _T: ... def pop(self, row: int, column: int, default: Any = _MISSING) -> Any: try: @@ -706,12 +698,10 @@ def check_non_empty(self) -> GridElement: @overload def set_object( self, obj: GridElement, *, padx: int | None = None, pady: int | None = None, justify: str | None = None - ) -> None: - ... + ) -> None: ... @overload - def set_object(self, obj: None) -> None: - ... + def set_object(self, obj: None) -> None: ... def set_object( self, diff --git a/src/pydiamond/graphics/image.py b/src/pydiamond/graphics/image.py index faedbf91..22180aad 100644 --- a/src/pydiamond/graphics/image.py +++ b/src/pydiamond/graphics/image.py @@ -69,12 +69,10 @@ def get(self, apply_rotation_scale: bool = False) -> Surface: return self.__default_image.copy() @overload - def set(self, image: Surface, copy: bool = True) -> None: - ... + def set(self, image: Surface, copy: bool = True) -> None: ... @overload - def set(self, image: None) -> None: - ... + def set(self, image: None) -> None: ... def set(self, image: Surface | None, copy: bool = True) -> None: center: tuple[float, float] = self.center diff --git a/src/pydiamond/graphics/movable.py b/src/pydiamond/graphics/movable.py index 5b39b7dc..89e57c6f 100644 --- a/src/pydiamond/graphics/movable.py +++ b/src/pydiamond/graphics/movable.py @@ -151,8 +151,7 @@ def __init__(self, **kwargs: Any) -> None: self.__y: float = 0 @overload - def get_position(self, anchor: Literal["x", "y", "left", "top", "right", "bottom", "centerx", "centery"]) -> float: - ... + def get_position(self, anchor: Literal["x", "y", "left", "top", "right", "bottom", "centerx", "centery"]) -> float: ... @overload def get_position( @@ -168,12 +167,10 @@ def get_position( "midtop", "midbottom", ], - ) -> tuple[float, float]: - ... + ) -> tuple[float, float]: ... @overload - def get_position(self, anchor: str) -> float | tuple[float, float]: - ... + def get_position(self, anchor: str) -> float | tuple[float, float]: ... @final def get_position(self, anchor: str) -> float | tuple[float, float]: @@ -199,8 +196,7 @@ def set_position( bottom: float = ..., centerx: float = ..., centery: float = ..., - ) -> None: - ... + ) -> None: ... @overload def set_position( @@ -215,8 +211,7 @@ def set_position( midright: tuple[float, float] = ..., midtop: tuple[float, float] = ..., midbottom: tuple[float, float] = ..., - ) -> None: - ... + ) -> None: ... @final def set_position(self, **kwargs: Any) -> None: @@ -262,8 +257,7 @@ def _set_position( self, anchor: Literal["x", "y", "left", "top", "right", "bottom", "centerx", "centery"], value: float, - ) -> None: - ... + ) -> None: ... @overload def _set_position( @@ -280,12 +274,10 @@ def _set_position( "midbottom", ], value: tuple[float, float], - ) -> None: - ... + ) -> None: ... @overload - def _set_position(self, anchor: str, value: float | tuple[float, float]) -> None: - ... + def _set_position(self, anchor: str, value: float | tuple[float, float]) -> None: ... @final def _set_position(self, anchor: str, value: float | tuple[float, float]) -> None: @@ -344,8 +336,7 @@ def get_height(self) -> float: return self.get_size()[1] @overload - def get_rect(self) -> Rect: - ... + def get_rect(self) -> Rect: ... @overload def get_rect( @@ -373,8 +364,7 @@ def get_rect( height: float = ..., w: float = ..., h: float = ..., - ) -> Rect: - ... + ) -> Rect: ... @final def get_rect(self, **kwargs: float | tuple[float, float]) -> Rect: diff --git a/src/pydiamond/graphics/renderer.py b/src/pydiamond/graphics/renderer.py index fa3c6005..1ba02c00 100644 --- a/src/pydiamond/graphics/renderer.py +++ b/src/pydiamond/graphics/renderer.py @@ -118,8 +118,7 @@ def draw_many_surfaces( | tuple[Surface, Coordinate | _CanBeRect, _CanBeRect | None, int] ], doreturn: Literal[True] = ..., - ) -> list[Rect]: - ... + ) -> list[Rect]: ... @overload def draw_many_surfaces( @@ -130,8 +129,7 @@ def draw_many_surfaces( | tuple[Surface, Coordinate | _CanBeRect, _CanBeRect | None, int] ], doreturn: Literal[False], - ) -> None: - ... + ) -> None: ... @overload def draw_many_surfaces( @@ -142,8 +140,7 @@ def draw_many_surfaces( | tuple[Surface, Coordinate | _CanBeRect, _CanBeRect | None, int] ], doreturn: bool, - ) -> list[Rect] | None: - ... + ) -> list[Rect] | None: ... def draw_many_surfaces( self, @@ -312,8 +309,7 @@ def draw_many_surfaces( | tuple[Surface, Coordinate | _CanBeRect, _CanBeRect | None, int] ], doreturn: Literal[True] = ..., - ) -> list[Rect]: - ... + ) -> list[Rect]: ... @overload def draw_many_surfaces( @@ -324,8 +320,7 @@ def draw_many_surfaces( | tuple[Surface, Coordinate | _CanBeRect, _CanBeRect | None, int] ], doreturn: Literal[False], - ) -> None: - ... + ) -> None: ... @overload def draw_many_surfaces( @@ -336,8 +331,7 @@ def draw_many_surfaces( | tuple[Surface, Coordinate | _CanBeRect, _CanBeRect | None, int] ], doreturn: bool, - ) -> list[Rect] | None: - ... + ) -> list[Rect] | None: ... def draw_many_surfaces( self, diff --git a/src/pydiamond/graphics/shape.py b/src/pydiamond/graphics/shape.py index ad1564f0..e828944e 100644 --- a/src/pydiamond/graphics/shape.py +++ b/src/pydiamond/graphics/shape.py @@ -293,8 +293,7 @@ def get_vertices( center: Vector2 | _FPoint | None = ..., apply_rotation: bool = ..., apply_scale: bool = ..., - ) -> tuple[()] | tuple[Vector2, Vector2, Vector2, Vector2]: - ... + ) -> tuple[()] | tuple[Vector2, Vector2, Vector2, Vector2]: ... @final def get_local_size(self) -> tuple[float, float]: @@ -339,8 +338,7 @@ def get_vertices( center: Vector2 | _FPoint | None = ..., apply_rotation: bool = ..., apply_scale: bool = ..., - ) -> tuple[()] | tuple[Vector2, Vector2, Vector2, Vector2]: - ... + ) -> tuple[()] | tuple[Vector2, Vector2, Vector2, Vector2]: ... @final def get_local_size(self) -> tuple[float, float]: diff --git a/src/pydiamond/graphics/sprite.py b/src/pydiamond/graphics/sprite.py index 51bc5d9f..1dade2ac 100644 --- a/src/pydiamond/graphics/sprite.py +++ b/src/pydiamond/graphics/sprite.py @@ -40,17 +40,14 @@ def func(self: Sprite) -> TransformAnimation: if TYPE_CHECKING: @overload # type: ignore[override] - def __get__(self, instance: None, owner: type[Any] | None = None) -> _SpriteTransformAnimation: - ... + def __get__(self, instance: None, owner: type[Any] | None = None) -> _SpriteTransformAnimation: ... @overload - def __get__(self, instance: Sprite, owner: type[Any] | None = None) -> TransformAnimation: - ... + def __get__(self, instance: Sprite, owner: type[Any] | None = None) -> TransformAnimation: ... def __get__( self, instance: Sprite | None, owner: type[Any] | None = None - ) -> _SpriteTransformAnimation | TransformAnimation: - ... + ) -> _SpriteTransformAnimation | TransformAnimation: ... class Sprite(Drawable, Transformable): diff --git a/src/pydiamond/graphics/surface.py b/src/pydiamond/graphics/surface.py index 910a92ba..5db375dc 100644 --- a/src/pydiamond/graphics/surface.py +++ b/src/pydiamond/graphics/surface.py @@ -149,8 +149,7 @@ def draw_many_surfaces( | tuple[Surface, Coordinate | _CanBeRect, _CanBeRect | None, int] ], doreturn: Literal[True] = ..., - ) -> list[Rect]: - ... + ) -> list[Rect]: ... @overload def draw_many_surfaces( @@ -161,8 +160,7 @@ def draw_many_surfaces( | tuple[Surface, Coordinate | _CanBeRect, _CanBeRect | None, int] ], doreturn: Literal[False], - ) -> None: - ... + ) -> None: ... @overload def draw_many_surfaces( @@ -173,8 +171,7 @@ def draw_many_surfaces( | tuple[Surface, Coordinate | _CanBeRect, _CanBeRect | None, int] ], doreturn: bool, - ) -> list[Rect] | None: - ... + ) -> list[Rect] | None: ... def draw_many_surfaces( self, diff --git a/src/pydiamond/graphics/text.py b/src/pydiamond/graphics/text.py index ba24ce61..c2b95b45 100644 --- a/src/pydiamond/graphics/text.py +++ b/src/pydiamond/graphics/text.py @@ -358,24 +358,19 @@ def img_set_rotation(self, *args: Any, **kwargs: Any) -> None: self.__img_angle = self.__img.angle @overload - def img_set_scale(self, *, scale_x: float) -> None: - ... + def img_set_scale(self, *, scale_x: float) -> None: ... @overload - def img_set_scale(self, *, scale_y: float) -> None: - ... + def img_set_scale(self, *, scale_y: float) -> None: ... @overload - def img_set_scale(self, *, scale_x: float, scale_y: float) -> None: - ... + def img_set_scale(self, *, scale_x: float, scale_y: float) -> None: ... @overload - def img_set_scale(self, __scale: float, /) -> None: - ... + def img_set_scale(self, __scale: float, /) -> None: ... @overload - def img_set_scale(self, __scale: tuple[float, float], /) -> None: - ... + def img_set_scale(self, __scale: tuple[float, float], /) -> None: ... # @reflect_method_signature() doesn't work with overloads def img_set_scale(self, *args: Any, **kwargs: Any) -> None: diff --git a/src/pydiamond/graphics/transformable.py b/src/pydiamond/graphics/transformable.py index cf433f1c..b8dd3cd6 100644 --- a/src/pydiamond/graphics/transformable.py +++ b/src/pydiamond/graphics/transformable.py @@ -54,24 +54,19 @@ def set_rotation(self, angle: float, pivot: tuple[float, float] | Vector2 | str self.center = center.x, center.y @overload - def set_scale(self, *, scale_x: float) -> None: - ... + def set_scale(self, *, scale_x: float) -> None: ... @overload - def set_scale(self, *, scale_y: float) -> None: - ... + def set_scale(self, *, scale_y: float) -> None: ... @overload - def set_scale(self, *, scale_x: float, scale_y: float) -> None: - ... + def set_scale(self, *, scale_x: float, scale_y: float) -> None: ... @overload - def set_scale(self, __scale: float, /) -> None: - ... + def set_scale(self, __scale: float, /) -> None: ... @overload - def set_scale(self, __scale: tuple[float, float], /) -> None: - ... + def set_scale(self, __scale: tuple[float, float], /) -> None: ... @final # type: ignore[misc] # mypy will not understand def set_scale( @@ -354,8 +349,7 @@ def get_area_vertices( *, apply_scale: bool = True, apply_rotation: bool = True, - ) -> tuple[()] | tuple[Vector2, Vector2, Vector2, Vector2]: - ... + ) -> tuple[()] | tuple[Vector2, Vector2, Vector2, Vector2]: ... @overload def get_area_vertices( @@ -380,8 +374,7 @@ def get_area_vertices( midright: tuple[float, float] = ..., midtop: tuple[float, float] = ..., midbottom: tuple[float, float] = ..., - ) -> tuple[()] | tuple[Vector2, Vector2, Vector2, Vector2]: - ... + ) -> tuple[()] | tuple[Vector2, Vector2, Vector2, Vector2]: ... @final def get_area_vertices( @@ -425,8 +418,7 @@ def get_area_vertices( return vertices @overload - def get_area(self, *, apply_scale: bool = True, apply_rotation: bool = True) -> Rect: - ... + def get_area(self, *, apply_scale: bool = True, apply_rotation: bool = True) -> Rect: ... @overload def get_area( @@ -456,8 +448,7 @@ def get_area( height: float = ..., w: float = ..., h: float = ..., - ) -> Rect: - ... + ) -> Rect: ... @final def get_area(self, *, apply_scale: bool = True, apply_rotation: bool = True, **kwargs: float | tuple[float, float]) -> Rect: @@ -467,8 +458,7 @@ def get_area(self, *, apply_scale: bool = True, apply_rotation: bool = True, **k return r @overload - def get_local_rect(self) -> Rect: - ... + def get_local_rect(self) -> Rect: ... @overload def get_local_rect( @@ -496,8 +486,7 @@ def get_local_rect( height: float = ..., w: float = ..., h: float = ..., - ) -> Rect: - ... + ) -> Rect: ... @final def get_local_rect(self, **kwargs: float | tuple[float, float]) -> Rect: diff --git a/src/pydiamond/gui/focus.py b/src/pydiamond/gui/focus.py index 89b2477d..8740aea1 100644 --- a/src/pydiamond/gui/focus.py +++ b/src/pydiamond/gui/focus.py @@ -118,12 +118,10 @@ def has(self) -> bool: return (scene.focus_get() if (scene := self.__scene()) else None) is self.__self__ @overload - def take(self, status: bool) -> None: - ... + def take(self, status: bool) -> None: ... @overload - def take(self) -> bool: - ... + def take(self) -> bool: ... def take(self, status: bool | None = None) -> bool | None: f: SupportsFocus = self.__self__ @@ -158,12 +156,10 @@ def set_obj_on_side( on_bottom: SupportsFocus | None = ..., on_left: SupportsFocus | None = ..., on_right: SupportsFocus | None = ..., - ) -> None: - ... + ) -> None: ... @overload - def set_obj_on_side(self, __m: Mapping[str, SupportsFocus | None], /) -> None: - ... + def set_obj_on_side(self, __m: Mapping[str, SupportsFocus | None], /) -> None: ... def set_obj_on_side( self, @@ -205,12 +201,10 @@ def remove_all_links(self) -> None: self.__side.pop(f, None) @overload - def get_obj_on_side(self) -> BoundObjectsDict: - ... + def get_obj_on_side(self) -> BoundObjectsDict: ... @overload - def get_obj_on_side(self, side: str) -> SupportsFocus | None: - ... + def get_obj_on_side(self, side: str) -> SupportsFocus | None: ... def get_obj_on_side(self, side: str | None = None) -> BoundObjectsDict | SupportsFocus | None: f: SupportsFocus = self.__self__ diff --git a/src/pydiamond/gui/scene.py b/src/pydiamond/gui/scene.py index 41fc7ea9..ddc7fa7c 100644 --- a/src/pydiamond/gui/scene.py +++ b/src/pydiamond/gui/scene.py @@ -110,12 +110,10 @@ def __internal_focus_next(self, offset: Literal[1, -1]) -> SupportsFocus | None: return None @overload - def focus_set(self, focusable: SupportsFocus) -> bool: - ... + def focus_set(self, focusable: SupportsFocus) -> bool: ... @overload - def focus_set(self, focusable: None) -> None: - ... + def focus_set(self, focusable: None) -> None: ... @no_theme_decorator def focus_set(self, focusable: SupportsFocus | None) -> bool | None: @@ -269,12 +267,10 @@ def __contains__(self, value: object) -> bool: return self.__list.__contains__(value) @overload - def __getitem__(self, index: int, /) -> SupportsFocus: - ... + def __getitem__(self, index: int, /) -> SupportsFocus: ... @overload - def __getitem__(self, index: slice, /) -> Sequence[SupportsFocus]: - ... + def __getitem__(self, index: slice, /) -> Sequence[SupportsFocus]: ... def __getitem__(self, index: int | slice, /) -> SupportsFocus | Sequence[SupportsFocus]: if not isinstance(index, slice) and index < 0: @@ -300,12 +296,10 @@ def update(self) -> None: f._focus_update() @overload - def index(self, value: Any) -> int: - ... + def index(self, value: Any) -> int: ... @overload - def index(self, value: Any, start: int = ..., stop: int = ...) -> int: - ... + def index(self, value: Any, start: int = ..., stop: int = ...) -> int: ... def index(self, value: Any, *args: Any, **kwargs: Any) -> int: return self.__list.index(value, *args, **kwargs) diff --git a/src/pydiamond/gui/tools/_grid.py b/src/pydiamond/gui/tools/_grid.py index 63b2114e..46034c52 100644 --- a/src/pydiamond/gui/tools/_grid.py +++ b/src/pydiamond/gui/tools/_grid.py @@ -149,8 +149,7 @@ def __init__( wheel_xscroll_increment: int = ..., wheel_yscroll_increment: int = ..., **kwargs: Any, - ) -> None: - ... + ) -> None: ... @abstractmethod def get_size(self) -> tuple[float, float]: diff --git a/src/pydiamond/gui/tools/view.py b/src/pydiamond/gui/tools/view.py index 5ce95dbb..9f86a086 100644 --- a/src/pydiamond/gui/tools/view.py +++ b/src/pydiamond/gui/tools/view.py @@ -102,12 +102,10 @@ def command_wrapper(start: float, end: float, /) -> None: self.__xscrollcommand = xscrollcommand @overload - def xview(self, action: Literal["moveto"], fraction: float, /) -> None: - ... + def xview(self, action: Literal["moveto"], fraction: float, /) -> None: ... @overload - def xview(self, action: str, /, *args: Any) -> None: - ... + def xview(self, action: str, /, *args: Any) -> None: ... def xview(self, action: str, /, *args: Any) -> None: match action: @@ -146,12 +144,10 @@ def command_wrapper(start: float, end: float, /) -> None: self.__yscrollcommand = yscrollcommand @overload - def yview(self, action: Literal["moveto"], fraction: float, /) -> None: - ... + def yview(self, action: Literal["moveto"], fraction: float, /) -> None: ... @overload - def yview(self, action: str, /, *args: Any) -> None: - ... + def yview(self, action: str, /, *args: Any) -> None: ... def yview(self, action: str, /, *args: Any) -> None: match action: diff --git a/src/pydiamond/gui/widgets/abc.py b/src/pydiamond/gui/widgets/abc.py index 6523b554..80758a4e 100644 --- a/src/pydiamond/gui/widgets/abc.py +++ b/src/pydiamond/gui/widgets/abc.py @@ -234,8 +234,7 @@ def get_visible_rect(self) -> Rect: def get_relative_position( self, anchor: Literal["x", "y", "left", "top", "right", "bottom", "centerx", "centery"], - ) -> float: - ... + ) -> float: ... @overload def get_relative_position( @@ -251,12 +250,10 @@ def get_relative_position( "midtop", "midbottom", ], - ) -> tuple[float, float]: - ... + ) -> tuple[float, float]: ... @overload - def get_relative_position(self, anchor: str) -> float | tuple[float, float]: - ... + def get_relative_position(self, anchor: str) -> float | tuple[float, float]: ... @final def get_relative_position(self, anchor: str) -> float | tuple[float, float]: @@ -289,8 +286,7 @@ def set_relative_position( bottom: float = ..., centerx: float = ..., centery: float = ..., - ) -> None: - ... + ) -> None: ... @overload def set_relative_position( @@ -305,8 +301,7 @@ def set_relative_position( midright: tuple[float, float] = ..., midtop: tuple[float, float] = ..., midbottom: tuple[float, float] = ..., - ) -> None: - ... + ) -> None: ... @final def set_relative_position(self, **kwargs: Any) -> None: diff --git a/src/pydiamond/gui/widgets/button.py b/src/pydiamond/gui/widgets/button.py index 59f7d8b7..4e71515b 100644 --- a/src/pydiamond/gui/widgets/button.py +++ b/src/pydiamond/gui/widgets/button.py @@ -403,24 +403,19 @@ def img_set_rotation(self, *args: Any, **kwargs: Any) -> None: self.__update_shape_size() @overload - def img_set_scale(self, *, scale_x: float) -> None: - ... + def img_set_scale(self, *, scale_x: float) -> None: ... @overload - def img_set_scale(self, *, scale_y: float) -> None: - ... + def img_set_scale(self, *, scale_y: float) -> None: ... @overload - def img_set_scale(self, *, scale_x: float, scale_y: float) -> None: - ... + def img_set_scale(self, *, scale_x: float, scale_y: float) -> None: ... @overload - def img_set_scale(self, __scale: float, /) -> None: - ... + def img_set_scale(self, __scale: float, /) -> None: ... @overload - def img_set_scale(self, __scale: tuple[float, float], /) -> None: - ... + def img_set_scale(self, __scale: tuple[float, float], /) -> None: ... # @reflect_method_signature() doesn't work with overloads def img_set_scale(self, *args: Any, **kwargs: Any) -> None: @@ -473,12 +468,10 @@ def img_set_max_size(self, *args: Any, **kwargs: Any) -> None: self.__update_shape_size() @overload - def show_background(self) -> bool: - ... + def show_background(self) -> bool: ... @overload - def show_background(self, status: bool) -> None: - ... + def show_background(self, status: bool) -> None: ... def show_background(self, status: bool | None = None) -> bool | None: if status is None: @@ -1186,13 +1179,11 @@ class _ImageButtonDict(TypedDict): @overload -def _copy_color(c: Color | None) -> Color | None: - ... +def _copy_color(c: Color | None) -> Color | None: ... @overload -def _copy_color(c: Color | None, default: Color) -> Color: - ... +def _copy_color(c: Color | None, default: Color) -> Color: ... def _copy_color(c: Color | None, default: Color | None = None) -> Color | None: @@ -1200,13 +1191,11 @@ def _copy_color(c: Color | None, default: Color | None = None) -> Color | None: @overload -def _copy_img(surface: Surface | None) -> Surface | None: - ... +def _copy_img(surface: Surface | None) -> Surface | None: ... @overload -def _copy_img(surface: Surface | None, default: Surface) -> Surface: - ... +def _copy_img(surface: Surface | None, default: Surface) -> Surface: ... def _copy_img(surface: Surface | None, default: Surface | None = None) -> Surface | None: diff --git a/src/pydiamond/gui/widgets/form.py b/src/pydiamond/gui/widgets/form.py index 60a5953c..4fe075a1 100644 --- a/src/pydiamond/gui/widgets/form.py +++ b/src/pydiamond/gui/widgets/form.py @@ -132,12 +132,10 @@ def remove_entry(self, name: str) -> None: grid.unify() @overload - def get(self) -> MappingProxyType[str, str]: - ... + def get(self) -> MappingProxyType[str, str]: ... @overload - def get(self, name: str) -> str: - ... + def get(self, name: str) -> str: ... def get(self, name: str | None = None) -> str | MappingProxyType[str, str]: entry_dict: WeakValueDictionary[str, Entry] = self.__entry_dict diff --git a/src/pydiamond/gui/widgets/scroll.py b/src/pydiamond/gui/widgets/scroll.py index 0cda1507..d47ee856 100644 --- a/src/pydiamond/gui/widgets/scroll.py +++ b/src/pydiamond/gui/widgets/scroll.py @@ -32,8 +32,7 @@ class _ScrollBarCommand(Protocol): - def __call__(self, action: Literal["moveto"], fraction: float, /) -> None: - ... + def __call__(self, action: Literal["moveto"], fraction: float, /) -> None: ... # TODO: Add this command (arrow buttons) # @overload @@ -416,8 +415,7 @@ def __init__( wheel_xscroll_increment: int = ..., wheel_yscroll_increment: int = ..., **kwargs: Any, - ) -> None: - ... + ) -> None: ... def _setup_mouse_wheel( self, diff --git a/src/pydiamond/math/rect.py b/src/pydiamond/math/rect.py index d1b1be92..826a41c9 100644 --- a/src/pydiamond/math/rect.py +++ b/src/pydiamond/math/rect.py @@ -59,8 +59,7 @@ def __reduce__(self) -> str | tuple[Any, ...]: @overload -def modify_rect(r: Rect, /) -> Rect: - ... +def modify_rect(r: Rect, /) -> Rect: ... @overload @@ -90,8 +89,7 @@ def modify_rect( height: float | None = ..., w: float | None = ..., h: float | None = ..., -) -> Rect: - ... +) -> Rect: ... def modify_rect(r: Rect, /, **kwargs: float | tuple[float, float] | None) -> Rect: @@ -105,8 +103,7 @@ def modify_rect(r: Rect, /, **kwargs: float | tuple[float, float] | None) -> Rec @overload -def modify_rect_in_place(r: Rect, /) -> None: - ... +def modify_rect_in_place(r: Rect, /) -> None: ... @overload @@ -136,8 +133,7 @@ def modify_rect_in_place( height: float | None = ..., w: float | None = ..., h: float | None = ..., -) -> None: - ... +) -> None: ... def modify_rect_in_place(r: Rect, /, **kwargs: float | tuple[float, float] | None) -> None: @@ -149,8 +145,7 @@ def modify_rect_in_place(r: Rect, /, **kwargs: float | tuple[float, float] | Non @overload -def move_rect(r: Rect, /) -> Rect: - ... +def move_rect(r: Rect, /) -> Rect: ... @overload @@ -175,8 +170,7 @@ def move_rect( center: tuple[float, float] | None = ..., centerx: float | None = ..., centery: float | None = ..., -) -> Rect: - ... +) -> Rect: ... def move_rect(r: Rect, /, **kwargs: Any) -> Rect: @@ -184,8 +178,7 @@ def move_rect(r: Rect, /, **kwargs: Any) -> Rect: @overload -def move_rect_in_place(r: Rect, /) -> None: - ... +def move_rect_in_place(r: Rect, /) -> None: ... @overload @@ -210,8 +203,7 @@ def move_rect_in_place( center: tuple[float, float] | None = ..., centerx: float | None = ..., centery: float | None = ..., -) -> None: - ... +) -> None: ... def move_rect_in_place(r: Rect, /, **kwargs: Any) -> None: diff --git a/src/pydiamond/scene/abc.py b/src/pydiamond/scene/abc.py index 0060914d..6c59341d 100644 --- a/src/pydiamond/scene/abc.py +++ b/src/pydiamond/scene/abc.py @@ -337,8 +337,7 @@ def start( # type: ignore[misc] __dialog: type[Dialog], /, **awake_kwargs: Any, - ) -> None: - ... + ) -> None: ... @overload def start( @@ -349,8 +348,7 @@ def start( transition: SceneTransitionProtocol | None = None, stop_self: bool = False, **awake_kwargs: Any, - ) -> NoReturn: - ... + ) -> NoReturn: ... @final def start( @@ -375,12 +373,10 @@ def stop(self) -> NoReturn: @overload def after( self, __milliseconds: float, __callback: Callable[_P, None], /, *args: _P.args, **kwargs: _P.kwargs - ) -> WindowCallback: - ... + ) -> WindowCallback: ... @overload - def after(self, __milliseconds: float, /) -> Callable[[Callable[[], None]], WindowCallback]: - ... + def after(self, __milliseconds: float, /) -> Callable[[Callable[[], None]], WindowCallback]: ... @no_theme_decorator def after( @@ -400,18 +396,15 @@ def decorator(__callback: Callable[..., None], /) -> WindowCallback: @overload def every( self, __milliseconds: float, __callback: Callable[_P, None], /, *args: _P.args, **kwargs: _P.kwargs - ) -> WindowCallback: - ... + ) -> WindowCallback: ... @overload def every( self, __milliseconds: float, __callback: Callable[_P, Iterator[None]], /, *args: _P.args, **kwargs: _P.kwargs - ) -> WindowCallback: - ... + ) -> WindowCallback: ... @overload - def every(self, __milliseconds: float, /) -> Callable[[Callable[[], Iterator[None] | None]], WindowCallback]: - ... + def every(self, __milliseconds: float, /) -> Callable[[Callable[[], Iterator[None] | None]], WindowCallback]: ... @no_theme_decorator def every( diff --git a/src/pydiamond/system/collections/_orderedweakset.py b/src/pydiamond/system/collections/_orderedweakset.py index 12dcdb9b..21d582e6 100644 --- a/src/pydiamond/system/collections/_orderedweakset.py +++ b/src/pydiamond/system/collections/_orderedweakset.py @@ -15,14 +15,11 @@ from typing import ContextManager class _IterationGuard(ContextManager["_IterationGuard"]): - def __init__(self, weakcontainer: WeakSet[Any]) -> None: - ... + def __init__(self, weakcontainer: WeakSet[Any]) -> None: ... - def __enter__(self) -> _IterationGuard: - ... + def __enter__(self) -> _IterationGuard: ... - def __exit__(self, *args: Any) -> None: - ... + def __exit__(self, *args: Any) -> None: ... else: from _weakrefset import _IterationGuard diff --git a/src/pydiamond/system/configuration.py b/src/pydiamond/system/configuration.py index fa84d6bd..cad0c67c 100644 --- a/src/pydiamond/system/configuration.py +++ b/src/pydiamond/system/configuration.py @@ -297,12 +297,10 @@ def __init_subclass__(cls: type, **kwargs: Any) -> None: type.__setattr__(owner, "__init_subclass__", _classmethod(__init_subclass__)) @overload - def __get__(self, obj: None, objtype: type, /) -> ConfigurationTemplate: - ... + def __get__(self, obj: None, objtype: type, /) -> ConfigurationTemplate: ... @overload - def __get__(self, obj: _T, objtype: type | None = None, /) -> Configuration[_T]: - ... + def __get__(self, obj: _T, objtype: type | None = None, /) -> Configuration[_T]: ... def __get__(self, obj: Any, objtype: type | None = None, /) -> ConfigurationTemplate | Configuration[Any]: if obj is None: @@ -421,8 +419,7 @@ def add_section( ) @overload - def section_property(self, func: Callable[[Any], Configuration[_T]], /) -> SectionProperty[_T]: - ... + def section_property(self, func: Callable[[Any], Configuration[_T]], /) -> SectionProperty[_T]: ... @overload def section_property( @@ -431,8 +428,7 @@ def section_property( *, include_options: Set[str] | None = ..., exclude_options: Set[str] | None = ..., - ) -> Callable[[Callable[[Any], Configuration[_T]]], SectionProperty[_T]]: - ... + ) -> Callable[[Callable[[Any], Configuration[_T]]], SectionProperty[_T]]: ... def section_property( self, @@ -473,12 +469,12 @@ def remove_parent_ownership(self, option: str) -> None: del template.value_descriptor[option] @overload - def getter(self, option: str, /, *, use_override: bool = True, readonly: bool = False) -> Callable[[_GetterVar], _GetterVar]: - ... + def getter( + self, option: str, /, *, use_override: bool = True, readonly: bool = False + ) -> Callable[[_GetterVar], _GetterVar]: ... @overload - def getter(self, option: str, func: _Getter, /, *, use_override: bool = True, readonly: bool = False) -> None: - ... + def getter(self, option: str, func: _Getter, /, *, use_override: bool = True, readonly: bool = False) -> None: ... def getter( self, option: str, func: _Getter | None = None, /, *, use_override: bool = True, readonly: bool = False @@ -530,24 +526,20 @@ def decorator(option: str, func: _Getter, /, *, readonly: bool = readonly) -> No @overload def getter_with_key( self, option: str, /, *, use_override: bool = True, readonly: bool = False - ) -> Callable[[_KeyGetterVar], _KeyGetterVar]: - ... + ) -> Callable[[_KeyGetterVar], _KeyGetterVar]: ... @overload def getter_with_key( self, option: str, /, *, use_key: Hashable, use_override: bool = True, readonly: bool = False - ) -> Callable[[_KeyGetterVar], _KeyGetterVar]: - ... + ) -> Callable[[_KeyGetterVar], _KeyGetterVar]: ... @overload - def getter_with_key(self, option: str, func: _KeyGetter, /, *, use_override: bool = True, readonly: bool = False) -> None: - ... + def getter_with_key(self, option: str, func: _KeyGetter, /, *, use_override: bool = True, readonly: bool = False) -> None: ... @overload def getter_with_key( self, option: str, func: _KeyGetter, /, *, use_key: Hashable, use_override: bool = True, readonly: bool = False - ) -> None: - ... + ) -> None: ... def getter_with_key( self, @@ -588,8 +580,7 @@ def getter_with_key_from_callable( *, use_override: bool = True, readonly: bool = False, - ) -> Callable[[_KeyGetterVar], _KeyGetterVar]: - ... + ) -> Callable[[_KeyGetterVar], _KeyGetterVar]: ... @overload def getter_with_key_from_callable( @@ -601,8 +592,7 @@ def getter_with_key_from_callable( *, use_override: bool = True, readonly: bool = False, - ) -> None: - ... + ) -> None: ... def getter_with_key_from_callable( self, @@ -642,8 +632,7 @@ def getter_with_key_from_map( *, use_override: bool = True, readonly: bool = False, - ) -> Callable[[_KeyGetterVar], _KeyGetterVar]: - ... + ) -> Callable[[_KeyGetterVar], _KeyGetterVar]: ... @overload def getter_with_key_from_map( @@ -655,8 +644,7 @@ def getter_with_key_from_map( *, use_override: bool = True, readonly: bool = False, - ) -> None: - ... + ) -> None: ... def getter_with_key_from_map( self, @@ -671,12 +659,10 @@ def getter_with_key_from_map( return self.getter_with_key_from_callable(option, key_map.__getitem__, func, use_override=use_override, readonly=readonly) @overload - def setter(self, option: str, /, *, use_override: bool = True) -> Callable[[_SetterVar], _SetterVar]: - ... + def setter(self, option: str, /, *, use_override: bool = True) -> Callable[[_SetterVar], _SetterVar]: ... @overload - def setter(self, option: str, func: _Setter, /, *, use_override: bool = True) -> None: - ... + def setter(self, option: str, func: _Setter, /, *, use_override: bool = True) -> None: ... def setter( self, option: str, func: _Setter | None = None, /, *, use_override: bool = True @@ -703,22 +689,18 @@ def decorator(option: str, func: _Setter, /) -> None: return None @overload - def setter_with_key(self, option: str, /, *, use_override: bool = True) -> Callable[[_KeySetterVar], _KeySetterVar]: - ... + def setter_with_key(self, option: str, /, *, use_override: bool = True) -> Callable[[_KeySetterVar], _KeySetterVar]: ... @overload def setter_with_key( self, option: str, /, *, use_key: Hashable, use_override: bool = True - ) -> Callable[[_KeySetterVar], _KeySetterVar]: - ... + ) -> Callable[[_KeySetterVar], _KeySetterVar]: ... @overload - def setter_with_key(self, option: str, func: _KeySetter, /, *, use_override: bool = True) -> None: - ... + def setter_with_key(self, option: str, func: _KeySetter, /, *, use_override: bool = True) -> None: ... @overload - def setter_with_key(self, option: str, func: _KeySetter, /, *, use_key: Hashable, use_override: bool = True) -> None: - ... + def setter_with_key(self, option: str, func: _KeySetter, /, *, use_key: Hashable, use_override: bool = True) -> None: ... def setter_with_key( self, @@ -757,8 +739,7 @@ def setter_with_key_from_callable( /, *, use_override: bool = True, - ) -> Callable[[_KeySetterVar], _KeySetterVar]: - ... + ) -> Callable[[_KeySetterVar], _KeySetterVar]: ... @overload def setter_with_key_from_callable( @@ -769,8 +750,7 @@ def setter_with_key_from_callable( /, *, use_override: bool = True, - ) -> None: - ... + ) -> None: ... def setter_with_key_from_callable( self, @@ -807,8 +787,7 @@ def setter_with_key_from_map( /, *, use_override: bool = True, - ) -> Callable[[_KeySetterVar], _KeySetterVar]: - ... + ) -> Callable[[_KeySetterVar], _KeySetterVar]: ... @overload def setter_with_key_from_map( @@ -819,8 +798,7 @@ def setter_with_key_from_map( /, *, use_override: bool = True, - ) -> None: - ... + ) -> None: ... def setter_with_key_from_map( self, @@ -834,12 +812,10 @@ def setter_with_key_from_map( return self.setter_with_key_from_callable(option, key_map.__getitem__, func, use_override=use_override) @overload - def deleter(self, option: str, /, *, use_override: bool = True) -> Callable[[_DeleterVar], _DeleterVar]: - ... + def deleter(self, option: str, /, *, use_override: bool = True) -> Callable[[_DeleterVar], _DeleterVar]: ... @overload - def deleter(self, option: str, func: _Deleter, /, *, use_override: bool = True) -> None: - ... + def deleter(self, option: str, func: _Deleter, /, *, use_override: bool = True) -> None: ... def deleter( self, option: str, func: _Deleter | None = None, /, *, use_override: bool = True @@ -866,22 +842,18 @@ def decorator(option: str, func: _Deleter, /) -> None: return None @overload - def deleter_with_key(self, option: str, /, *, use_override: bool = True) -> Callable[[_KeyDeleterVar], _KeyDeleterVar]: - ... + def deleter_with_key(self, option: str, /, *, use_override: bool = True) -> Callable[[_KeyDeleterVar], _KeyDeleterVar]: ... @overload def deleter_with_key( self, option: str, /, *, use_key: Hashable, use_override: bool = True - ) -> Callable[[_KeyDeleterVar], _KeyDeleterVar]: - ... + ) -> Callable[[_KeyDeleterVar], _KeyDeleterVar]: ... @overload - def deleter_with_key(self, option: str, func: _KeyDeleter, /, *, use_override: bool = True) -> None: - ... + def deleter_with_key(self, option: str, func: _KeyDeleter, /, *, use_override: bool = True) -> None: ... @overload - def deleter_with_key(self, option: str, func: _KeyDeleter, /, *, use_key: Hashable, use_override: bool = True) -> None: - ... + def deleter_with_key(self, option: str, func: _KeyDeleter, /, *, use_key: Hashable, use_override: bool = True) -> None: ... def deleter_with_key( self, @@ -920,8 +892,7 @@ def deleter_with_key_from_callable( /, *, use_override: bool = True, - ) -> Callable[[_KeyDeleterVar], _KeyDeleterVar]: - ... + ) -> Callable[[_KeyDeleterVar], _KeyDeleterVar]: ... @overload def deleter_with_key_from_callable( @@ -932,8 +903,7 @@ def deleter_with_key_from_callable( /, *, use_override: bool = True, - ) -> None: - ... + ) -> None: ... def deleter_with_key_from_callable( self, @@ -970,8 +940,7 @@ def deleter_with_key_from_map( /, *, use_override: bool = True, - ) -> Callable[[_KeyDeleterVar], _KeyDeleterVar]: - ... + ) -> Callable[[_KeyDeleterVar], _KeyDeleterVar]: ... @overload def deleter_with_key_from_map( @@ -982,8 +951,7 @@ def deleter_with_key_from_map( /, *, use_override: bool = True, - ) -> None: - ... + ) -> None: ... def deleter_with_key_from_map( self, @@ -1034,12 +1002,10 @@ def reset_getter_setter_deleter(self, option: str) -> None: del template.value_descriptor[option] @overload - def add_main_update(self, /, *, use_override: bool = True) -> Callable[[_UpdaterVar], _UpdaterVar]: - ... + def add_main_update(self, /, *, use_override: bool = True) -> Callable[[_UpdaterVar], _UpdaterVar]: ... @overload - def add_main_update(self, func: _UpdaterVar, /, *, use_override: bool = True) -> _UpdaterVar: - ... + def add_main_update(self, func: _UpdaterVar, /, *, use_override: bool = True) -> _UpdaterVar: ... def add_main_update( self, func: _UpdaterVar | None = None, /, *, use_override: bool = True @@ -1060,12 +1026,10 @@ def decorator(func: _UpdaterVar, /) -> _UpdaterVar: return decorator(func) @overload - def on_update(self, option: str, /, *, use_override: bool = True) -> Callable[[_UpdaterVar], _UpdaterVar]: - ... + def on_update(self, option: str, /, *, use_override: bool = True) -> Callable[[_UpdaterVar], _UpdaterVar]: ... @overload - def on_update(self, option: str, func: _Updater, /, *, use_override: bool = True) -> None: - ... + def on_update(self, option: str, func: _Updater, /, *, use_override: bool = True) -> None: ... def on_update( self, option: str, func: _Updater | None = None, /, *, use_override: bool = True @@ -1089,22 +1053,18 @@ def decorator(option: str, func: _Updater, /) -> None: return None @overload - def on_update_with_key(self, option: str, /, *, use_override: bool = True) -> Callable[[_KeyUpdaterVar], _KeyUpdaterVar]: - ... + def on_update_with_key(self, option: str, /, *, use_override: bool = True) -> Callable[[_KeyUpdaterVar], _KeyUpdaterVar]: ... @overload def on_update_with_key( self, option: str, /, *, use_key: Hashable, use_override: bool = True - ) -> Callable[[_KeyUpdaterVar], _KeyUpdaterVar]: - ... + ) -> Callable[[_KeyUpdaterVar], _KeyUpdaterVar]: ... @overload - def on_update_with_key(self, option: str, func: _KeyUpdater, /, *, use_override: bool = True) -> None: - ... + def on_update_with_key(self, option: str, func: _KeyUpdater, /, *, use_override: bool = True) -> None: ... @overload - def on_update_with_key(self, option: str, func: _KeyUpdater, /, *, use_key: Hashable, use_override: bool = True) -> None: - ... + def on_update_with_key(self, option: str, func: _KeyUpdater, /, *, use_key: Hashable, use_override: bool = True) -> None: ... def on_update_with_key( self, @@ -1143,8 +1103,7 @@ def on_update_with_key_from_callable( /, *, use_override: bool = True, - ) -> Callable[[_KeyUpdaterVar], _KeyUpdaterVar]: - ... + ) -> Callable[[_KeyUpdaterVar], _KeyUpdaterVar]: ... @overload def on_update_with_key_from_callable( @@ -1155,8 +1114,7 @@ def on_update_with_key_from_callable( /, *, use_override: bool = True, - ) -> None: - ... + ) -> None: ... def on_update_with_key_from_callable( self, @@ -1193,8 +1151,7 @@ def on_update_with_key_from_map( /, *, use_override: bool = True, - ) -> Callable[[_KeyUpdaterVar], _KeyUpdaterVar]: - ... + ) -> Callable[[_KeyUpdaterVar], _KeyUpdaterVar]: ... @overload def on_update_with_key_from_map( @@ -1205,8 +1162,7 @@ def on_update_with_key_from_map( /, *, use_override: bool = True, - ) -> None: - ... + ) -> None: ... def on_update_with_key_from_map( self, @@ -1220,12 +1176,10 @@ def on_update_with_key_from_map( return self.on_update_with_key_from_callable(option, key_map.__getitem__, func, use_override=use_override) @overload - def on_update_value(self, option: str, /, *, use_override: bool = True) -> Callable[[_ValueUpdaterVar], _ValueUpdaterVar]: - ... + def on_update_value(self, option: str, /, *, use_override: bool = True) -> Callable[[_ValueUpdaterVar], _ValueUpdaterVar]: ... @overload - def on_update_value(self, option: str, func: _ValueUpdater, /, *, use_override: bool = True) -> None: - ... + def on_update_value(self, option: str, func: _ValueUpdater, /, *, use_override: bool = True) -> None: ... def on_update_value( self, option: str, func: _ValueUpdater | None = None, /, *, use_override: bool = True @@ -1251,24 +1205,20 @@ def decorator(option: str, func: _ValueUpdater, /) -> None: @overload def on_update_value_with_key( self, option: str, /, *, use_override: bool = True - ) -> Callable[[_KeyValueUpdaterVar], _KeyValueUpdaterVar]: - ... + ) -> Callable[[_KeyValueUpdaterVar], _KeyValueUpdaterVar]: ... @overload def on_update_value_with_key( self, option: str, /, *, use_key: Hashable, use_override: bool = True - ) -> Callable[[_KeyValueUpdaterVar], _KeyValueUpdaterVar]: - ... + ) -> Callable[[_KeyValueUpdaterVar], _KeyValueUpdaterVar]: ... @overload - def on_update_value_with_key(self, option: str, func: _KeyValueUpdater, /, *, use_override: bool = True) -> None: - ... + def on_update_value_with_key(self, option: str, func: _KeyValueUpdater, /, *, use_override: bool = True) -> None: ... @overload def on_update_value_with_key( self, option: str, func: _KeyValueUpdater, /, *, use_key: Hashable, use_override: bool = True - ) -> None: - ... + ) -> None: ... def on_update_value_with_key( self, @@ -1307,8 +1257,7 @@ def on_update_value_with_key_from_callable( /, *, use_override: bool = True, - ) -> Callable[[_KeyValueUpdaterVar], _KeyValueUpdaterVar]: - ... + ) -> Callable[[_KeyValueUpdaterVar], _KeyValueUpdaterVar]: ... @overload def on_update_value_with_key_from_callable( @@ -1319,8 +1268,7 @@ def on_update_value_with_key_from_callable( /, *, use_override: bool = True, - ) -> None: - ... + ) -> None: ... def on_update_value_with_key_from_callable( self, @@ -1357,8 +1305,7 @@ def on_update_value_with_key_from_map( /, *, use_override: bool = True, - ) -> Callable[[_KeyValueUpdaterVar], _KeyValueUpdaterVar]: - ... + ) -> Callable[[_KeyValueUpdaterVar], _KeyValueUpdaterVar]: ... @overload def on_update_value_with_key_from_map( @@ -1369,8 +1316,7 @@ def on_update_value_with_key_from_map( /, *, use_override: bool = True, - ) -> None: - ... + ) -> None: ... def on_update_value_with_key_from_map( self, @@ -1384,12 +1330,10 @@ def on_update_value_with_key_from_map( return self.on_update_value_with_key_from_callable(option, key_map.__getitem__, func, use_override=use_override) @overload - def on_section_update(self, section: str, /, *, use_override: bool = True) -> Callable[[_UpdaterVar], _UpdaterVar]: - ... + def on_section_update(self, section: str, /, *, use_override: bool = True) -> Callable[[_UpdaterVar], _UpdaterVar]: ... @overload - def on_section_update(self, section: str, func: _Updater, /, *, use_override: bool = True) -> None: - ... + def on_section_update(self, section: str, func: _Updater, /, *, use_override: bool = True) -> None: ... def on_section_update( self, section: str, func: _Updater | None = None, /, *, use_override: bool = True @@ -1411,12 +1355,10 @@ def decorator(section: str, func: _Updater, /) -> None: return None @overload - def on_delete(self, option: str, /, *, use_override: bool = True) -> Callable[[_UpdaterVar], _UpdaterVar]: - ... + def on_delete(self, option: str, /, *, use_override: bool = True) -> Callable[[_UpdaterVar], _UpdaterVar]: ... @overload - def on_delete(self, option: str, func: _Updater, /, *, use_override: bool = True) -> None: - ... + def on_delete(self, option: str, func: _Updater, /, *, use_override: bool = True) -> None: ... def on_delete( self, option: str, func: _Updater | None = None, /, *, use_override: bool = True @@ -1440,22 +1382,18 @@ def decorator(option: str, func: _Updater, /) -> None: return None @overload - def on_delete_with_key(self, option: str, /, *, use_override: bool = True) -> Callable[[_KeyUpdaterVar], _KeyUpdaterVar]: - ... + def on_delete_with_key(self, option: str, /, *, use_override: bool = True) -> Callable[[_KeyUpdaterVar], _KeyUpdaterVar]: ... @overload def on_delete_with_key( self, option: str, /, *, use_key: Hashable, use_override: bool = True - ) -> Callable[[_KeyUpdaterVar], _KeyUpdaterVar]: - ... + ) -> Callable[[_KeyUpdaterVar], _KeyUpdaterVar]: ... @overload - def on_delete_with_key(self, option: str, func: _KeyUpdater, /, *, use_override: bool = True) -> None: - ... + def on_delete_with_key(self, option: str, func: _KeyUpdater, /, *, use_override: bool = True) -> None: ... @overload - def on_delete_with_key(self, option: str, func: _KeyUpdater, /, *, use_key: Hashable, use_override: bool = True) -> None: - ... + def on_delete_with_key(self, option: str, func: _KeyUpdater, /, *, use_key: Hashable, use_override: bool = True) -> None: ... def on_delete_with_key( self, @@ -1494,8 +1432,7 @@ def on_delete_with_key_from_callable( /, *, use_override: bool = True, - ) -> Callable[[_KeyUpdaterVar], _KeyUpdaterVar]: - ... + ) -> Callable[[_KeyUpdaterVar], _KeyUpdaterVar]: ... @overload def on_delete_with_key_from_callable( @@ -1506,8 +1443,7 @@ def on_delete_with_key_from_callable( /, *, use_override: bool = True, - ) -> None: - ... + ) -> None: ... def on_delete_with_key_from_callable( self, @@ -1544,8 +1480,7 @@ def on_delete_with_key_from_map( /, *, use_override: bool = True, - ) -> Callable[[_KeyUpdaterVar], _KeyUpdaterVar]: - ... + ) -> Callable[[_KeyUpdaterVar], _KeyUpdaterVar]: ... @overload def on_delete_with_key_from_map( @@ -1556,8 +1491,7 @@ def on_delete_with_key_from_map( /, *, use_override: bool = True, - ) -> None: - ... + ) -> None: ... def on_delete_with_key_from_map( self, @@ -1573,12 +1507,10 @@ def on_delete_with_key_from_map( @overload def add_value_validator( self, option: str, /, *, use_override: bool = True - ) -> Callable[[_ValueValidatorVar], _ValueValidatorVar]: - ... + ) -> Callable[[_ValueValidatorVar], _ValueValidatorVar]: ... @overload - def add_value_validator(self, option: str, func: _ValueValidator, /, *, use_override: bool = True) -> None: - ... + def add_value_validator(self, option: str, func: _ValueValidator, /, *, use_override: bool = True) -> None: ... def add_value_validator( self, @@ -1608,20 +1540,16 @@ def decorator(option: str, func: _ValueValidator, /) -> None: return None @overload - def add_value_validator_static(self, option: str, /) -> Callable[[_StaticValueValidatorVar], _StaticValueValidatorVar]: - ... + def add_value_validator_static(self, option: str, /) -> Callable[[_StaticValueValidatorVar], _StaticValueValidatorVar]: ... @overload - def add_value_validator_static(self, option: str, objtype: type, /, *, accept_none: bool = False) -> None: - ... + def add_value_validator_static(self, option: str, objtype: type, /, *, accept_none: bool = False) -> None: ... @overload - def add_value_validator_static(self, option: str, objtypes: Sequence[type], /, *, accept_none: bool = False) -> None: - ... + def add_value_validator_static(self, option: str, objtypes: Sequence[type], /, *, accept_none: bool = False) -> None: ... @overload - def add_value_validator_static(self, option: str, func: _StaticValueValidator, /) -> None: - ... + def add_value_validator_static(self, option: str, func: _StaticValueValidator, /) -> None: ... @overload def add_value_validator_static( @@ -1632,8 +1560,7 @@ def add_value_validator_static( predicate: Callable[[Any], bool | TypeGuard[Any]], exception: type[BaseException] = ValueError, message: str | None = None, - ) -> None: - ... + ) -> None: ... def add_value_validator_static( self, @@ -1684,12 +1611,10 @@ def decorator(option: str, func: _StaticValueValidator, /) -> None: @overload def add_value_converter_on_get( self, option: str, /, *, use_override: bool = True - ) -> Callable[[_ValueConverterVar], _ValueConverterVar]: - ... + ) -> Callable[[_ValueConverterVar], _ValueConverterVar]: ... @overload - def add_value_converter_on_get(self, option: str, func: _ValueConverter, /, *, use_override: bool = True) -> None: - ... + def add_value_converter_on_get(self, option: str, func: _ValueConverter, /, *, use_override: bool = True) -> None: ... def add_value_converter_on_get( self, @@ -1719,16 +1644,17 @@ def decorator(option: str, func: _ValueConverter, /) -> None: return None @overload - def add_value_converter_on_get_static(self, option: str, /) -> Callable[[_StaticValueConverterVar], _StaticValueConverterVar]: - ... + def add_value_converter_on_get_static( + self, option: str, / + ) -> Callable[[_StaticValueConverterVar], _StaticValueConverterVar]: ... @overload - def add_value_converter_on_get_static(self, option: str, convert_to_type: type[Any], /, *, accept_none: bool = False) -> None: - ... + def add_value_converter_on_get_static( + self, option: str, convert_to_type: type[Any], /, *, accept_none: bool = False + ) -> None: ... @overload - def add_value_converter_on_get_static(self, option: str, func: _StaticValueConverter, /) -> None: - ... + def add_value_converter_on_get_static(self, option: str, func: _StaticValueConverter, /) -> None: ... def add_value_converter_on_get_static( self, @@ -1764,12 +1690,10 @@ def decorator(option: str, func: _StaticValueConverter, /) -> None: @overload def add_value_converter_on_set( self, option: str, /, *, use_override: bool = True - ) -> Callable[[_ValueConverterVar], _ValueConverterVar]: - ... + ) -> Callable[[_ValueConverterVar], _ValueConverterVar]: ... @overload - def add_value_converter_on_set(self, option: str, func: _ValueConverter, /, *, use_override: bool = True) -> None: - ... + def add_value_converter_on_set(self, option: str, func: _ValueConverter, /, *, use_override: bool = True) -> None: ... def add_value_converter_on_set( self, @@ -1799,16 +1723,17 @@ def decorator(option: str, func: _ValueConverter, /) -> None: return None @overload - def add_value_converter_on_set_static(self, option: str, /) -> Callable[[_StaticValueConverterVar], _StaticValueConverterVar]: - ... + def add_value_converter_on_set_static( + self, option: str, / + ) -> Callable[[_StaticValueConverterVar], _StaticValueConverterVar]: ... @overload - def add_value_converter_on_set_static(self, option: str, convert_to_type: type[Any], /, *, accept_none: bool = False) -> None: - ... + def add_value_converter_on_set_static( + self, option: str, convert_to_type: type[Any], /, *, accept_none: bool = False + ) -> None: ... @overload - def add_value_converter_on_set_static(self, option: str, func: _StaticValueConverter, /) -> None: - ... + def add_value_converter_on_set_static(self, option: str, func: _StaticValueConverter, /) -> None: ... def add_value_converter_on_set_static( self, @@ -1867,12 +1792,10 @@ def add_enum_converter( @overload def value_comparator( self, option: str, /, *, use_override: bool = True - ) -> Callable[[_ValueComparatorVar], _ValueComparatorVar]: - ... + ) -> Callable[[_ValueComparatorVar], _ValueComparatorVar]: ... @overload - def value_comparator(self, option: str, func: _ValueComparator, /, *, use_override: bool = True) -> None: - ... + def value_comparator(self, option: str, func: _ValueComparator, /, *, use_override: bool = True) -> None: ... def value_comparator( self, @@ -1897,12 +1820,10 @@ def decorator(option: str, func: _ValueComparator, /) -> None: return None @overload - def value_comparator_static(self, option: str, /) -> Callable[[_StaticValueComparatorVar], _StaticValueComparatorVar]: - ... + def value_comparator_static(self, option: str, /) -> Callable[[_StaticValueComparatorVar], _StaticValueComparatorVar]: ... @overload - def value_comparator_static(self, option: str, func: _StaticValueComparator, /) -> None: - ... + def value_comparator_static(self, option: str, func: _StaticValueComparator, /) -> None: ... def value_comparator_static( self, @@ -2098,12 +2019,10 @@ def __set_name__(self, owner: type, name: str, /) -> None: self.__config_name: str = config.name @overload - def __get__(self, obj: None, objtype: type, /) -> OptionAttribute[_T]: - ... + def __get__(self, obj: None, objtype: type, /) -> OptionAttribute[_T]: ... @overload - def __get__(self, obj: object, objtype: type | None = None, /) -> _T: - ... + def __get__(self, obj: object, objtype: type | None = None, /) -> _T: ... def __get__(self, obj: object, objtype: type | None = None, /) -> _T | OptionAttribute[_T]: if obj is None: @@ -2180,12 +2099,10 @@ def __set_name__(self, owner: type, name: str, /) -> None: self.__config_name: str = config.name @overload - def __get__(self, obj: None, objtype: type | None = ..., /) -> SectionProperty[_T]: - ... + def __get__(self, obj: None, objtype: type | None = ..., /) -> SectionProperty[_T]: ... @overload - def __get__(self, obj: object, objtype: type | None = ..., /) -> Configuration[_T]: - ... + def __get__(self, obj: object, objtype: type | None = ..., /) -> Configuration[_T]: ... def __get__(self, obj: object, objtype: type | None = None, /) -> SectionProperty[_T] | Configuration[_T]: if obj is None: @@ -2560,12 +2477,10 @@ def known_aliases(self) -> frozenset[str]: return frozenset(self.__info.aliases) @overload - def get(self, option: str) -> Any: - ... + def get(self, option: str) -> Any: ... @overload - def get(self, option: str, default: _DT) -> Any | _DT: - ... + def get(self, option: str, default: _DT) -> Any | _DT: ... def get(self, option: str, default: Any = _NO_DEFAULT) -> Any: obj: _T = self.__self__ @@ -3917,14 +3832,11 @@ def __wrapped__(self) -> Callable[..., Any]: class _ConfigProperty(property): if TYPE_CHECKING: - def getter(self, __fget: Callable[[Any], Any]) -> _ConfigProperty: - ... + def getter(self, __fget: Callable[[Any], Any]) -> _ConfigProperty: ... - def setter(self, __fset: Callable[[Any, Any], None]) -> _ConfigProperty: - ... + def setter(self, __fset: Callable[[Any, Any], None]) -> _ConfigProperty: ... - def deleter(self, __fdel: Callable[[Any], None]) -> _ConfigProperty: - ... + def deleter(self, __fdel: Callable[[Any], None]) -> _ConfigProperty: ... def __eq__(self, __o: object) -> bool: if not isinstance(__o, _ConfigProperty): diff --git a/src/pydiamond/system/non_copyable.py b/src/pydiamond/system/non_copyable.py index 75d26b88..61c3738a 100644 --- a/src/pydiamond/system/non_copyable.py +++ b/src/pydiamond/system/non_copyable.py @@ -76,17 +76,13 @@ class NonCopyable(Object, metaclass=NonCopyableMeta): if TYPE_CHECKING: @final - def __copy__(self) -> NoReturn: - ... + def __copy__(self) -> NoReturn: ... @final - def __deepcopy__(self, memo: dict[str, Any]) -> NoReturn: - ... + def __deepcopy__(self, memo: dict[str, Any]) -> NoReturn: ... @final - def __reduce_ex__(self, __protocol: Any) -> str | tuple[Any, ...]: - ... + def __reduce_ex__(self, __protocol: Any) -> str | tuple[Any, ...]: ... @final - def __reduce__(self) -> str | tuple[Any, ...]: - ... + def __reduce__(self) -> str | tuple[Any, ...]: ... diff --git a/src/pydiamond/system/object.py b/src/pydiamond/system/object.py index c89b6537..bfbc6a1e 100644 --- a/src/pydiamond/system/object.py +++ b/src/pydiamond/system/object.py @@ -173,13 +173,11 @@ class Object(metaclass=ObjectMeta): @overload -def override(f: _T, /) -> _T: - ... +def override(f: _T, /) -> _T: ... @overload -def override(*, final: bool = False) -> Callable[[_T], _T]: - ... +def override(*, final: bool = False) -> Callable[[_T], _T]: ... def override(f: Any = ..., /, *, final: bool = False) -> Any: @@ -212,13 +210,11 @@ def decorator(f: Any) -> Any: @overload -def mro(*bases: type[_T], attr: str = "__mro__") -> tuple[type[_T], ...]: - ... +def mro(*bases: type[_T], attr: str = "__mro__") -> tuple[type[_T], ...]: ... @overload -def mro(*bases: _MetaClassT, attr: str = "__mro__") -> tuple[_MetaClassT, ...]: - ... +def mro(*bases: _MetaClassT, attr: str = "__mro__") -> tuple[_MetaClassT, ...]: ... # Ref: https://code.activestate.com/recipes/577748-calculate-the-mro-of-a-class/ diff --git a/src/pydiamond/system/path.py b/src/pydiamond/system/path.py index 67652580..7394f8ee 100644 --- a/src/pydiamond/system/path.py +++ b/src/pydiamond/system/path.py @@ -45,18 +45,15 @@ def __set_path( @overload -def set_constant_directory(path: str, *paths: str, relative_to_cwd: bool = False) -> str: - ... +def set_constant_directory(path: str, *paths: str, relative_to_cwd: bool = False) -> str: ... @overload -def set_constant_directory(path: str, *paths: str, raise_error: bool, relative_to_cwd: bool = False) -> str: - ... +def set_constant_directory(path: str, *paths: str, raise_error: bool, relative_to_cwd: bool = False) -> str: ... @overload -def set_constant_directory(path: str, *paths: str, error_msg: str, relative_to_cwd: bool = False) -> str: - ... +def set_constant_directory(path: str, *paths: str, error_msg: str, relative_to_cwd: bool = False) -> str: ... def set_constant_directory(path: str, *paths: str, raise_error: bool = True, **kwargs: Any) -> str: @@ -67,18 +64,15 @@ def set_constant_directory(path: str, *paths: str, raise_error: bool = True, **k @overload -def set_constant_file(path: str, *paths: str, relative_to_cwd: bool = False) -> str: - ... +def set_constant_file(path: str, *paths: str, relative_to_cwd: bool = False) -> str: ... @overload -def set_constant_file(path: str, *paths: str, raise_error: bool, relative_to_cwd: bool = False) -> str: - ... +def set_constant_file(path: str, *paths: str, raise_error: bool, relative_to_cwd: bool = False) -> str: ... @overload -def set_constant_file(path: str, *paths: str, error_msg: str, relative_to_cwd: bool = False) -> str: - ... +def set_constant_file(path: str, *paths: str, error_msg: str, relative_to_cwd: bool = False) -> str: ... def set_constant_file(path: str, *paths: str, raise_error: bool = True, **kwargs: Any) -> str: diff --git a/src/pydiamond/system/proxy.py b/src/pydiamond/system/proxy.py index 8d8f0034..a64d4ba8 100644 --- a/src/pydiamond/system/proxy.py +++ b/src/pydiamond/system/proxy.py @@ -263,11 +263,9 @@ class CallableProxyType(ProxyType): if TYPE_CHECKING: - def __new__(cls, obj: Callable[..., Any], /, *args: Any, **kwargs: Any) -> Any: - ... + def __new__(cls, obj: Callable[..., Any], /, *args: Any, **kwargs: Any) -> Any: ... - def __init__(self, obj: Callable[..., Any], /) -> None: - ... + def __init__(self, obj: Callable[..., Any], /) -> None: ... def __call__(__self, /, *args: Any, **kwargs: Any) -> Any: obj: Callable[..., Any] = object.__getattribute__(__self, "_obj") diff --git a/src/pydiamond/system/theme.py b/src/pydiamond/system/theme.py index 9dc0682c..f5b4d25c 100644 --- a/src/pydiamond/system/theme.py +++ b/src/pydiamond/system/theme.py @@ -359,12 +359,10 @@ def __init__(self, max_size: int = 128) -> None: self.__lock: defaultdict[ThemedObjectMeta, RLock] = defaultdict(RLock) @overload - def __get__(self: __Self, obj: None, objtype: type, /) -> __Self: - ... + def __get__(self: __Self, obj: None, objtype: type, /) -> __Self: ... @overload - def __get__(self, obj: ThemedObjectMeta, objtype: type | None = None, /) -> tuple[ThemedObjectMeta, ...]: - ... + def __get__(self, obj: ThemedObjectMeta, objtype: type | None = None, /) -> tuple[ThemedObjectMeta, ...]: ... def __get__(self: __Self, obj: ThemedObjectMeta | None, objtype: type | None = None) -> __Self | tuple[ThemedObjectMeta, ...]: if obj is None: @@ -534,12 +532,10 @@ def __delattr__(self, name: str, /) -> None: return super().__delattr__(name) @overload - def set_theme(cls, name: str, options: dict[str, Any], *, update: bool = False, ignore_unusable: bool = False) -> None: - ... + def set_theme(cls, name: str, options: dict[str, Any], *, update: bool = False, ignore_unusable: bool = False) -> None: ... @overload - def set_theme(cls, name: str, options: None) -> None: - ... + def set_theme(cls, name: str, options: None) -> None: ... def set_theme(cls, name: str, options: dict[str, Any] | None, *, update: bool = False, ignore_unusable: bool = False) -> None: if cls.is_abstract_theme_class(): @@ -601,12 +597,10 @@ def set_theme(cls, name: str, options: dict[str, Any] | None, *, update: bool = theme_dict[name] = MappingProxyType(theme_dict[name] | options) @overload - def set_default_theme(cls, name: str, /, *names: str, update: bool = False) -> None: - ... + def set_default_theme(cls, name: str, /, *names: str, update: bool = False) -> None: ... @overload - def set_default_theme(cls, name: None, /) -> None: - ... + def set_default_theme(cls, name: None, /) -> None: ... def set_default_theme(cls, name: str | None, /, *names: str, update: bool = False) -> None: if cls.is_abstract_theme_class(): @@ -953,7 +947,7 @@ def __apply_theme_namespace_decorator(obj: Any) -> Any: @staticmethod def __theme_initializer_decorator( - func: Callable[[ClassWithThemeNamespaceMeta], None] + func: Callable[[ClassWithThemeNamespaceMeta], None], ) -> Callable[[ClassWithThemeNamespaceMeta], None]: @wraps(func) def wrapper(cls: ClassWithThemeNamespaceMeta, /) -> None: @@ -993,13 +987,11 @@ def closed_namespace(cls: _S) -> _S: @overload -def no_theme_decorator(func: _T) -> _T: - ... +def no_theme_decorator(func: _T) -> _T: ... @overload -def no_theme_decorator(*, permanent: bool = True) -> Callable[[_T], _T]: - ... +def no_theme_decorator(*, permanent: bool = True) -> Callable[[_T], _T]: ... def no_theme_decorator(func: Any = None, *, permanent: bool = True) -> Any: diff --git a/src/pydiamond/system/threading.py b/src/pydiamond/system/threading.py index 46a5aa5c..cc9f4806 100644 --- a/src/pydiamond/system/threading.py +++ b/src/pydiamond/system/threading.py @@ -63,8 +63,7 @@ def join(self, timeout: float | None = None, terminate_on_timeout: bool = False) @overload -def thread_factory(func: Callable[_P, Any], /) -> Callable[_P, Thread]: - ... +def thread_factory(func: Callable[_P, Any], /) -> Callable[_P, Thread]: ... @overload @@ -73,8 +72,7 @@ def thread_factory( daemon: bool | None = ..., auto_start: bool = ..., name: str | None = ..., -) -> Callable[[Callable[_P, Any]], Callable[_P, Thread]]: - ... +) -> Callable[[Callable[_P, Any]], Callable[_P, Thread]]: ... @overload @@ -85,8 +83,7 @@ def thread_factory( auto_start: bool = ..., name: str | None = ..., **thread_cls_kwargs: Any, -) -> Callable[[Callable[_P, Any]], Callable[_P, _ThreadT]]: - ... +) -> Callable[[Callable[_P, Any]], Callable[_P, _ThreadT]]: ... def thread_factory( @@ -122,8 +119,7 @@ def wrapper(*args: Any, **kwargs: Any) -> Thread: @overload -def thread_factory_method(func: Callable[Concatenate[_T, _P], _R], /) -> _ThreadFactoryMethod[_T, _P, _R, Thread]: - ... +def thread_factory_method(func: Callable[Concatenate[_T, _P], _R], /) -> _ThreadFactoryMethod[_T, _P, _R, Thread]: ... @overload @@ -134,8 +130,7 @@ def thread_factory_method( name: str | None = ..., global_lock: bool = ..., shared_lock: bool = ..., -) -> Callable[[Callable[Concatenate[_T, _P], _R]], _ThreadFactoryMethod[_T, _P, _R, Thread]]: - ... +) -> Callable[[Callable[Concatenate[_T, _P], _R]], _ThreadFactoryMethod[_T, _P, _R, Thread]]: ... @overload @@ -146,8 +141,7 @@ def thread_factory_method( name: str | None = ..., global_lock: bool = ..., shared_lock: Callable[[_T], threading.RLock], -) -> Callable[[Callable[Concatenate[_T, _P], _R]], _ThreadFactoryMethod[_T, _P, _R, Thread]]: - ... +) -> Callable[[Callable[Concatenate[_T, _P], _R]], _ThreadFactoryMethod[_T, _P, _R, Thread]]: ... @overload @@ -160,8 +154,7 @@ def thread_factory_method( global_lock: bool = ..., shared_lock: bool = ..., **thread_cls_kwargs: Any, -) -> Callable[[Callable[Concatenate[_T, _P], _R]], _ThreadFactoryMethod[_T, _P, _R, _ThreadT]]: - ... +) -> Callable[[Callable[Concatenate[_T, _P], _R]], _ThreadFactoryMethod[_T, _P, _R, _ThreadT]]: ... @overload @@ -174,8 +167,7 @@ def thread_factory_method( global_lock: bool = ..., shared_lock: Callable[[_T], threading.RLock], **thread_cls_kwargs: Any, -) -> Callable[[Callable[Concatenate[_T, _P], _R]], _ThreadFactoryMethod[_T, _P, _R, _ThreadT]]: - ... +) -> Callable[[Callable[Concatenate[_T, _P], _R]], _ThreadFactoryMethod[_T, _P, _R, _ThreadT]]: ... def thread_factory_method( @@ -198,11 +190,9 @@ def decorator(func: Callable[..., Any]) -> _ThreadFactoryMethod[Any, ..., Any, T @type_check_only class _ThreadMethodType(Generic[_P, _ThreadT]): @staticmethod - def __call__(*args: _P.args, **kwds: _P.kwargs) -> _ThreadT: - ... + def __call__(*args: _P.args, **kwds: _P.kwargs) -> _ThreadT: ... - def get_lock(self) -> threading.RLock: - ... + def get_lock(self) -> threading.RLock: ... class _ThreadFactoryMethod(Generic[_T, _P, _R, _ThreadT]): @@ -242,12 +232,10 @@ def __call__(__self, self: _T, *args: _P.args, **kwargs: _P.kwargs) -> _ThreadT: return func(*args, **kwargs) @overload - def __get__(self: __Self, obj: None, objtype: type, /) -> __Self: - ... + def __get__(self: __Self, obj: None, objtype: type, /) -> __Self: ... @overload - def __get__(self, obj: _T, objtype: type | None = None, /) -> _ThreadMethodType[_P, _ThreadT]: - ... + def __get__(self, obj: _T, objtype: type | None = None, /) -> _ThreadMethodType[_P, _ThreadT]: ... def __get__(self: __Self, obj: _T | None, objtype: type | None = None, /) -> __Self | _ThreadMethodType[_P, _ThreadT]: if obj is None: diff --git a/src/pydiamond/system/utils/_mangling.py b/src/pydiamond/system/utils/_mangling.py index 39075bee..d176fd29 100644 --- a/src/pydiamond/system/utils/_mangling.py +++ b/src/pydiamond/system/utils/_mangling.py @@ -45,13 +45,11 @@ def hasattr_pv(obj: object, name: str, *, owner: type | None = None) -> bool: @overload -def getattr_pv(obj: object, name: str, *, owner: type | None = None) -> Any: - ... +def getattr_pv(obj: object, name: str, *, owner: type | None = None) -> Any: ... @overload -def getattr_pv(obj: object, name: str, default: _T, *, owner: type | None = None) -> Any | _T: - ... +def getattr_pv(obj: object, name: str, default: _T, *, owner: type | None = None) -> Any | _T: ... def getattr_pv(obj: object, name: str, default: Any = _NO_DEFAULT, *, owner: type | None = None) -> Any: diff --git a/src/pydiamond/system/utils/enum.py b/src/pydiamond/system/utils/enum.py index 7b75652e..cb355fc2 100644 --- a/src/pydiamond/system/utils/enum.py +++ b/src/pydiamond/system/utils/enum.py @@ -21,12 +21,10 @@ class StrEnum(str, enum.Enum): if TYPE_CHECKING: - def __new__(cls: type[Self], value: str | Self) -> Self: - ... + def __new__(cls: type[Self], value: str | Self) -> Self: ... @property - def value(self) -> str: - ... + def value(self) -> str: ... else: from enum import StrEnum diff --git a/src/pydiamond/system/utils/functools.py b/src/pydiamond/system/utils/functools.py index 5d519be4..fa476ee0 100644 --- a/src/pydiamond/system/utils/functools.py +++ b/src/pydiamond/system/utils/functools.py @@ -40,33 +40,25 @@ class _lru_cache_wrapper(Generic[_P, _R]): __wrapped__: Callable[_P, _R] @staticmethod - def __call__(*args: _P.args, **kwds: _P.kwargs) -> _R: - ... + def __call__(*args: _P.args, **kwds: _P.kwargs) -> _R: ... - def cache_info(self) -> _CacheInfo: - ... + def cache_info(self) -> _CacheInfo: ... - def cache_clear(self) -> None: - ... + def cache_clear(self) -> None: ... - def cache_parameters(self) -> _CacheParameters: - ... + def cache_parameters(self) -> _CacheParameters: ... - def __copy__(self) -> _lru_cache_wrapper[_P, _R]: - ... + def __copy__(self) -> _lru_cache_wrapper[_P, _R]: ... - def __deepcopy__(self, __memo: Any, /) -> _lru_cache_wrapper[_P, _R]: - ... + def __deepcopy__(self, __memo: Any, /) -> _lru_cache_wrapper[_P, _R]: ... @overload -def lru_cache(func: Callable[_P, _R], /) -> Callable[_P, _R]: - ... +def lru_cache(func: Callable[_P, _R], /) -> Callable[_P, _R]: ... @overload -def lru_cache(*, maxsize: int | None = 128, typed: bool = False) -> Callable[[Callable[_P, _R]], Callable[_P, _R]]: - ... +def lru_cache(*, maxsize: int | None = 128, typed: bool = False) -> Callable[[Callable[_P, _R]], Callable[_P, _R]]: ... def lru_cache(func: Callable[..., Any] | None = None, /, *, maxsize: int | None = 128, typed: bool = False) -> Callable[..., Any]: @@ -81,13 +73,11 @@ def cache(func: Callable[_P, _R], /) -> Callable[_P, _R]: @overload -def tp_cache(func: Callable[_P, _R], /) -> Callable[_P, _R]: - ... +def tp_cache(func: Callable[_P, _R], /) -> Callable[_P, _R]: ... @overload -def tp_cache(*, maxsize: int | None = 128, typed: bool = False) -> Callable[[Callable[_P, _R]], Callable[_P, _R]]: - ... +def tp_cache(*, maxsize: int | None = 128, typed: bool = False) -> Callable[[Callable[_P, _R]], Callable[_P, _R]]: ... def tp_cache(func: Callable[..., Any] | None = None, /, *, maxsize: int | None = 128, typed: bool = False) -> Callable[..., Any]: @@ -162,8 +152,7 @@ def make_callback( # type: ignore[misc] /, weakref_callback: Callable[[weakref[Any]], Any] | None = ..., deadref_value_return: Any = ..., -) -> Callable[_P, _R]: - ... +) -> Callable[_P, _R]: ... @overload @@ -173,8 +162,7 @@ def make_callback( /, weakref_callback: Callable[[weakref[_T]], Any] | None = ..., deadref_value_return: _R = ..., -) -> Callable[_P, _R]: - ... +) -> Callable[_P, _R]: ... @overload @@ -184,8 +172,7 @@ def make_callback( /, weakref_callback: Callable[[weakref[_T]], Any] | None = ..., deadref_value_return: type[BaseException] = ..., -) -> Callable[_P, _R]: - ... +) -> Callable[_P, _R]: ... def make_callback( diff --git a/src/pydiamond/system/utils/itertools.py b/src/pydiamond/system/utils/itertools.py index 5576aa6a..0fba7a5d 100644 --- a/src/pydiamond/system/utils/itertools.py +++ b/src/pydiamond/system/utils/itertools.py @@ -40,13 +40,11 @@ def __init__(self, *args: object) -> None: @overload -def next_return(__gen: Generator[Any, None, _V_co], /) -> _V_co: - ... +def next_return(__gen: Generator[Any, None, _V_co], /) -> _V_co: ... @overload -def next_return(__gen: Generator[Any, None, _V_co], __default: _T, /) -> _V_co | _T: - ... +def next_return(__gen: Generator[Any, None, _V_co], __default: _T, /) -> _V_co | _T: ... def next_return(gen: Generator[Any, None, Any], default: Any = _NO_DEFAULT, /) -> Any: @@ -76,28 +74,23 @@ def send_return(gen: Generator[Any, _T_contra, _V_co], value: _T_contra, /) -> _ @overload -def flatten(iterable: Iterable[Iterable[_T]], *, level: Literal[1] = ...) -> Iterator[_T]: - ... +def flatten(iterable: Iterable[Iterable[_T]], *, level: Literal[1] = ...) -> Iterator[_T]: ... @overload -def flatten(iterable: Iterable[Iterable[Iterable[_T]]], *, level: Literal[2]) -> Iterator[_T]: - ... +def flatten(iterable: Iterable[Iterable[Iterable[_T]]], *, level: Literal[2]) -> Iterator[_T]: ... @overload -def flatten(iterable: Iterable[Iterable[Iterable[Iterable[_T]]]], *, level: Literal[3]) -> Iterator[_T]: - ... +def flatten(iterable: Iterable[Iterable[Iterable[Iterable[_T]]]], *, level: Literal[3]) -> Iterator[_T]: ... @overload -def flatten(iterable: Iterable[Iterable[Iterable[Iterable[Iterable[_T]]]]], *, level: Literal[4]) -> Iterator[_T]: - ... +def flatten(iterable: Iterable[Iterable[Iterable[Iterable[Iterable[_T]]]]], *, level: Literal[4]) -> Iterator[_T]: ... @overload -def flatten(iterable: Iterable[Any], *, level: int) -> Iterator[Any]: - ... +def flatten(iterable: Iterable[Any], *, level: int) -> Iterator[Any]: ... def flatten(iterable: Any, *, level: int = 1) -> Iterator[Any]: diff --git a/src/pydiamond/system/utils/os.py b/src/pydiamond/system/utils/os.py index eae3d0ee..621673e0 100644 --- a/src/pydiamond/system/utils/os.py +++ b/src/pydiamond/system/utils/os.py @@ -34,8 +34,7 @@ def register_at_fork_if_supported( before: Callable[[], Any], after_in_parent: Callable[[], Any] = ..., after_in_child: Callable[[], Any] = ..., -) -> None: - ... +) -> None: ... @overload @@ -44,8 +43,7 @@ def register_at_fork_if_supported( after_in_parent: Callable[[], Any], before: Callable[[], Any] = ..., after_in_child: Callable[[], Any] = ..., -) -> None: - ... +) -> None: ... @overload @@ -54,8 +52,7 @@ def register_at_fork_if_supported( after_in_child: Callable[[], Any], before: Callable[[], Any] = ..., after_in_parent: Callable[[], Any] = ..., -) -> None: - ... +) -> None: ... def register_at_fork_if_supported( diff --git a/src/pydiamond/system/utils/weakref.py b/src/pydiamond/system/utils/weakref.py index ff84060f..c7f04731 100644 --- a/src/pydiamond/system/utils/weakref.py +++ b/src/pydiamond/system/utils/weakref.py @@ -16,13 +16,11 @@ @overload -def weakref_unwrap(ref: ReferenceType[_T]) -> _T: - ... +def weakref_unwrap(ref: ReferenceType[_T]) -> _T: ... @overload -def weakref_unwrap(ref: WeakMethod[_Func]) -> _Func: - ... +def weakref_unwrap(ref: WeakMethod[_Func]) -> _Func: ... def weakref_unwrap(ref: Callable[[], _T | None]) -> _T: diff --git a/src/pydiamond/system/validation.py b/src/pydiamond/system/validation.py index 4c2580f6..223b183d 100644 --- a/src/pydiamond/system/validation.py +++ b/src/pydiamond/system/validation.py @@ -24,33 +24,27 @@ @overload -def valid_integer(*, min_value: int) -> Callable[[Any], int]: - ... +def valid_integer(*, min_value: int) -> Callable[[Any], int]: ... @overload -def valid_integer(*, max_value: int) -> Callable[[Any], int]: - ... +def valid_integer(*, max_value: int) -> Callable[[Any], int]: ... @overload -def valid_integer(*, min_value: int, max_value: int) -> Callable[[Any], int]: - ... +def valid_integer(*, min_value: int, max_value: int) -> Callable[[Any], int]: ... @overload -def valid_integer(*, value: Any, min_value: int) -> int: - ... +def valid_integer(*, value: Any, min_value: int) -> int: ... @overload -def valid_integer(*, value: Any, max_value: int) -> int: - ... +def valid_integer(*, value: Any, max_value: int) -> int: ... @overload -def valid_integer(*, value: Any, min_value: int, max_value: int) -> int: - ... +def valid_integer(*, value: Any, min_value: int, max_value: int) -> int: ... def valid_integer(**kwargs: Any) -> int | Callable[[Any], int]: @@ -62,33 +56,27 @@ def valid_integer(**kwargs: Any) -> int | Callable[[Any], int]: @overload -def valid_optional_integer(*, min_value: int) -> Callable[[Any], int | None]: - ... +def valid_optional_integer(*, min_value: int) -> Callable[[Any], int | None]: ... @overload -def valid_optional_integer(*, max_value: int) -> Callable[[Any], int | None]: - ... +def valid_optional_integer(*, max_value: int) -> Callable[[Any], int | None]: ... @overload -def valid_optional_integer(*, min_value: int, max_value: int) -> Callable[[Any], int | None]: - ... +def valid_optional_integer(*, min_value: int, max_value: int) -> Callable[[Any], int | None]: ... @overload -def valid_optional_integer(*, value: Any, min_value: int) -> int | None: - ... +def valid_optional_integer(*, value: Any, min_value: int) -> int | None: ... @overload -def valid_optional_integer(*, value: Any, max_value: int) -> int | None: - ... +def valid_optional_integer(*, value: Any, max_value: int) -> int | None: ... @overload -def valid_optional_integer(*, value: Any, min_value: int, max_value: int) -> int | None: - ... +def valid_optional_integer(*, value: Any, min_value: int, max_value: int) -> int | None: ... def valid_optional_integer(**kwargs: Any) -> int | None | Callable[[Any], int | None]: @@ -100,33 +88,27 @@ def valid_optional_integer(**kwargs: Any) -> int | None | Callable[[Any], int | @overload -def valid_float(*, min_value: float) -> Callable[[Any], float]: - ... +def valid_float(*, min_value: float) -> Callable[[Any], float]: ... @overload -def valid_float(*, max_value: float) -> Callable[[Any], float]: - ... +def valid_float(*, max_value: float) -> Callable[[Any], float]: ... @overload -def valid_float(*, min_value: float, max_value: float) -> Callable[[Any], float]: - ... +def valid_float(*, min_value: float, max_value: float) -> Callable[[Any], float]: ... @overload -def valid_float(*, value: Any, min_value: float) -> float: - ... +def valid_float(*, value: Any, min_value: float) -> float: ... @overload -def valid_float(*, value: Any, max_value: float) -> float: - ... +def valid_float(*, value: Any, max_value: float) -> float: ... @overload -def valid_float(*, value: Any, min_value: float, max_value: float) -> float: - ... +def valid_float(*, value: Any, min_value: float, max_value: float) -> float: ... def valid_float(**kwargs: Any) -> float | Callable[[Any], float]: @@ -138,33 +120,27 @@ def valid_float(**kwargs: Any) -> float | Callable[[Any], float]: @overload -def valid_optional_float(*, min_value: float) -> Callable[[Any], float | None]: - ... +def valid_optional_float(*, min_value: float) -> Callable[[Any], float | None]: ... @overload -def valid_optional_float(*, max_value: float) -> Callable[[Any], float | None]: - ... +def valid_optional_float(*, max_value: float) -> Callable[[Any], float | None]: ... @overload -def valid_optional_float(*, min_value: float, max_value: float) -> Callable[[Any], float | None]: - ... +def valid_optional_float(*, min_value: float, max_value: float) -> Callable[[Any], float | None]: ... @overload -def valid_optional_float(*, value: Any, min_value: float) -> float | None: - ... +def valid_optional_float(*, value: Any, min_value: float) -> float | None: ... @overload -def valid_optional_float(*, value: Any, max_value: float) -> float | None: - ... +def valid_optional_float(*, value: Any, max_value: float) -> float | None: ... @overload -def valid_optional_float(*, value: Any, min_value: float, max_value: float) -> float | None: - ... +def valid_optional_float(*, value: Any, min_value: float, max_value: float) -> float | None: ... def valid_optional_float(**kwargs: Any) -> float | None | Callable[[Any], float | None]: @@ -244,23 +220,19 @@ def valid_number(val: Any) -> _Number | None: @overload -def valid_sequence(*, length: int = ...) -> Callable[[Any], Sequence[Any]]: - ... +def valid_sequence(*, length: int = ...) -> Callable[[Any], Sequence[Any]]: ... @overload -def valid_sequence(*, validator: Callable[[Any], _T], length: int = ...) -> Callable[[Any], Sequence[_T]]: - ... +def valid_sequence(*, validator: Callable[[Any], _T], length: int = ...) -> Callable[[Any], Sequence[_T]]: ... @overload -def valid_sequence(*, value: Any, length: int = ...) -> Sequence[Any]: - ... +def valid_sequence(*, value: Any, length: int = ...) -> Sequence[Any]: ... @overload -def valid_sequence(*, value: Any, validator: Callable[[Any], _T], length: int = ...) -> Sequence[_T]: - ... +def valid_sequence(*, value: Any, validator: Callable[[Any], _T], length: int = ...) -> Sequence[_T]: ... def valid_sequence(*, value: Any = _MISSING, validator: Callable[[Any], Any] | None = None, length: int = -1) -> Any: diff --git a/src/pydiamond/window/controller.py b/src/pydiamond/window/controller.py index 4ad55c19..3e31ead2 100644 --- a/src/pydiamond/window/controller.py +++ b/src/pydiamond/window/controller.py @@ -132,16 +132,13 @@ def popitem(self) -> NoReturn: raise KeyError("Cannot be deleted") @overload - def update(self, __m: SupportsKeysAndGetItem[str, str], /, **kwargs: str) -> None: - ... + def update(self, __m: SupportsKeysAndGetItem[str, str], /, **kwargs: str) -> None: ... @overload - def update(self, __m: Iterable[tuple[str, str]], /, **kwargs: str) -> None: - ... + def update(self, __m: Iterable[tuple[str, str]], /, **kwargs: str) -> None: ... @overload - def update(self, /, **kwargs: str) -> None: - ... + def update(self, /, **kwargs: str) -> None: ... def update(self, other: Any = (), /, **kwargs: Any) -> None: mapping = self.__controller.get_mapping() diff --git a/src/pydiamond/window/cursor.py b/src/pydiamond/window/cursor.py index 7cd998b7..729117e6 100644 --- a/src/pydiamond/window/cursor.py +++ b/src/pydiamond/window/cursor.py @@ -39,20 +39,16 @@ def __new__(cls, *args: Any) -> Cursor: @overload def __init__( self, size: tuple[int, int], hotspot: tuple[int, int], xormasks: Sequence[int], andmasks: Sequence[int], / - ) -> None: - ... + ) -> None: ... @overload - def __init__(self, hotspot: tuple[int, int], surface: Surface, /) -> None: - ... + def __init__(self, hotspot: tuple[int, int], surface: Surface, /) -> None: ... @overload - def __init__(self, cursor: _pg_cursors.Cursor, /) -> None: - ... + def __init__(self, cursor: _pg_cursors.Cursor, /) -> None: ... @overload - def __init__(self, system_cursor_constant: int, /) -> None: - ... + def __init__(self, system_cursor_constant: int, /) -> None: ... def __init__(self, *args: Any) -> None: try: @@ -112,8 +108,7 @@ def __new__(cls, value: int | SystemCursor) -> SystemCursor: if TYPE_CHECKING: - def __init__(self, value: int | SystemCursor) -> None: - ... + def __init__(self, value: int | SystemCursor) -> None: ... ARROW = auto() IBEAM = auto() @@ -131,8 +126,7 @@ def __init__(self, value: int | SystemCursor) -> None: if TYPE_CHECKING: @property - def value(self) -> int: - ... + def value(self) -> int: ... del _pg_constants diff --git a/src/pydiamond/window/display.py b/src/pydiamond/window/display.py index 5c9576f7..59114d2a 100644 --- a/src/pydiamond/window/display.py +++ b/src/pydiamond/window/display.py @@ -764,12 +764,10 @@ def set_blocked_events() -> None: @overload def after( self, __milliseconds: float, __callback: Callable[_P, None], /, *args: _P.args, **kwargs: _P.kwargs - ) -> WindowCallback: - ... + ) -> WindowCallback: ... @overload - def after(self, __milliseconds: float, /) -> Callable[[Callable[[], None]], WindowCallback]: - ... + def after(self, __milliseconds: float, /) -> Callable[[Callable[[], None]], WindowCallback]: ... def after( self, __milliseconds: float, __callback: Callable[..., None] | None = None, /, *args: Any, **kwargs: Any @@ -786,18 +784,15 @@ def decorator(__callback: Callable[..., None], /) -> WindowCallback: @overload def every( self, __milliseconds: float, __callback: Callable[_P, None], /, *args: _P.args, **kwargs: _P.kwargs - ) -> WindowCallback: - ... + ) -> WindowCallback: ... @overload def every( self, __milliseconds: float, __callback: Callable[_P, Iterator[None]], /, *args: _P.args, **kwargs: _P.kwargs - ) -> WindowCallback: - ... + ) -> WindowCallback: ... @overload - def every(self, __milliseconds: float, /) -> Callable[[Callable[[], Iterator[None] | None]], WindowCallback]: - ... + def every(self, __milliseconds: float, /) -> Callable[[Callable[[], Iterator[None] | None]], WindowCallback]: ... def every( self, __milliseconds: float, __callback: Callable[..., Any] | None = None, /, *args: Any, **kwargs: Any diff --git a/src/pydiamond/window/event.py b/src/pydiamond/window/event.py index ab9d11df..8b702f36 100644 --- a/src/pydiamond/window/event.py +++ b/src/pydiamond/window/event.py @@ -1023,13 +1023,11 @@ def __bind( handler_dict: dict[type[Event], OrderedSet[_EventCallback]], key: type[Event], callback: Callable[[_TE], bool], - ) -> None: - ... + ) -> None: ... @overload @staticmethod - def __bind(handler_dict: dict[_T, OrderedSet[_EventCallback]], key: _T, callback: Callable[[_TE], bool]) -> None: - ... + def __bind(handler_dict: dict[_T, OrderedSet[_EventCallback]], key: _T, callback: Callable[[_TE], bool]) -> None: ... @staticmethod def __bind(handler_dict: dict[_T, OrderedSet[_EventCallback]], key: _T, callback: Callable[[_TE], bool]) -> None: @@ -1045,13 +1043,11 @@ def __unbind( handler_dict: dict[type[Event], OrderedSet[_EventCallback]], key: type[Event], callback: Callable[[_TE], bool], - ) -> None: - ... + ) -> None: ... @overload @staticmethod - def __unbind(handler_dict: dict[_T, OrderedSet[_EventCallback]], key: _T, callback: Callable[[_TE], bool]) -> None: - ... + def __unbind(handler_dict: dict[_T, OrderedSet[_EventCallback]], key: _T, callback: Callable[[_TE], bool]) -> None: ... @staticmethod def __unbind(handler_dict: dict[_T, OrderedSet[_EventCallback]], key: _T, callback: Callable[[_TE], bool]) -> None: @@ -1074,16 +1070,14 @@ def bind( self, event_cls: type[_TE], callback: Callable[[_TE], bool] | weakref.WeakMethod[Callable[[_TE], bool]], - ) -> None: - ... + ) -> None: ... @overload def bind( self, event_cls: None, callback: Callable[[Event], bool] | weakref.WeakMethod[Callable[[Event], bool]], - ) -> None: - ... + ) -> None: ... def bind( # type: ignore[misc] self, @@ -1131,16 +1125,14 @@ def unbind( self, event_cls: type[_TE], callback_to_remove: Callable[[_TE], bool] | weakref.WeakMethod[Callable[[_TE], bool]], - ) -> None: - ... + ) -> None: ... @overload def unbind( self, event_cls: None, callback_to_remove: Callable[[Event], bool] | weakref.WeakMethod[Callable[[Event], bool]], - ) -> None: - ... + ) -> None: ... def unbind( self, @@ -1173,16 +1165,14 @@ def bind_all( self, event_cls: type[_TE], sequence: Iterable[Callable[[_TE], bool] | weakref.WeakMethod[Callable[[_TE], bool]]], - ) -> None: - ... + ) -> None: ... @overload def bind_all( self, event_cls: None, sequence: Iterable[Callable[[Event], bool] | weakref.WeakMethod[Callable[[Event], bool]]], - ) -> None: - ... + ) -> None: ... def bind_all( # type: ignore[misc] self, @@ -1198,16 +1188,14 @@ def unbind_all( self, event_cls: type[_TE], sequence: Iterable[Callable[[_TE], bool] | weakref.WeakMethod[Callable[[_TE], bool]]], - ) -> None: - ... + ) -> None: ... @overload def unbind_all( self, event_cls: None, sequence: Iterable[Callable[[Event], bool] | weakref.WeakMethod[Callable[[Event], bool]]], - ) -> None: - ... + ) -> None: ... def unbind_all( # type: ignore[misc] self, @@ -1219,12 +1207,10 @@ def unbind_all( # type: ignore[misc] unbind(event_cls, callback) @overload - def bind_key(self, key: int, callback: Callable[[KeyEvent], Any]) -> None: - ... + def bind_key(self, key: int, callback: Callable[[KeyEvent], Any]) -> None: ... @overload - def bind_key(self, key: int, callback: weakref.WeakMethod[Callable[[KeyEvent], Any]]) -> None: - ... + def bind_key(self, key: int, callback: weakref.WeakMethod[Callable[[KeyEvent], Any]]) -> None: ... def bind_key(self, key: int, callback: Callable[..., Any]) -> None: self.bind_key_press(key, callback) @@ -1297,12 +1283,10 @@ def unbind_key_release(self, key: int) -> None: self.__weak_key_release_callbacks.clear() @overload - def bind_mouse_button(self, button: int, callback: Callable[[MouseButtonEvent], Any]) -> None: - ... + def bind_mouse_button(self, button: int, callback: Callable[[MouseButtonEvent], Any]) -> None: ... @overload - def bind_mouse_button(self, button: int, callback: weakref.WeakMethod[Callable[[MouseButtonEvent], Any]]) -> None: - ... + def bind_mouse_button(self, button: int, callback: weakref.WeakMethod[Callable[[MouseButtonEvent], Any]]) -> None: ... def bind_mouse_button(self, button: int, callback: Callable[..., Any]) -> None: self.bind_mouse_button_press(button, callback) @@ -1407,12 +1391,10 @@ def unbind_mouse_position( mouse_pos_handler_list.remove(callback_to_remove) @overload - def weak_bind(self, event_cls: type[_TE], callback: Callable[[_T, _TE], bool], obj: _T) -> None: - ... + def weak_bind(self, event_cls: type[_TE], callback: Callable[[_T, _TE], bool], obj: _T) -> None: ... @overload - def weak_bind(self, event_cls: None, callback: Callable[[_T, Event], bool], obj: _T) -> None: - ... + def weak_bind(self, event_cls: None, callback: Callable[[_T, Event], bool], obj: _T) -> None: ... def weak_bind(self, event_cls: type[Event] | None, callback: Callable[[_T, Event], bool], obj: _T) -> None: # type: ignore[misc] def unbind(self: EventManager, callback: Callable[[Event], bool]) -> None: @@ -1430,23 +1412,19 @@ def unbind(self: EventManager, callback: Callable[[Event], bool]) -> None: ) @overload - def weak_unbind(self, event_cls: type[_TE], callback_to_remove: Callable[[_T, _TE], bool], obj: _T) -> None: - ... + def weak_unbind(self, event_cls: type[_TE], callback_to_remove: Callable[[_T, _TE], bool], obj: _T) -> None: ... @overload - def weak_unbind(self, event_cls: None, callback_to_remove: Callable[[_T, Event], bool], obj: _T) -> None: - ... + def weak_unbind(self, event_cls: None, callback_to_remove: Callable[[_T, Event], bool], obj: _T) -> None: ... def weak_unbind(self, event_cls: type[Event] | None, callback_to_remove: Callable[[_T, Event], bool], obj: _T) -> None: # type: ignore[misc] self.unbind(event_cls, self.__weak_event_callbacks[obj][event_cls].pop(callback_to_remove)) @overload - def weak_bind_all(self, event_cls: type[_TE], sequence: Iterable[Callable[[_T, _TE], bool]], obj: _T) -> None: - ... + def weak_bind_all(self, event_cls: type[_TE], sequence: Iterable[Callable[[_T, _TE], bool]], obj: _T) -> None: ... @overload - def weak_bind_all(self, event_cls: None, sequence: Iterable[Callable[[_T, Event], bool]], obj: _T) -> None: - ... + def weak_bind_all(self, event_cls: None, sequence: Iterable[Callable[[_T, Event], bool]], obj: _T) -> None: ... def weak_bind_all(self, event_cls: type[Event] | None, sequence: Iterable[Callable[[_T, Event], bool]], obj: _T) -> None: # type: ignore[misc] bind = self.weak_bind @@ -1454,12 +1432,10 @@ def weak_bind_all(self, event_cls: type[Event] | None, sequence: Iterable[Callab bind(event_cls, callback, obj) @overload - def weak_unbind_all(self, event_cls: type[_TE], sequence: Iterable[Callable[[_T, _TE], bool]], obj: _T) -> None: - ... + def weak_unbind_all(self, event_cls: type[_TE], sequence: Iterable[Callable[[_T, _TE], bool]], obj: _T) -> None: ... @overload - def weak_unbind_all(self, event_cls: None, sequence: Iterable[Callable[[_T, Event], bool]], obj: _T) -> None: - ... + def weak_unbind_all(self, event_cls: None, sequence: Iterable[Callable[[_T, Event], bool]], obj: _T) -> None: ... def weak_unbind_all(self, event_cls: type[Event] | None, sequence: Iterable[Callable[[_T, Event], bool]], obj: _T) -> None: # type: ignore[misc] unbind = self.weak_unbind @@ -1693,7 +1669,7 @@ def callback_wrapper(*args: _P.args, **kwargs: _P.kwargs) -> _U: @staticmethod def __get_weak_method_info( - weak_method: weakref.WeakMethod[Callable[_P, _U]] + weak_method: weakref.WeakMethod[Callable[_P, _U]], ) -> tuple[Callable[Concatenate[Any, _P], _U], Any]: method: Any = weakref_unwrap(weak_method) return method.__func__, method.__self__ @@ -1764,16 +1740,14 @@ def bind( self, event_cls: type[_TE], callback: Callable[[_T, _TE], bool] | weakref.WeakMethod[Callable[[_TE], bool]], - ) -> None: - ... + ) -> None: ... @overload def bind( self, event_cls: None, callback: Callable[[_T, Event], bool] | weakref.WeakMethod[Callable[[Event], bool]], - ) -> None: - ... + ) -> None: ... def bind( # type: ignore[misc] self, @@ -1791,16 +1765,14 @@ def unbind( self, event_cls: type[_TE], callback_to_remove: Callable[[_T, _TE], bool] | weakref.WeakMethod[Callable[[_TE], bool]], - ) -> None: - ... + ) -> None: ... @overload def unbind( self, event_cls: None, callback_to_remove: Callable[[_T, Event], bool] | weakref.WeakMethod[Callable[[Event], bool]], - ) -> None: - ... + ) -> None: ... def unbind( # type: ignore[misc] self, @@ -1818,16 +1790,14 @@ def bind_all( self, event_cls: type[_TE], sequence: Iterable[weakref.WeakMethod[Callable[[_TE], bool]] | Callable[[_T, _TE], bool]], - ) -> None: - ... + ) -> None: ... @overload def bind_all( self, event_cls: None, sequence: Iterable[weakref.WeakMethod[Callable[[Event], bool]] | Callable[[_T, Event], bool]], - ) -> None: - ... + ) -> None: ... def bind_all( # type: ignore[misc] self, @@ -1843,16 +1813,14 @@ def unbind_all( self, event_cls: type[_TE], sequence: Iterable[weakref.WeakMethod[Callable[[_TE], bool]] | Callable[[_T, _TE], bool]], - ) -> None: - ... + ) -> None: ... @overload def unbind_all( self, event_cls: None, sequence: Iterable[weakref.WeakMethod[Callable[[Event], bool]] | Callable[[_T, Event], bool]], - ) -> None: - ... + ) -> None: ... def unbind_all( # type: ignore[misc] self, @@ -1864,12 +1832,10 @@ def unbind_all( # type: ignore[misc] unbind(event_cls, callback) @overload - def bind_key(self, key: int, callback: Callable[[_T, KeyEvent], Any]) -> None: - ... + def bind_key(self, key: int, callback: Callable[[_T, KeyEvent], Any]) -> None: ... @overload - def bind_key(self, key: int, callback: weakref.WeakMethod[Callable[[KeyEvent], Any]]) -> None: - ... + def bind_key(self, key: int, callback: weakref.WeakMethod[Callable[[KeyEvent], Any]]) -> None: ... def bind_key(self, key: int, callback: Callable[..., Any]) -> None: self.bind_key_press(key, callback) @@ -1910,12 +1876,10 @@ def unbind_key_release(self, key: int) -> None: self.__weak_key_release_callbacks.clear() @overload - def bind_mouse_button(self, button: int, callback: Callable[[_T, MouseButtonEvent], Any]) -> None: - ... + def bind_mouse_button(self, button: int, callback: Callable[[_T, MouseButtonEvent], Any]) -> None: ... @overload - def bind_mouse_button(self, button: int, callback: weakref.WeakMethod[Callable[[MouseButtonEvent], Any]]) -> None: - ... + def bind_mouse_button(self, button: int, callback: weakref.WeakMethod[Callable[[MouseButtonEvent], Any]]) -> None: ... def bind_mouse_button(self, button: int, callback: Callable[..., Any]) -> None: self.bind_mouse_button_press(button, callback) @@ -1975,12 +1939,10 @@ def unbind_mouse_position( return self.__manager.weak_unbind_mouse_position(callback_to_remove, obj) @overload - def weak_bind(self, event_cls: type[_TE], callback: Callable[[_U, _T, _TE], bool], obj: _U) -> None: - ... + def weak_bind(self, event_cls: type[_TE], callback: Callable[[_U, _T, _TE], bool], obj: _U) -> None: ... @overload - def weak_bind(self, event_cls: None, callback: Callable[[_U, _T, Event], bool], obj: _U) -> None: - ... + def weak_bind(self, event_cls: None, callback: Callable[[_U, _T, Event], bool], obj: _U) -> None: ... def weak_bind(self, event_cls: type[Event] | None, callback: Callable[[_U, _T, Event], bool], obj: _U) -> None: # type: ignore[misc] def unbind(self: EventManager, callback: Callable[[Event], bool]) -> None: @@ -1998,23 +1960,19 @@ def unbind(self: EventManager, callback: Callable[[Event], bool]) -> None: ) @overload - def weak_unbind(self, event_cls: type[_TE], callback_to_remove: Callable[[_U, _T, _TE], bool], obj: _U) -> None: - ... + def weak_unbind(self, event_cls: type[_TE], callback_to_remove: Callable[[_U, _T, _TE], bool], obj: _U) -> None: ... @overload - def weak_unbind(self, event_cls: None, callback_to_remove: Callable[[_U, _T, Event], bool], obj: _U) -> None: - ... + def weak_unbind(self, event_cls: None, callback_to_remove: Callable[[_U, _T, Event], bool], obj: _U) -> None: ... def weak_unbind(self, event_cls: type[Event] | None, callback_to_remove: Callable[[_U, _T, Event], bool], obj: _U) -> None: # type: ignore[misc] self.__manager.unbind(event_cls, self.__weak_event_callbacks[obj][event_cls].pop(callback_to_remove)) @overload - def weak_bind_all(self, event_cls: type[_TE], sequence: Iterable[Callable[[_U, _T, _TE], bool]], obj: _U) -> None: - ... + def weak_bind_all(self, event_cls: type[_TE], sequence: Iterable[Callable[[_U, _T, _TE], bool]], obj: _U) -> None: ... @overload - def weak_bind_all(self, event_cls: None, sequence: Iterable[Callable[[_U, _T, Event], bool]], obj: _U) -> None: - ... + def weak_bind_all(self, event_cls: None, sequence: Iterable[Callable[[_U, _T, Event], bool]], obj: _U) -> None: ... def weak_bind_all(self, event_cls: type[Event] | None, sequence: Iterable[Callable[[_U, _T, Event], bool]], obj: _U) -> None: # type: ignore[misc] bind = self.weak_bind @@ -2022,12 +1980,10 @@ def weak_bind_all(self, event_cls: type[Event] | None, sequence: Iterable[Callab bind(event_cls, callback, obj) @overload - def weak_unbind_all(self, event_cls: type[_TE], sequence: Iterable[Callable[[_U, _T, _TE], bool]], obj: _U) -> None: - ... + def weak_unbind_all(self, event_cls: type[_TE], sequence: Iterable[Callable[[_U, _T, _TE], bool]], obj: _U) -> None: ... @overload - def weak_unbind_all(self, event_cls: None, sequence: Iterable[Callable[[_U, _T, Event], bool]], obj: _U) -> None: - ... + def weak_unbind_all(self, event_cls: None, sequence: Iterable[Callable[[_U, _T, Event], bool]], obj: _U) -> None: ... def weak_unbind_all(self, event_cls: type[Event] | None, sequence: Iterable[Callable[[_U, _T, Event], bool]], obj: _U) -> None: # type: ignore[misc] unbind = self.weak_unbind diff --git a/src/pydiamond/window/keyboard.py b/src/pydiamond/window/keyboard.py index 2cf3ee53..4914cad2 100644 --- a/src/pydiamond/window/keyboard.py +++ b/src/pydiamond/window/keyboard.py @@ -38,13 +38,11 @@ def get_repeat() -> tuple[int, int]: @overload @staticmethod - def set_repeat(delay: None) -> tuple[int, int]: - ... + def set_repeat(delay: None) -> tuple[int, int]: ... @overload @staticmethod - def set_repeat(delay: int, interval: int = 0) -> tuple[int, int]: - ... + def set_repeat(delay: int, interval: int = 0) -> tuple[int, int]: ... @staticmethod def set_repeat(delay: int | None, interval: int = 0) -> tuple[int, int]: