method implementation is not modified in this commit
fix #60 and #77 : get_components now return different component types
Lines 372,376,380,383 : uses typing.Tuple and not typing.List in return value to have different component types
Lines 372,376,380,383 : uses typing.List and not builtins.list to be compatible with python < 3.9
Lines 383 : use typing.Iterable and not typing.List because of a mysterious mypy error "Overloaded function implementation cannot produce return type of signature"
mypy esper and pytest tests tested with python 3.11.2
check issue #77 is fixed
from esper import World
class Position:
def __init__(self) -> None:
self.x = 0
class Velocity:
def __init__(self, x: int) -> None:
self.x = x
world = World()
ent = world.create_entity(Position(), Velocity(1))
for ent, (pos, vel) in world.get_components(Position, Velocity):
pos.x += "z"
$ mypy esper_mypy_test.py
esper_mypy_test.py:17: error: Unsupported operand types for + ("int" and "str") [operator]
Found 1 error in 1 file (checked 1 source file)
method implementation is not modified in this commit
fix #60 and #77 : get_components now return different component types
mypy esper
andpytest tests
tested with python 3.11.2check issue #77 is fixed