enapter 0.10.0__py3-none-any.whl → 0.10.2__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.

Potentially problematic release.


This version of enapter might be problematic. Click here for more details.

enapter/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
- __version__ = "0.10.0"
1
+ __version__ = "0.10.2"
2
2
 
3
3
  from . import async_, log, mdns, mqtt, types, vucm
4
4
 
@@ -6,7 +6,7 @@ import json_log_formatter
6
6
  class JSONFormatter(json_log_formatter.JSONFormatter):
7
7
  def json_record(self, message, extra, record):
8
8
  json_record = {
9
- "time": datetime.datetime.now(datetime.UTC).isoformat(),
9
+ "time": datetime.datetime.now(datetime.timezone.utc).isoformat(),
10
10
  "level": record.levelname[:4],
11
11
  "name": record.name,
12
12
  **extra,
enapter/vucm/device.py CHANGED
@@ -34,12 +34,7 @@ def is_device_command(func: DeviceCommandFunc) -> bool:
34
34
 
35
35
 
36
36
  class Device(enapter.async_.Routine):
37
- def __init__(
38
- self,
39
- channel,
40
- cmd_prefix="cmd_",
41
- thread_pool_executor=None,
42
- ) -> None:
37
+ def __init__(self, channel, thread_pool_workers: int = 1) -> None:
43
38
  self.__channel = channel
44
39
 
45
40
  self.__tasks = {}
@@ -54,9 +49,9 @@ class Device(enapter.async_.Routine):
54
49
  if is_device_command(obj):
55
50
  self.__commands[name] = obj
56
51
 
57
- if thread_pool_executor is None:
58
- thread_pool_executor = concurrent.futures.ThreadPoolExecutor(max_workers=1)
59
- self.__thread_pool_executor = thread_pool_executor
52
+ self.__thread_pool_executor = concurrent.futures.ThreadPoolExecutor(
53
+ max_workers=thread_pool_workers
54
+ )
60
55
 
61
56
  self.log = Logger(channel=channel)
62
57
  self.alerts: Set[str] = set()
@@ -136,7 +131,7 @@ class Device(enapter.async_.Routine):
136
131
 
137
132
  async def __execute_command(self, req):
138
133
  try:
139
- cmd = self._commands[req.name]
134
+ cmd = self.__commands[req.name]
140
135
  except KeyError:
141
136
  return enapter.mqtt.api.CommandState.ERROR, {"reason": "unknown command"}
142
137
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: enapter
3
- Version: 0.10.0
3
+ Version: 0.10.2
4
4
  Summary: Enapter Python SDK
5
5
  Home-page: https://github.com/Enapter/python-sdk
6
6
  Author: Roman Novatorov
@@ -1,10 +1,10 @@
1
- enapter/__init__.py,sha256=No4wlAO2UL9UZK-GmXjX2uitUxjgply-xv38DCZb4_w,183
1
+ enapter/__init__.py,sha256=rr5vMbAJ4AeIadqpC-r68wCLU0tZrMT-081OMjG_LyE,183
2
2
  enapter/types.py,sha256=J_rFCW79cloh2FF_49Oab5kaEGdZohymkCJU7vfko-8,113
3
3
  enapter/async_/__init__.py,sha256=JuiRI2bN2AgB-HLfAUoSsZpEziwFRftNNEp59Evnd0M,109
4
4
  enapter/async_/generator.py,sha256=qBhnt36Gl2166sJFnZHsREbZu8l43M4DfxybUMIv6W4,300
5
5
  enapter/async_/routine.py,sha256=A5fG4XnCEQT0Qa_JNh1N43Fv5lnLaCoGF4xt6pOAdNs,1770
6
6
  enapter/log/__init__.py,sha256=n1sWMDKJSs_ebZzjbTrVdfg-oi0V1tvliTxgIV-msJ0,600
7
- enapter/log/json_formatter.py,sha256=mkcWW2VmksCmRVPU7ayxbNp5-eRetznSjZlA-DUloOY,714
7
+ enapter/log/json_formatter.py,sha256=R5-nNEtFKdkv_SAi0gkGOaRrzsbxBjUmgZzzuJk2z7A,723
8
8
  enapter/mdns/__init__.py,sha256=uwsg8wJ0Lcsr9oOEW1PkEV3jVgWzgA7RG2ur_MRLtM0,55
9
9
  enapter/mdns/resolver.py,sha256=FFQuZiaKOaNtfSgI2YOaSdG-BuZwOKmYVy06Sc735Zo,1297
10
10
  enapter/mqtt/__init__.py,sha256=aKJklTmR8OEnwnQXN1MtrvJimC9EfxcTOqhhBsPcb84,126
@@ -17,7 +17,7 @@ enapter/mqtt/api/log_severity.py,sha256=ZmHXMc8d1e2ZnsXDWwl3S3noAEJjILYab_qjqk37
17
17
  enapter/vucm/__init__.py,sha256=40GAkJvpCl7oMuWDU09zpjP5rM4V-oKRbh_R1uhx4aE,247
18
18
  enapter/vucm/app.py,sha256=zHdEEUnKrVHNvVGmw7Jrv5MFkVnbg5yiiped86jxbSU,1424
19
19
  enapter/vucm/config.py,sha256=Lj-YLQvoZ9ivXVBF0oKRvdupLRJ2l55EEzoxZ4HWWRE,1713
20
- enapter/vucm/device.py,sha256=FiJSJNgZkWGL-866IGY8bbqS75ZZigJZYyoH7kMW7Is,4352
20
+ enapter/vucm/device.py,sha256=sxoXEzGKtalmJqxX1ZKL6hhg9gUx31TlEGVKenRmLOM,4241
21
21
  enapter/vucm/logger.py,sha256=a_ZtuIinATbEtiP5avV8JGAKFKG0-RZhF6SozaF-_PU,1445
22
22
  enapter/vucm/ucm.py,sha256=r1q1rSYlT7GWZ24JLmTbzkpMDUUHcvCNp9t5xHTEyzY,957
23
23
  tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -32,7 +32,7 @@ tests/unit/test_log.py,sha256=Q-ZelqGfladBCaw-BQrwRrxbxMK1VZxgY7HBsBb1GHw,1875
32
32
  tests/unit/test_vucm.py,sha256=a3euiqV9etsfrWFDUtHCNqKU3irx-GEZMczBcmddhek,3626
33
33
  tests/unit/test_mqtt/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
34
34
  tests/unit/test_mqtt/test_api.py,sha256=ObKCHB-KDOYQLFrdzjTmLfjdWXXX0oanGKpX49P0qMI,2670
35
- enapter-0.10.0.dist-info/METADATA,sha256=354uZuKv0_6QgPow7MPuP6VT6GNMNKYLfhSnSXNo0Fw,3335
36
- enapter-0.10.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
37
- enapter-0.10.0.dist-info/top_level.txt,sha256=DsMzVradd7z3A0fm7zmn9oh08ijO41RtzglrnPlx54w,14
38
- enapter-0.10.0.dist-info/RECORD,,
35
+ enapter-0.10.2.dist-info/METADATA,sha256=IiVXJso-oWzcLXHW11ofsOERnL3BGVQBwDY9Mt-heaY,3335
36
+ enapter-0.10.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
37
+ enapter-0.10.2.dist-info/top_level.txt,sha256=DsMzVradd7z3A0fm7zmn9oh08ijO41RtzglrnPlx54w,14
38
+ enapter-0.10.2.dist-info/RECORD,,