tcod-ecs 5.4.2__tar.gz → 5.5.1__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tcod-ecs
3
- Version: 5.4.2
3
+ Version: 5.5.1
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.10
@@ -15,8 +15,7 @@ Classifier: Typing :: Typed
15
15
  License-File: LICENSE
16
16
  Requires-Dist: attrs >=23.1.0
17
17
  Requires-Dist: cattrs >=23.1.2
18
- Requires-Dist: sentinel-value >=1.0.0
19
- Requires-Dist: typing-extensions >=4.13.1
18
+ Requires-Dist: typing-extensions >=4.14.0
20
19
  Requires-Dist: attrs >=22.2.0 ; extra == "test"
21
20
  Requires-Dist: pytest >=7.2.0 ; extra == "test"
22
21
  Requires-Dist: pytest-cov >=4.0.0 ; extra == "test"
@@ -21,8 +21,7 @@ requires-python = ">=3.10"
21
21
  dependencies = [
22
22
  "attrs >=23.1.0",
23
23
  "cattrs >=23.1.2",
24
- "sentinel-value >=1.0.0",
25
- "typing-extensions >=4.13.1",
24
+ "typing-extensions >=4.14.0",
26
25
  ]
27
26
 
28
27
  [tool.setuptools_scm]
@@ -93,6 +92,7 @@ line-length = 120
93
92
  select = ["ALL"]
