Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Mar 18, 2024
1 parent c4e453e commit 384cdbf
Show file tree
Hide file tree
Showing 44 changed files with 389 additions and 758 deletions.
9 changes: 3 additions & 6 deletions src/pydiamond/_patch/plugins/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
18 changes: 6 additions & 12 deletions src/pydiamond/audio/mixer.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ class Mixer(ClassNamespace, frozen=True):

@overload
@staticmethod
def pre_init() -> None:
...
def pre_init() -> None: ...

@overload
@staticmethod
Expand All @@ -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:
Expand All @@ -126,8 +124,7 @@ def pre_init(**kwargs: Any) -> None:

@overload
@staticmethod
def init() -> _GeneratorContextManager[MixerParams]:
...
def init() -> _GeneratorContextManager[MixerParams]: ...

@overload
@staticmethod
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand Down
24 changes: 8 additions & 16 deletions src/pydiamond/graphics/animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -243,8 +242,7 @@ def smooth_set_position(
bottom: float = ...,
centerx: float = ...,
centery: float = ...,
) -> __Self:
...
) -> __Self: ...

@overload
def smooth_set_position(
Expand All @@ -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)
Expand Down Expand Up @@ -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(
Expand All @@ -353,8 +349,7 @@ def smooth_set_position(
bottom: float = ...,
centerx: float = ...,
centery: float = ...,
) -> __Self:
...
) -> __Self: ...

@overload
def smooth_set_position(
Expand All @@ -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
Expand Down Expand Up @@ -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):
Expand Down
6 changes: 2 additions & 4 deletions src/pydiamond/graphics/drawable.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
6 changes: 2 additions & 4 deletions src/pydiamond/graphics/font.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,7 @@ def get_rect(
style: int = ...,
rotation: int = ...,
size: float = ...,
) -> Rect:
...
) -> Rect: ...

@overload
def get_rect(
Expand All @@ -270,8 +269,7 @@ def get_rect(
center: tuple[float, float] = ...,
centerx: float = ...,
centery: float = ...,
) -> Rect:
...
) -> Rect: ...

def get_rect(
self,
Expand Down
30 changes: 10 additions & 20 deletions src/pydiamond/graphics/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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:
Expand All @@ -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(
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 2 additions & 4 deletions src/pydiamond/graphics/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 10 additions & 20 deletions src/pydiamond/graphics/movable.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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]:
Expand All @@ -199,8 +196,7 @@ def set_position(
bottom: float = ...,
centerx: float = ...,
centery: float = ...,
) -> None:
...
) -> None: ...

@overload
def set_position(
Expand All @@ -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:
Expand Down Expand Up @@ -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(
Expand All @@ -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:
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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:
Expand Down
Loading

0 comments on commit 384cdbf

Please sign in to comment.