Skip to content

Commit ec32d8c

Browse files
committed
Update missing docs in tcod.event
1 parent 6df9334 commit ec32d8c

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

tcod/event.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ def integer_position(self) -> Point[int]:
425425

426426
@property
427427
@deprecated("The mouse.pixel attribute is deprecated. Use mouse.position instead.")
428-
def pixel(self) -> Point[float]:
428+
def pixel(self) -> Point[float]: # noqa: D102 # Skip docstring for deprecated attribute
429429
return self.position
430430

431431
@pixel.setter
@@ -483,7 +483,7 @@ def integer_motion(self) -> Point[int]:
483483

484484
@property
485485
@deprecated("The mouse.pixel_motion attribute is deprecated. Use mouse.motion instead.")
486-
def pixel_motion(self) -> Point[float]:
486+
def pixel_motion(self) -> Point[float]: # noqa: D102 # Skip docstring for deprecated attribute
487487
return self.motion
488488

489489
@pixel_motion.setter
@@ -739,6 +739,7 @@ class JoystickEvent(Event):
739739

740740
@property
741741
def joystick(self) -> tcod.sdl.joystick.Joystick:
742+
"""The :any:`Joystick` for this event."""
742743
if isinstance(self, JoystickDevice) and self.type == "JOYDEVICEADDED":
743744
return tcod.sdl.joystick.Joystick._open(self.which)
744745
return tcod.sdl.joystick.Joystick._from_instance_id(self.which)
@@ -2128,14 +2129,18 @@ def _missing_(cls, value: object) -> Scancode | None:
21282129
return result
21292130

21302131
def __eq__(self, other: object) -> bool:
2132+
"""Compare with another Scancode value.
2133+
2134+
Comparison between :any:`KeySym` and :any:`Scancode` is not allowed and will raise :any:`TypeError`.
2135+
"""
21312136
if isinstance(other, KeySym):
21322137
msg = "Scancode and KeySym enums can not be compared directly. Convert one or the other to the same type."
21332138
raise TypeError(msg)
21342139
return super().__eq__(other)
21352140

21362141
def __hash__(self) -> int:
2137-
# __eq__ was defined, so __hash__ must be defined.
2138-
return super().__hash__()
2142+
"""Return the hash for this value."""
2143+
return super().__hash__() # __eq__ was defined, so __hash__ must be defined
21392144

21402145
def __repr__(self) -> str:
21412146
"""Return the fully qualified name of this enum."""
@@ -2708,14 +2713,18 @@ def _missing_(cls, value: object) -> KeySym | None:
27082713
return result
27092714

27102715
def __eq__(self, other: object) -> bool:
2716+
"""Compare with another KeySym value.
2717+
2718+
Comparison between :any:`KeySym` and :any:`Scancode` is not allowed and will raise :any:`TypeError`.
2719+
"""
27112720
if isinstance(other, Scancode):
27122721
msg = "Scancode and KeySym enums can not be compared directly. Convert one or the other to the same type."
27132722
raise TypeError(msg)
27142723
return super().__eq__(other)
27152724

27162725
def __hash__(self) -> int:
2717-
# __eq__ was defined, so __hash__ must be defined.
2718-
return super().__hash__()
2726+
"""Return the hash for this value."""
2727+
return super().__hash__() # __eq__ was defined, so __hash__ must be defined
27192728

27202729
def __repr__(self) -> str:
27212730
"""Return the fully qualified name of this enum."""

0 commit comments

Comments
 (0)