94
93
  ignore = [
95
94
  "A005", # stdlib-module-shadowing, workaround VSCode treating all modules as local
95
+ "CPY001", # missing-copyright-notice
96
96
  "COM", # flake8-commas, handled by formatter
97
97
  "E501", # line-too-long
98
98
  "S101", # assert
@@ -0,0 +1,24 @@
1
+ # file generated by vcs-versioning
2
+ # don't change, don't track in version control
3
+ from __future__ import annotations
4
+
5
+ __all__ = [
6
+ "__version__",
7
+ "__version_tuple__",
8
+ "version",
9
+ "version_tuple",
10
+ "__commit_id__",
11
+ "commit_id",
12
+ ]
13
+
14
+ version: str
15
+ __version__: str
16
+ __version_tuple__: tuple[int | str, ...]
17
+ version_tuple: tuple[int | str, ...]
18
+ commit_id: str | None
19
+ __commit_id__: str | None
20
+
21
+ __version__ = version = '5.5.1'
22
+ __version_tuple__ = version_tuple = (5, 5, 1)
23
+
24
+ __commit_id__ = commit_id = 'gcbfe7de23'
@@ -0,0 +1,21 @@
1
+ """Special constants and sentinel values."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing_extensions import Never
6
+
7
+
8
+ class _IgnoreSetState(type):
9
+ def __setstate__(cls, _state: object) -> None:
10
+ """Ignore setstate on outdated sentinel-value pickle data."""
11
+
12
+
13
+ class IsA(metaclass=_IgnoreSetState):
14
+ """The default is-a relationship tag used for entity inheritance."""
15
+
16
+ def __new__(cls: type[IsA], *_: object) -> Never: # noqa: D102
17
+ # Return own type instead of instance, for outdated sentinel-value pickle data.
18
+ return cls # type: ignore[misc]
19
+
20
+
21
+ _sentinel_IsA = IsA # Compatibility with sentinel-value, deprecated since 5.4 # noqa: N816
@@ -14,8 +14,7 @@ from typing import (
14
14
  from weakref import WeakKeyDictionary, WeakValueDictionary
15
15
 
16
16
  import attrs
17
- from sentinel_value import sentinel
18
- from typing_extensions import Self, TypeForm, deprecated
17
+ from typing_extensions import Self, Sentinel, TypeForm, deprecated
19
18
 
20
19
  import tcod.ecs.callbacks
21
20
  import tcod.ecs.query
@@ -34,7 +33,7 @@ T = TypeVar("T")
34
33
  _T1 = TypeVar("_T1")
35
34
  _T2 = TypeVar("_T2")
36
35
 
37
- _raise: Final = sentinel("_raise")
36
+ _raise: Final = Sentinel("_raise")
38
37
 
39
38
  _entity_table: WeakKeyDictionary[Registry, WeakValueDictionary[object, Entity]] = WeakKeyDictionary()
40
39
  """A weak table of registries and unique identifiers to entity objects.
@@ -603,6 +602,11 @@ class EntityTags(MutableSet[Any]):
603
602
  entity: Entity
604
603
  traverse: tuple[object, ...]
605
604
 
605
+ @classmethod
606
+ def _from_iterable(cls, it: Iterable[_T1]) -> set[_T1]:
607
+ """Return an independent set for the inherited set operations."""
608
+ return set(it)
609
+
606
610
  def __call__(self, *, traverse: Iterable[object]) -> Self:
607
611
  """Update this view with alternative parameters, such as a specific traversal relation.
608
612
 
@@ -726,6 +730,11 @@ class EntityRelationsMapping(MutableSet[Entity]):
726
730
  key: object
727
731
  traverse: tuple[object, ...]
728
732
 
733
+ @classmethod
734
+ def _from_iterable(cls, it: Iterable[_T1]) -> set[_T1]:
735
+ """Return an independent set for the inherited set operations."""
736
+ return set(it)
737
+
729
738
  if __debug__:
730
739
 
731
740
  def __attrs_post_init__(self) -> None:
@@ -827,6 +836,7 @@ class EntityRelations(MutableMapping[object, EntityRelationsMapping]):
827
836
  def __setitem__(self, key: object, values: Iterable[Entity]) -> None:
828
837
  """Overwrite the targets of a relation tag with the new values."""
829
838
  assert not isinstance(values, Entity), "Did you mean `entity.relations[key] = (target,)`?"
839
+ values = tuple(values) # Values may be a live view of the mapping being replaced.
830
840
  mapping = EntityRelationsMapping(self.entity, key, self.traverse)
831
841
  mapping.clear()
832
842
  for v in values:
@@ -71,7 +71,7 @@ def _relations_lookup_from(
71
71
  for component_key, target_components in components.items():
72
72
  for target in target_components:
73
73
  relations_lookup[(component_key, ...)].add(origin)
74
- relations_lookup[(component_key, origin)].add(origin)
74
+ relations_lookup[(component_key, target)].add(origin)
75
75
  relations_lookup[(origin, component_key, None)].add(target)
76
76
  relations_lookup[(..., component_key, None)].add(target)
77
77
 
@@ -1,34 +0,0 @@
1
- # file generated by setuptools-scm
2
- # don't change, don't track in version control
3
-
4
- __all__ = [
5
- "__version__",
6
- "__version_tuple__",
7
- "version",
8
- "version_tuple",
9
- "__commit_id__",
10
- "commit_id",
11
- ]
12
-
13
- TYPE_CHECKING = False
14
- if TYPE_CHECKING:
15
- from typing import Tuple
16
- from typing import Union
17
-
18
- VERSION_TUPLE = Tuple[Union[int, str], ...]
19
- COMMIT_ID = Union[str, None]
20
- else:
21
- VERSION_TUPLE = object
22
- COMMIT_ID = object
23
-
24
- version: str
25
- __version__: str
26
- __version_tuple__: VERSION_TUPLE
27
- version_tuple: VERSION_TUPLE
28
- commit_id: COMMIT_ID
29
- __commit_id__: COMMIT_ID
30
-
31
- __version__ = version = '5.4.2'
32
- __version_tuple__ = version_tuple = (5, 4, 2)
33
-
34
- __commit_id__ = commit_id = 'g99e849adf'
@@ -1,10 +0,0 @@
1
- """Special constants and sentinel values."""
2
-
3
- from __future__ import annotations
4
-
5
- from typing import Final
6
-
7
- from sentinel_value import sentinel
8
-
9
- IsA: Final = sentinel("IsA")
10
- """The default is-a relationship tag used for entity inheritance."""
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes