ezmsg-baseproc 1.0.1__py3-none-any.whl → 1.0.3__py3-none-any.whl
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.
- ezmsg/baseproc/__version__.py +2 -2
- ezmsg/baseproc/protocols.py +3 -1
- ezmsg/baseproc/util/profile.py +20 -11
- {ezmsg_baseproc-1.0.1.dist-info → ezmsg_baseproc-1.0.3.dist-info}/METADATA +3 -3
- {ezmsg_baseproc-1.0.1.dist-info → ezmsg_baseproc-1.0.3.dist-info}/RECORD +7 -7
- {ezmsg_baseproc-1.0.1.dist-info → ezmsg_baseproc-1.0.3.dist-info}/WHEEL +0 -0
- {ezmsg_baseproc-1.0.1.dist-info → ezmsg_baseproc-1.0.3.dist-info}/licenses/LICENSE +0 -0
ezmsg/baseproc/__version__.py
CHANGED
|
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
|
28
28
|
commit_id: COMMIT_ID
|
|
29
29
|
__commit_id__: COMMIT_ID
|
|
30
30
|
|
|
31
|
-
__version__ = version = '1.0.
|
|
32
|
-
__version_tuple__ = version_tuple = (1, 0,
|
|
31
|
+
__version__ = version = '1.0.3'
|
|
32
|
+
__version_tuple__ = version_tuple = (1, 0, 3)
|
|
33
33
|
|
|
34
34
|
__commit_id__ = commit_id = None
|
ezmsg/baseproc/protocols.py
CHANGED
|
@@ -4,6 +4,8 @@ import functools
|
|
|
4
4
|
import typing
|
|
5
5
|
from dataclasses import dataclass
|
|
6
6
|
|
|
7
|
+
import ezmsg.core as ez
|
|
8
|
+
|
|
7
9
|
from .util.message import SampleMessage
|
|
8
10
|
|
|
9
11
|
# --- Processor state decorator ---
|
|
@@ -12,7 +14,7 @@ processor_state = functools.partial(dataclass, unsafe_hash=True, frozen=False, i
|
|
|
12
14
|
# --- Type variables for protocols and processors ---
|
|
13
15
|
MessageInType = typing.TypeVar("MessageInType")
|
|
14
16
|
MessageOutType = typing.TypeVar("MessageOutType")
|
|
15
|
-
SettingsType = typing.TypeVar("SettingsType")
|
|
17
|
+
SettingsType = typing.TypeVar("SettingsType", bound=ez.Settings)
|
|
16
18
|
StateType = typing.TypeVar("StateType")
|
|
17
19
|
|
|
18
20
|
|
ezmsg/baseproc/util/profile.py
CHANGED
|
@@ -31,20 +31,29 @@ def _setup_logger(append: bool = False) -> logging.Logger:
|
|
|
31
31
|
write_header = True
|
|
32
32
|
if logpath.exists() and logpath.is_file():
|
|
33
33
|
if append:
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
try:
|
|
35
|
+
with open(logpath) as f:
|
|
36
|
+
first_line = f.readline().rstrip()
|
|
37
|
+
if first_line == HEADER:
|
|
38
|
+
write_header = False
|
|
39
|
+
else:
|
|
40
|
+
# Remove the file if appending, but headers do not match
|
|
41
|
+
ezmsg_logger = logging.getLogger("ezmsg")
|
|
42
|
+
ezmsg_logger.warning(
|
|
43
|
+
"Profiling header mismatch: please make sure to use the same version of "
|
|
44
|
+
"ezmsg for all processes."
|
|
45
|
+
)
|
|
46
|
+
logpath.unlink()
|
|
47
|
+
except (PermissionError, OSError):
|
|
48
|
+
# On Windows, file may be locked by another process - just append
|
|
37
49
|
write_header = False
|
|
38
|
-
else:
|
|
39
|
-
# Remove the file if appending, but headers do not match
|
|
40
|
-
ezmsg_logger = logging.getLogger("ezmsg")
|
|
41
|
-
ezmsg_logger.warning(
|
|
42
|
-
"Profiling header mismatch: please make sure to use the same version of ezmsg for all processes."
|
|
43
|
-
)
|
|
44
|
-
logpath.unlink()
|
|
45
50
|
else:
|
|
46
51
|
# Remove the file if not appending
|
|
47
|
-
|
|
52
|
+
try:
|
|
53
|
+
logpath.unlink()
|
|
54
|
+
except (PermissionError, OSError):
|
|
55
|
+
# On Windows, file may be locked by another process - continue anyway
|
|
56
|
+
pass
|
|
48
57
|
|
|
49
58
|
# Create a logger with the name "ezprofile"
|
|
50
59
|
_logger = logging.getLogger("ezprofile")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ezmsg-baseproc
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.3
|
|
4
4
|
Summary: Base processor classes and protocols for ezmsg signal processing pipelines
|
|
5
5
|
Author-email: Griffin Milsap <griffin.milsap@gmail.com>, Preston Peranich <pperanich@gmail.com>, Chadwick Boulay <chadwick.boulay@gmail.com>, Kyle McGraw <kmcgraw@blackrockneuro.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -52,7 +52,7 @@ ezmsg.baseproc/
|
|
|
52
52
|
```python
|
|
53
53
|
from dataclasses import dataclass
|
|
54
54
|
from ezmsg.baseproc import BaseTransformer
|
|
55
|
-
from ezmsg.util.messages.axisarray import AxisArray
|
|
55
|
+
from ezmsg.util.messages.axisarray import AxisArray, replace
|
|
56
56
|
|
|
57
57
|
@dataclass
|
|
58
58
|
class MySettings:
|
|
@@ -60,7 +60,7 @@ class MySettings:
|
|
|
60
60
|
|
|
61
61
|
class MyTransformer(BaseTransformer[MySettings, AxisArray, AxisArray]):
|
|
62
62
|
def _process(self, message: AxisArray) -> AxisArray:
|
|
63
|
-
return
|
|
63
|
+
return replace(message, data=message.data * self.settings.scale)
|
|
64
64
|
```
|
|
65
65
|
|
|
66
66
|
### Creating a Stateful Transformer
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
ezmsg/baseproc/__init__.py,sha256=zmhdrRTnj3-ilBitu6zBniV04HJXc_fM_tKYiapFGko,3830
|
|
2
|
-
ezmsg/baseproc/__version__.py,sha256=
|
|
2
|
+
ezmsg/baseproc/__version__.py,sha256=l8k828IdTfzXAlmx4oT8GsiIf2eeMAlFDALjoYk-jrU,704
|
|
3
3
|
ezmsg/baseproc/composite.py,sha256=Lin4K_rmS2Tnxt-m8daP-PUyeeqL4id5JkVh-AUNrQw,14901
|
|
4
4
|
ezmsg/baseproc/processor.py,sha256=Ir9FtNuVG4yc-frwNxoYrlld99ff1mXwwGWaHxEJ6tY,8056
|
|
5
|
-
ezmsg/baseproc/protocols.py,sha256=
|
|
5
|
+
ezmsg/baseproc/protocols.py,sha256=O3Qp0ymE9Ovlmh8t22v-lMmFzuWK0D93REAYMnJV3xA,5106
|
|
6
6
|
ezmsg/baseproc/stateful.py,sha256=-jjAZIyJA5eiTECi1fSfazfqgv__RtyqPp1ZvLFFIDI,11424
|
|
7
7
|
ezmsg/baseproc/units.py,sha256=TRhjDKw0lqUUst7BHYJKP3AhGpRd6mvcdKxULfeWjA0,10283
|
|
8
8
|
ezmsg/baseproc/util/__init__.py,sha256=hvMUJOBuqioER50GZ5-GZiQbQ9NtQYEze13ZlR2jbMA,37
|
|
9
9
|
ezmsg/baseproc/util/asio.py,sha256=0sF5oDc58DSLlcEgoUpNiqjjcbqnZhjSpQrXn6IdosM,4960
|
|
10
10
|
ezmsg/baseproc/util/message.py,sha256=l_b1b6bXX8N6VF9RbUELzsHs73cKkDURBdIr0lt3CY0,909
|
|
11
|
-
ezmsg/baseproc/util/profile.py,sha256=
|
|
11
|
+
ezmsg/baseproc/util/profile.py,sha256=MOQDsFsW6ddXT0uAOgytW3aK_AZW5ieA16Pz2hWuE2o,6189
|
|
12
12
|
ezmsg/baseproc/util/typeresolution.py,sha256=WCHHYIrMMZ1CfwJWVlJPQgFyY2gnGRNFJVQynAsee7Y,3113
|
|
13
|
-
ezmsg_baseproc-1.0.
|
|
14
|
-
ezmsg_baseproc-1.0.
|
|
15
|
-
ezmsg_baseproc-1.0.
|
|
16
|
-
ezmsg_baseproc-1.0.
|
|
13
|
+
ezmsg_baseproc-1.0.3.dist-info/METADATA,sha256=nOK4zkV08Nx1azdXd7js_OT0kQqomMq0Z2s8AoPSPd4,3320
|
|
14
|
+
ezmsg_baseproc-1.0.3.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
15
|
+
ezmsg_baseproc-1.0.3.dist-info/licenses/LICENSE,sha256=BDD8rfac1Ur7mp0_3izEdr6fHgSA3Or6U1Kb0ZAWsow,1066
|
|
16
|
+
ezmsg_baseproc-1.0.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|