tcod-ecs 5.2.2__tar.gz → 5.2.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {tcod_ecs-5.2.2 → tcod_ecs-5.2.4}/LICENSE +1 -1
- {tcod_ecs-5.2.2 → tcod_ecs-5.2.4}/PKG-INFO +4 -3
- {tcod_ecs-5.2.2 → tcod_ecs-5.2.4}/README.md +1 -1
- {tcod_ecs-5.2.2 → tcod_ecs-5.2.4}/pyproject.toml +8 -2
- {tcod_ecs-5.2.2 → tcod_ecs-5.2.4}/tcod/ecs/_version.py +9 -4
- {tcod_ecs-5.2.2 → tcod_ecs-5.2.4}/tcod/ecs/entity.py +14 -8
- {tcod_ecs-5.2.2 → tcod_ecs-5.2.4}/tcod/ecs/typing.py +1 -1
- {tcod_ecs-5.2.2 → tcod_ecs-5.2.4}/tcod/ecs/__init__.py +0 -0
- {tcod_ecs-5.2.2 → tcod_ecs-5.2.4}/tcod/ecs/_converter.py +0 -0
- {tcod_ecs-5.2.2 → tcod_ecs-5.2.4}/tcod/ecs/callbacks.py +0 -0
- {tcod_ecs-5.2.2 → tcod_ecs-5.2.4}/tcod/ecs/constants.py +0 -0
- {tcod_ecs-5.2.2 → tcod_ecs-5.2.4}/tcod/ecs/py.typed +0 -0
- {tcod_ecs-5.2.2 → tcod_ecs-5.2.4}/tcod/ecs/query.py +0 -0
- {tcod_ecs-5.2.2 → tcod_ecs-5.2.4}/tcod/ecs/registry.py +0 -0
- {tcod_ecs-5.2.2 → tcod_ecs-5.2.4}/tcod/ecs/world.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: tcod-ecs
|
|
3
|
-
Version: 5.2.
|
|
3
|
+
Version: 5.2.4
|
|
4
4
|
Summary: A type-hinted Entity Component System based on Python dictionaries and sets.
|
|
5
5
|
Author-email: Kyle Benesch <4b796c65+github@gmail.com>
|
|
6
6
|
Requires-Python: >=3.8
|
|
@@ -12,6 +12,7 @@ Classifier: Operating System :: OS Independent
|
|
|
12
12
|
Classifier: Programming Language :: Python :: 3
|
|
13
13
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
14
14
|
Classifier: Typing :: Typed
|
|
15
|
+
License-File: LICENSE
|
|
15
16
|
Requires-Dist: attrs >=23.1.0
|
|
16
17
|
Requires-Dist: cattrs >=23.1.2
|
|
17
18
|
Requires-Dist: sentinel-value >=1.0.0
|
|
@@ -76,7 +77,7 @@ The ECS Registry is used to create and store entities and their components.
|
|
|
76
77
|
## Entity
|
|
77
78
|
|
|
78
79
|
Each Entity is identified by its unique id (`uid`) which can be any hashable object combined with the `registry` it belongs.
|
|
79
|
-
New unique entities can be created with `Registry.new_entity` which uses a new `object()` as the `uid`, this guarantees uniqueness which is not always
|
|
80
|
+
New unique entities can be created with `Registry.new_entity` which uses a new `object()` as the `uid`, this guarantees uniqueness which is not always desirable.
|
|
80
81
|
An entity always knows about its assigned registry, which can be accessed with the `Entity.registry` property from any Entity instance.
|
|
81
82
|
Registries only know about their entities once the entity is assigned a name, component, tag, or relation.
|
|
82
83
|
|
|
@@ -47,7 +47,7 @@ The ECS Registry is used to create and store entities and their components.
|
|
|
47
47
|
## Entity
|
|
48
48
|
|
|
49
49
|
Each Entity is identified by its unique id (`uid`) which can be any hashable object combined with the `registry` it belongs.
|
|
50
|
-
New unique entities can be created with `Registry.new_entity` which uses a new `object()` as the `uid`, this guarantees uniqueness which is not always
|
|
50
|
+
New unique entities can be created with `Registry.new_entity` which uses a new `object()` as the `uid`, this guarantees uniqueness which is not always desirable.
|
|
51
51
|
An entity always knows about its assigned registry, which can be accessed with the `Entity.registry` property from any Entity instance.
|
|
52
52
|
Registries only know about their entities once the entity is assigned a name, component, tag, or relation.
|
|
53
53
|
|
|
@@ -66,6 +66,14 @@ warn_return_any = true
|
|
|
66
66
|
no_implicit_reexport = true
|
|
67
67
|
strict_equality = true
|
|
68
68
|
|
|
69
|
+
[tool.pyright]
|
|
70
|
+
reportInconsistentOverload = false
|
|
71
|
+
reportIncompatibleMethodOverride = false
|
|
72
|
+
reportAssignmentType = false
|
|
73
|
+
reportCallIssue = false
|
|
74
|
+
reportInvalidTypeVarUse = false
|
|
75
|
+
reportArgumentType = false
|
|
76
|
+
|
|
69
77
|
[tool.pytest.ini_options]
|
|
70
78
|
minversion = "6.0"
|
|
71
79
|
required_plugins = ["pytest-cov>=4.0.0", "pytest-benchmark>=4.0.0"]
|
|
@@ -81,8 +89,6 @@ line-length = 120
|
|
|
81
89
|
[tool.ruff.lint] # https://docs.astral.sh/ruff/rules/
|
|
82
90
|
select = ["ALL"]
|
|
83
91
|
ignore = [
|
|
84
|
-
"ANN101", # missing-type-self
|
|
85
|
-
"ANN102", # missing-type-cls
|
|
86
92
|
"COM", # flake8-commas, handled by formatter
|
|
87
93
|
"E501", # line-too-long
|
|
88
94
|
"S101", # assert
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
# file generated by
|
|
1
|
+
# file generated by setuptools-scm
|
|
2
2
|
# don't change, don't track in version control
|
|
3
|
+
|
|
4
|
+
__all__ = ["__version__", "__version_tuple__", "version", "version_tuple"]
|
|
5
|
+
|
|
3
6
|
TYPE_CHECKING = False
|
|
4
7
|
if TYPE_CHECKING:
|
|
5
|
-
from typing import Tuple
|
|
8
|
+
from typing import Tuple
|
|
9
|
+
from typing import Union
|
|
10
|
+
|
|
6
11
|
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
|
7
12
|
else:
|
|
8
13
|
VERSION_TUPLE = object
|
|
@@ -12,5 +17,5 @@ __version__: str
|
|
|
12
17
|
__version_tuple__: VERSION_TUPLE
|
|
13
18
|
version_tuple: VERSION_TUPLE
|
|
14
19
|
|
|
15
|
-
__version__ = version = '5.2.
|
|
16
|
-
__version_tuple__ = version_tuple = (5, 2,
|
|
20
|
+
__version__ = version = '5.2.4'
|
|
21
|
+
__version_tuple__ = version_tuple = (5, 2, 4)
|
|
@@ -66,7 +66,7 @@ class Entity:
|
|
|
66
66
|
>>> other_entity = registry["other"]
|
|
67
67
|
""" # Changes here should be reflected in conftest.py
|
|
68
68
|
|
|
69
|
-
__slots__ = ("
|
|
69
|
+
__slots__ = ("__weakref__", "registry", "uid")
|
|
70
70
|
|
|
71
71
|
registry: Final[Registry] # type:ignore[misc] # https://github.com/python/mypy/issues/5774
|
|
72
72
|
"""The :any:`Registry` this entity belongs to."""
|
|
@@ -126,10 +126,10 @@ class Entity:
|
|
|
126
126
|
|
|
127
127
|
.. versionadded:: 4.2.0
|
|
128
128
|
"""
|
|
129
|
-
self.components.clear()
|
|
130
|
-
self.tags.clear()
|
|
131
|
-
self.relation_tags_many.clear()
|
|
132
|
-
self.relation_components.clear()
|
|
129
|
+
self.components(traverse=()).clear()
|
|
130
|
+
self.tags(traverse=()).clear()
|
|
131
|
+
self.relation_tags_many(traverse=()).clear()
|
|
132
|
+
self.relation_components(traverse=()).clear()
|
|
133
133
|
|
|
134
134
|
def instantiate(self) -> Self:
|
|
135
135
|
"""Return a new entity which inherits the components, tags, and relations of this entity.
|
|
@@ -394,7 +394,7 @@ def _traverse_entities(start: Entity, traverse_parents: tuple[object, ...]) -> I
|
|
|
394
394
|
|
|
395
395
|
|
|
396
396
|
@attrs.define(eq=False, frozen=True, weakref_slot=False)
|
|
397
|
-
class EntityComponents(MutableMapping[Union[Type[Any], Tuple[object, Type[Any]]],
|
|
397
|
+
class EntityComponents(MutableMapping[Union[Type[Any], Tuple[object, Type[Any]]], object]):
|
|
398
398
|
"""A proxy attribute to access an entities components like a dictionary.
|
|
399
399
|
|
|
400
400
|
See :any:`Entity.components`.
|
|
@@ -552,7 +552,7 @@ class EntityComponents(MutableMapping[Union[Type[Any], Tuple[object, Type[Any]]]
|
|
|
552
552
|
except KeyError:
|
|
553
553
|
return default # type: ignore[return-value] # https://github.com/python/mypy/issues/3737
|
|
554
554
|
|
|
555
|
-
def setdefault(self, __key: ComponentKey[T], __default: T) -> T:
|
|
555
|
+
def setdefault(self, __key: ComponentKey[T], __default: T, /) -> T:
|
|
556
556
|
"""Assign a default value if a component is missing, then returns the current value."""
|
|
557
557
|
try:
|
|
558
558
|
return self[__key]
|
|
@@ -650,6 +650,12 @@ class EntityTags(MutableSet[Any]):
|
|
|
650
650
|
raise KeyError(tag)
|
|
651
651
|
self.discard(tag)
|
|
652
652
|
|
|
653
|
+
def clear(self) -> None:
|
|
654
|
+
"""Remove all tags directly in this entity."""
|
|
655
|
+
_tags_by_entity = self.entity.registry._tags_by_entity
|
|
656
|
+
while _tags_by_entity[self.entity]:
|
|
657
|
+
self.discard(next(iter(_tags_by_entity[self.entity])))
|
|
658
|
+
|
|
653
659
|
def __contains__(self, x: object) -> bool:
|
|
654
660
|
"""Return True if this entity has the given tag."""
|
|
655
661
|
_tags_by_entity = self.entity.registry._tags_by_entity
|
|
@@ -1034,7 +1040,7 @@ class EntityComponentRelations(MutableMapping[ComponentKey[Any], EntityComponent
|
|
|
1034
1040
|
"""Access relations for this component key as a `{target: component}` dict-like object."""
|
|
1035
1041
|
return EntityComponentRelationMapping(self.entity, key, self.traverse)
|
|
1036
1042
|
|
|
1037
|
-
def __setitem__(self, __key: ComponentKey[T], __values: Mapping[Entity, object]) -> None:
|
|
1043
|
+
def __setitem__(self, __key: ComponentKey[T], __values: Mapping[Entity, object], /) -> None:
|
|
1038
1044
|
"""Redefine the component relations for this entity.
|
|
1039
1045
|
|
|
1040
1046
|
..versionadded:: 4.2.0
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|