Skip to content

Commit 599df86

Browse files
committed
Fix documentation
Attempt to make sentinel workarounds look as nice as possible
1 parent f2ee28b commit 599df86

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

docs/api.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ API reference
55
:members:
66
:undoc-members:
77
:show-inheritance:
8-
:exclude-members: Registry, World, Entity
8+
:exclude-members: Registry, World, Entity, IsA
99

1010
.. automodule:: tcod.ecs.registry
1111
:members:

tcod/ecs/constants.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
from __future__ import annotations
44

5+
from typing_extensions import Never
6+
57

68
class _IgnoreSetState(type):
79
def __setstate__(cls, _state: object) -> None:
@@ -11,9 +13,8 @@ def __setstate__(cls, _state: object) -> None:
1113
class IsA(metaclass=_IgnoreSetState):
1214
"""The default is-a relationship tag used for entity inheritance."""
1315

14-
def __new__(cls: type[IsA], *_args: object) -> type[IsA]: # type: ignore[misc]
15-
"""Return own type instead of instance, for outdated sentinel-value pickle data."""
16-
return cls
16+
def __new__(cls: type[IsA], *_: object) -> Never: # noqa: D102
17+
return cls # Return own type instead of instance, for outdated sentinel-value pickle data.
1718

1819

1920
_sentinel_IsA = IsA # Compatibility with sentinel-value, deprecated since 5.4 # noqa: N816

0 commit comments

Comments
 (0)