microecs 0.3.4__tar.gz → 0.3.6__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.1
2
2
  Name: microecs
3
- Version: 0.3.4
3
+ Version: 0.3.6
4
4
  Summary: MicroECS: Minimal Entity Component System (ECS) in python and numpy
5
5
  Home-page: https://gitlab.com/meehai/microecs
6
6
  License: MIT
@@ -11,11 +11,12 @@ class _Field(np.lib.mixins.NDArrayOperatorsMixin):
11
11
  self._lens = [len(p) for p in self.parts]
12
12
  self.len = sum(self._lens)
13
13
  self.shape: Shape = (len(self), *self.parts[0].shape[1:])
14
+ self.dtype = self.parts[0].dtype
14
15
  self._bounds = np.cumsum([0, *self._lens])
15
16
 
16
17
  def numpy(self) -> np.ndarray:
17
- """Creates a numpy array from the underlying pool parts"""
18
- return np.concatenate(self.parts)
18
+ """Creates a numpy array from the underlying pool parts. For len==1, we return the same object!"""
19
+ return np.concatenate(self.parts) if len(self.parts) != 1 else self.parts[0]
19
20
 
20
21
  def _chunk(self, x: T, i: int) -> T:
21
22
  if isinstance(x, _Field):
@@ -58,7 +59,7 @@ class _Field(np.lib.mixins.NDArrayOperatorsMixin):
58
59
  def __setitem__(self, key, value):
59
60
  if (not (isinstance(key, slice) and key == slice(None)) and
60
61
  not (isinstance(key, tuple) and key and key[0] == slice(None))):
61
- raise TypeError("entity-axis assignment crosses pools; use [:] or [:, k]")
62
+ raise TypeError("entity-axis assignment crosses pools; use [:] or [:, k] or [i][...]")
62
63
 
63
64
  if isinstance(value, _Field):
64
65
  for i, part in enumerate(self.parts):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: microecs
3
- Version: 0.3.4
3
+ Version: 0.3.6
4
4
  Summary: MicroECS: Minimal Entity Component System (ECS) in python and numpy
5
5
  Home-page: https://gitlab.com/meehai/microecs
6
6
  License: MIT
@@ -3,7 +3,7 @@ from pathlib import Path
3
3
  from setuptools import setup, find_packages
4
4
 
5
5
  NAME = "microecs"
6
- VERSION = "0.3.4"
6
+ VERSION = "0.3.6"
7
7
  DESCRIPTION = "MicroECS: Minimal Entity Component System (ECS) in python and numpy"
8
8
  URL = "https://gitlab.com/meehai/microecs"
9
9
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes