PyPlumIO 0.5.52__tar.gz → 0.5.53__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.
Files changed (173) hide show
  1. {pyplumio-0.5.52 → pyplumio-0.5.53}/PKG-INFO +4 -4
  2. {pyplumio-0.5.52 → pyplumio-0.5.53}/PyPlumIO.egg-info/PKG-INFO +4 -4
  3. {pyplumio-0.5.52 → pyplumio-0.5.53}/PyPlumIO.egg-info/SOURCES.txt +0 -2
  4. {pyplumio-0.5.52 → pyplumio-0.5.53}/PyPlumIO.egg-info/requires.txt +3 -3
  5. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/_version.py +2 -2
  6. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/connection.py +1 -1
  7. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/data_types.py +7 -0
  8. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/filters.py +7 -0
  9. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/frames/__init__.py +13 -0
  10. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/parameters/__init__.py +5 -1
  11. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/stream.py +39 -45
  12. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/utils.py +26 -2
  13. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyproject.toml +3 -3
  14. {pyplumio-0.5.52 → pyplumio-0.5.53}/requirements.txt +1 -1
  15. {pyplumio-0.5.52 → pyplumio-0.5.53}/requirements_test.txt +2 -2
  16. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/parameters/test_init.py +9 -0
  17. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/test_connection.py +3 -4
  18. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/test_data_types.py +7 -0
  19. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/test_filters.py +10 -0
  20. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/test_stream.py +106 -79
  21. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/test_utils.py +27 -0
  22. pyplumio-0.5.52/pyplumio/helpers/timeout.py +0 -32
  23. pyplumio-0.5.52/tests/helpers/test_timeout.py +0 -32
  24. {pyplumio-0.5.52 → pyplumio-0.5.53}/.gitattributes +0 -0
  25. {pyplumio-0.5.52 → pyplumio-0.5.53}/.github/CODE_OF_CONDUCT.md +0 -0
  26. {pyplumio-0.5.52 → pyplumio-0.5.53}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
  27. {pyplumio-0.5.52 → pyplumio-0.5.53}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
  28. {pyplumio-0.5.52 → pyplumio-0.5.53}/.github/dependabot.yml +0 -0
  29. {pyplumio-0.5.52 → pyplumio-0.5.53}/.github/workflows/ci.yml +0 -0
  30. {pyplumio-0.5.52 → pyplumio-0.5.53}/.github/workflows/codeql.yml +0 -0
  31. {pyplumio-0.5.52 → pyplumio-0.5.53}/.github/workflows/deploy.yml +0 -0
  32. {pyplumio-0.5.52 → pyplumio-0.5.53}/.github/workflows/documentation.yml +0 -0
  33. {pyplumio-0.5.52 → pyplumio-0.5.53}/.gitignore +0 -0
  34. {pyplumio-0.5.52 → pyplumio-0.5.53}/.pre-commit-config.yaml +0 -0
  35. {pyplumio-0.5.52 → pyplumio-0.5.53}/.qlty/qlty.toml +0 -0
  36. {pyplumio-0.5.52 → pyplumio-0.5.53}/.vscode/settings.json +0 -0
  37. {pyplumio-0.5.52 → pyplumio-0.5.53}/LICENSE +0 -0
  38. {pyplumio-0.5.52 → pyplumio-0.5.53}/MANIFEST.in +0 -0
  39. {pyplumio-0.5.52 → pyplumio-0.5.53}/PyPlumIO.egg-info/dependency_links.txt +0 -0
  40. {pyplumio-0.5.52 → pyplumio-0.5.53}/PyPlumIO.egg-info/top_level.txt +0 -0
  41. {pyplumio-0.5.52 → pyplumio-0.5.53}/README.md +0 -0
  42. {pyplumio-0.5.52 → pyplumio-0.5.53}/docs/Makefile +0 -0
  43. {pyplumio-0.5.52 → pyplumio-0.5.53}/docs/make.bat +0 -0
  44. {pyplumio-0.5.52 → pyplumio-0.5.53}/docs/source/callbacks.rst +0 -0
  45. {pyplumio-0.5.52 → pyplumio-0.5.53}/docs/source/conf.py +0 -0
  46. {pyplumio-0.5.52 → pyplumio-0.5.53}/docs/source/connecting.rst +0 -0
  47. {pyplumio-0.5.52 → pyplumio-0.5.53}/docs/source/frames.rst +0 -0
  48. {pyplumio-0.5.52 → pyplumio-0.5.53}/docs/source/index.rst +0 -0
  49. {pyplumio-0.5.52 → pyplumio-0.5.53}/docs/source/mixers_thermostats.rst +0 -0
  50. {pyplumio-0.5.52 → pyplumio-0.5.53}/docs/source/protocol.rst +0 -0
  51. {pyplumio-0.5.52 → pyplumio-0.5.53}/docs/source/reading.rst +0 -0
  52. {pyplumio-0.5.52 → pyplumio-0.5.53}/docs/source/schedules.rst +0 -0
  53. {pyplumio-0.5.52 → pyplumio-0.5.53}/docs/source/writing.rst +0 -0
  54. {pyplumio-0.5.52 → pyplumio-0.5.53}/images/ecomax.png +0 -0
  55. {pyplumio-0.5.52 → pyplumio-0.5.53}/images/rs485.png +0 -0
  56. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/__init__.py +0 -0
  57. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/__main__.py +0 -0
  58. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/const.py +0 -0
  59. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/devices/__init__.py +0 -0
  60. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/devices/ecomax.py +0 -0
  61. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/devices/ecoster.py +0 -0
  62. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/devices/mixer.py +0 -0
  63. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/devices/thermostat.py +0 -0
  64. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/exceptions.py +0 -0
  65. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/frames/messages.py +0 -0
  66. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/frames/requests.py +0 -0
  67. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/frames/responses.py +0 -0
  68. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/helpers/__init__.py +0 -0
  69. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/helpers/async_cache.py +0 -0
  70. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/helpers/event_manager.py +0 -0
  71. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/helpers/factory.py +0 -0
  72. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/helpers/task_manager.py +0 -0
  73. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/parameters/custom/__init__.py +0 -0
  74. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/parameters/custom/ecomax_860d3_hb.py +0 -0
  75. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/parameters/ecomax.py +0 -0
  76. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/parameters/mixer.py +0 -0
  77. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/parameters/thermostat.py +0 -0
  78. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/protocol.py +0 -0
  79. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/py.typed +0 -0
  80. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/structures/__init__.py +0 -0
  81. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/structures/alerts.py +0 -0
  82. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/structures/boiler_load.py +0 -0
  83. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/structures/boiler_power.py +0 -0
  84. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/structures/ecomax_parameters.py +0 -0
  85. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/structures/fan_power.py +0 -0
  86. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/structures/frame_versions.py +0 -0
  87. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/structures/fuel_consumption.py +0 -0
  88. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/structures/fuel_level.py +0 -0
  89. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/structures/lambda_sensor.py +0 -0
  90. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/structures/mixer_parameters.py +0 -0
  91. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/structures/mixer_sensors.py +0 -0
  92. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/structures/modules.py +0 -0
  93. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/structures/network_info.py +0 -0
  94. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/structures/output_flags.py +0 -0
  95. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/structures/outputs.py +0 -0
  96. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/structures/pending_alerts.py +0 -0
  97. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/structures/product_info.py +0 -0
  98. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/structures/program_version.py +0 -0
  99. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/structures/regulator_data.py +0 -0
  100. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/structures/regulator_data_schema.py +0 -0
  101. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/structures/schedules.py +0 -0
  102. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/structures/statuses.py +0 -0
  103. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/structures/temperatures.py +0 -0
  104. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/structures/thermostat_parameters.py +0 -0
  105. {pyplumio-0.5.52 → pyplumio-0.5.53}/pyplumio/structures/thermostat_sensors.py +0 -0
  106. {pyplumio-0.5.52 → pyplumio-0.5.53}/requirements_docs.txt +0 -0
  107. {pyplumio-0.5.52 → pyplumio-0.5.53}/setup.cfg +0 -0
  108. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/__init__.py +0 -0
  109. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/conftest.py +0 -0
  110. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/devices/__init__.py +0 -0
  111. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/devices/test_ecomax.py +0 -0
  112. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/devices/test_ecoster.py +0 -0
  113. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/devices/test_init.py +0 -0
  114. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/devices/test_mixer.py +0 -0
  115. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/devices/test_thermostat.py +0 -0
  116. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/frames/test_init.py +0 -0
  117. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/frames/test_messages.py +0 -0
  118. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/frames/test_requests.py +0 -0
  119. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/frames/test_responses.py +0 -0
  120. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/helpers/__init__.py +0 -0
  121. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/helpers/test_async_cache.py +0 -0
  122. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/helpers/test_event_manager.py +0 -0
  123. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/helpers/test_factory.py +0 -0
  124. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/helpers/test_task_manager.py +0 -0
  125. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/helpers/test_uid.py +0 -0
  126. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/parameters/__init__.py +0 -0
  127. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/parameters/custom/__init__.py +0 -0
  128. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/parameters/custom/test_ecomax_860d3_hb.py +0 -0
  129. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/parameters/custom/test_init.py +0 -0
  130. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/parameters/test_ecomax.py +0 -0
  131. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/parameters/test_mixers.py +0 -0
  132. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/parameters/test_thermostats.py +0 -0
  133. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/ruff.toml +0 -0
  134. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/structures/__init__.py +0 -0
  135. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/structures/test_alerts.py +0 -0
  136. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/structures/test_boiler_load.py +0 -0
  137. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/structures/test_boiler_power.py +0 -0
  138. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/structures/test_ecomax_parameters.py +0 -0
  139. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/structures/test_fan_power.py +0 -0
  140. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/structures/test_frame_versions.py +0 -0
  141. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/structures/test_fuel_consumption.py +0 -0
  142. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/structures/test_fuel_level.py +0 -0
  143. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/structures/test_lambda_sensor.py +0 -0
  144. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/structures/test_mixer_parameters.py +0 -0
  145. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/structures/test_product_info.py +0 -0
  146. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/structures/test_schedules.py +0 -0
  147. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/test_init.py +0 -0
  148. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/test_main.py +0 -0
  149. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/test_protocol.py +0 -0
  150. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/testdata/messages/regulator_data.json +0 -0
  151. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/testdata/messages/sensor_data.json +0 -0
  152. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/testdata/parameters/ecomax_860d3_hb.json +0 -0
  153. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/testdata/requests/alerts.json +0 -0
  154. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/testdata/requests/ecomax_control.json +0 -0
  155. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/testdata/requests/ecomax_parameters.json +0 -0
  156. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/testdata/requests/mixer_parameters.json +0 -0
  157. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/testdata/requests/set_ecomax_parameter.json +0 -0
  158. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/testdata/requests/set_mixer_parameter.json +0 -0
  159. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/testdata/requests/set_schedule.json +0 -0
  160. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/testdata/requests/set_thermostat_parameter.json +0 -0
  161. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/testdata/requests/thermostat_parameters.json +0 -0
  162. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/testdata/responses/alerts.json +0 -0
  163. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/testdata/responses/device_available.json +0 -0
  164. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/testdata/responses/ecomax_parameters.json +0 -0
  165. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/testdata/responses/mixer_parameters.json +0 -0
  166. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/testdata/responses/password.json +0 -0
  167. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/testdata/responses/program_version.json +0 -0
  168. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/testdata/responses/regulator_data_schema.json +0 -0
  169. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/testdata/responses/schedules.json +0 -0
  170. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/testdata/responses/thermostat_parameters.json +0 -0
  171. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/testdata/responses/uid.json +0 -0
  172. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/testdata/unknown/unknown_ecomax_parameter.json +0 -0
  173. {pyplumio-0.5.52 → pyplumio-0.5.53}/tests/testdata/unknown/unknown_mixer_parameter.json +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyPlumIO
3
- Version: 0.5.52
3
+ Version: 0.5.53
4
4
  Summary: PyPlumIO is a native ecoNET library for Plum ecoMAX controllers.
5
5
  Author-email: Denis Paavilainen <denpa@denpa.pro>
6
6
  License: MIT License
@@ -25,7 +25,7 @@ Description-Content-Type: text/markdown
25
25
  License-File: LICENSE
26
26
  Requires-Dist: dataslots==1.2.0
27
27
  Requires-Dist: pyserial-asyncio==0.6
28
- Requires-Dist: typing-extensions==4.14.0
28
+ Requires-Dist: typing-extensions<5.0,>=4.14.0
29
29
  Provides-Extra: test
30
30
  Requires-Dist: codespell==2.4.1; extra == "test"
31
31
  Requires-Dist: coverage==7.9.1; extra == "test"
@@ -35,8 +35,8 @@ Requires-Dist: numpy<3.0.0,>=2.0.0; extra == "test"
35
35
  Requires-Dist: pyserial-asyncio-fast==0.16; extra == "test"
36
36
  Requires-Dist: pytest==8.4.1; extra == "test"
37
37
  Requires-Dist: pytest-asyncio==1.0.0; extra == "test"
38
- Requires-Dist: ruff==0.11.13; extra == "test"
39
- Requires-Dist: tox==4.26.0; extra == "test"
38
+ Requires-Dist: ruff==0.12.1; extra == "test"
39
+ Requires-Dist: tox==4.27.0; extra == "test"
40
40
  Requires-Dist: types-pyserial==3.5.0.20250326; extra == "test"
41
41
  Provides-Extra: docs
42
42
  Requires-Dist: sphinx==8.1.3; extra == "docs"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyPlumIO
3
- Version: 0.5.52
3
+ Version: 0.5.53
4
4
  Summary: PyPlumIO is a native ecoNET library for Plum ecoMAX controllers.
5
5
  Author-email: Denis Paavilainen <denpa@denpa.pro>
6
6
  License: MIT License
@@ -25,7 +25,7 @@ Description-Content-Type: text/markdown
25
25
  License-File: LICENSE
26
26
  Requires-Dist: dataslots==1.2.0
27
27
  Requires-Dist: pyserial-asyncio==0.6
28
- Requires-Dist: typing-extensions==4.14.0
28
+ Requires-Dist: typing-extensions<5.0,>=4.14.0
29
29
  Provides-Extra: test
30
30
  Requires-Dist: codespell==2.4.1; extra == "test"
31
31
  Requires-Dist: coverage==7.9.1; extra == "test"
@@ -35,8 +35,8 @@ Requires-Dist: numpy<3.0.0,>=2.0.0; extra == "test"
35
35
  Requires-Dist: pyserial-asyncio-fast==0.16; extra == "test"
36
36
  Requires-Dist: pytest==8.4.1; extra == "test"
37
37
  Requires-Dist: pytest-asyncio==1.0.0; extra == "test"
38
- Requires-Dist: ruff==0.11.13; extra == "test"
39
- Requires-Dist: tox==4.26.0; extra == "test"
38
+ Requires-Dist: ruff==0.12.1; extra == "test"
39
+ Requires-Dist: tox==4.27.0; extra == "test"
40
40
  Requires-Dist: types-pyserial==3.5.0.20250326; extra == "test"
41
41
  Provides-Extra: docs
42
42
  Requires-Dist: sphinx==8.1.3; extra == "docs"
@@ -63,7 +63,6 @@ pyplumio/helpers/async_cache.py
63
63
  pyplumio/helpers/event_manager.py
64
64
  pyplumio/helpers/factory.py
65
65
  pyplumio/helpers/task_manager.py
66
- pyplumio/helpers/timeout.py
67
66
  pyplumio/parameters/__init__.py
68
67
  pyplumio/parameters/ecomax.py
69
68
  pyplumio/parameters/mixer.py
@@ -122,7 +121,6 @@ tests/helpers/test_async_cache.py
122
121
  tests/helpers/test_event_manager.py
123
122
  tests/helpers/test_factory.py
124
123
  tests/helpers/test_task_manager.py
125
- tests/helpers/test_timeout.py
126
124
  tests/helpers/test_uid.py
127
125
  tests/parameters/__init__.py
128
126
  tests/parameters/test_ecomax.py
@@ -1,6 +1,6 @@
1
1
  dataslots==1.2.0
2
2
  pyserial-asyncio==0.6
3
- typing-extensions==4.14.0
3
+ typing-extensions<5.0,>=4.14.0
4
4
 
5
5
  [dev]
6
6
  pyplumio[docs,test]
@@ -21,6 +21,6 @@ numpy<3.0.0,>=2.0.0
21
21
  pyserial-asyncio-fast==0.16
22
22
  pytest==8.4.1
23
23
  pytest-asyncio==1.0.0
24
- ruff==0.11.13
25
- tox==4.26.0
24
+ ruff==0.12.1
25
+ tox==4.27.0
26
26
  types-pyserial==3.5.0.20250326
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '0.5.52'
21
- __version_tuple__ = version_tuple = (0, 5, 52)
20
+ __version__ = version = '0.5.53'
21
+ __version_tuple__ = version_tuple = (0, 5, 53)
@@ -11,8 +11,8 @@ from serial import EIGHTBITS, PARITY_NONE, STOPBITS_ONE
11
11
 
12
12
  from pyplumio.exceptions import ConnectionFailedError
13
13
  from pyplumio.helpers.task_manager import TaskManager
14
- from pyplumio.helpers.timeout import timeout
15
14
  from pyplumio.protocol import AsyncProtocol, Protocol
15
+ from pyplumio.utils import timeout
16
16
 
17
17
  _LOGGER = logging.getLogger(__name__)
18
18
 
@@ -33,6 +33,13 @@ class DataType(ABC, Generic[T]):
33
33
 
34
34
  return f"{self.__class__.__name__}()"
35
35
 
36
+ def __hash__(self) -> int:
37
+ """Return a hash of the data type based on its value."""
38
+ if hasattr(self, "_value"):
39
+ return hash(self._value)
40
+
41
+ return hash(type(self))
42
+
36
43
  def __eq__(self, other: object) -> bool:
37
44
  """Compare if this data type is equal to other."""
38
45
  if (
@@ -56,6 +56,9 @@ class SupportsComparison(Protocol):
56
56
 
57
57
  __slots__ = ()
58
58
 
59
+ def __hash__(self) -> int:
60
+ """Return a hash of the value."""
61
+
59
62
  def __eq__(self: SupportsComparison, other: SupportsComparison) -> bool:
60
63
  """Compare a value."""
61
64
 
@@ -130,6 +133,10 @@ class Filter(ABC):
130
133
  self._callback = callback
131
134
  self._value = UNDEFINED
132
135
 
136
+ def __hash__(self) -> int:
137
+ """Return a hash of the filter based on its callback."""
138
+ return hash(self._callback)
139
+
133
140
  def __eq__(self, other: Any) -> bool:
134
141
  """Compare callbacks."""
135
142
  if isinstance(other, Filter):
@@ -114,6 +114,19 @@ class Frame(ABC):
114
114
  self._data = data if not kwargs else ensure_dict(data, kwargs)
115
115
  self._message = message
116
116
 
117
+ def __hash__(self) -> int:
118
+ """Return a hash of the frame based on its values."""
119
+ return hash(
120
+ (
121
+ self.recipient,
122
+ self.sender,
123
+ self.econet_type,
124
+ self.econet_version,
125
+ self._message,
126
+ frozenset(self._data.items()) if self._data else None,
127
+ )
128
+ )
129
+
117
130
  def __eq__(self, other: object) -> bool:
118
131
  """Compare if this frame is equal to other."""
119
132
  if isinstance(other, Frame):
@@ -5,7 +5,7 @@ from __future__ import annotations
5
5
  from abc import ABC, abstractmethod
6
6
  import asyncio
7
7
  from contextlib import suppress
8
- from dataclasses import dataclass
8
+ from dataclasses import asdict, dataclass
9
9
  import logging
10
10
  from typing import TYPE_CHECKING, Any, Literal, TypeVar, Union, get_args
11
11
 
@@ -115,6 +115,10 @@ class Parameter(ABC):
115
115
  f"index={self._index})"
116
116
  )
117
117
 
118
+ def __hash__(self) -> int:
119
+ """Return a hash of the parameter based on its values."""
120
+ return hash(frozenset(asdict(self.values).items()))
121
+
118
122
  def _call_relational_method(self, method_to_call: str, other: Any) -> Any:
119
123
  """Call a specified relational method."""
120
124
  if isinstance(other, Parameter):
@@ -20,7 +20,7 @@ from pyplumio.frames import (
20
20
  bcc,
21
21
  struct_header,
22
22
  )
23
- from pyplumio.helpers.timeout import timeout
23
+ from pyplumio.utils import timeout
24
24
 
25
25
  READER_TIMEOUT: Final = 10
26
26
  WRITER_TIMEOUT: Final = 10
@@ -67,7 +67,7 @@ class FrameWriter:
67
67
  await self._writer.wait_closed()
68
68
 
69
69
 
70
- class BufferManager:
70
+ class BufferedReader:
71
71
  """Represents a buffered reader for reading frames."""
72
72
 
73
73
  __slots__ = ("_buffer", "_reader")
@@ -89,7 +89,7 @@ class BufferManager:
89
89
  try:
90
90
  data = await self._reader.readexactly(bytes_to_read)
91
91
  self._buffer.extend(data)
92
- self.trim_to(size)
92
+ self.trim_to(DEFAULT_BUFFER_SIZE)
93
93
  except IncompleteReadError as e:
94
94
  raise ReadError(
95
95
  f"Incomplete read. Tried to read {bytes_to_read} additional bytes "
@@ -104,22 +104,36 @@ class BufferManager:
104
104
  f"Serial connection broken while trying to ensure {size} bytes: {e}"
105
105
  ) from e
106
106
 
107
+ async def peek(self, size: int) -> bytes:
108
+ """Read the specified number of bytes without consuming them."""
109
+ await self.ensure_buffer(size)
110
+ return memoryview(self._buffer)[:size].tobytes()
111
+
107
112
  async def consume(self, size: int) -> None:
108
113
  """Consume the specified number of bytes from the buffer."""
109
114
  await self.ensure_buffer(size)
110
115
  self._buffer = self._buffer[size:]
111
116
 
112
- async def peek(self, size: int) -> bytearray:
113
- """Read the specified number of bytes without consuming them."""
114
- await self.ensure_buffer(size)
115
- return self._buffer[:size]
116
-
117
- async def read(self, size: int) -> bytearray:
118
- """Read the bytes from buffer or stream and consume them."""
117
+ async def read_into_buffer(self, size: int) -> None:
118
+ """Read the specified number of bytes from the stream."""
119
119
  try:
120
- return await self.peek(size)
121
- finally:
122
- await self.consume(size)
120
+ chunk = await self._reader.read(size)
121
+ except asyncio.CancelledError:
122
+ _LOGGER.debug("Read operation cancelled while filling internal buffer.")
123
+ raise
124
+ except Exception as e:
125
+ raise OSError(
126
+ f"Serial connection broken while filling internal buffer: {e}"
127
+ ) from e
128
+
129
+ if not chunk:
130
+ _LOGGER.debug("Stream ended while filling internal buffer.")
131
+ raise OSError(
132
+ "Serial connection broken: stream ended while filling internal buffer"
133
+ )
134
+
135
+ self._buffer.extend(chunk)
136
+ self.trim_to(DEFAULT_BUFFER_SIZE)
123
137
 
124
138
  def seek_to(self, delimiter: SupportsIndex) -> bool:
125
139
  """Trim the buffer to the first occurrence of the delimiter.
@@ -137,27 +151,6 @@ class BufferManager:
137
151
  if len(self._buffer) > size:
138
152
  self._buffer = self._buffer[-size:]
139
153
 
140
- async def fill(self) -> None:
141
- """Fill the buffer with data from the stream."""
142
- try:
143
- chunk = await self._reader.read(MAX_FRAME_LENGTH)
144
- except asyncio.CancelledError:
145
- _LOGGER.debug("Read operation cancelled while filling read buffer.")
146
- raise
147
- except Exception as e:
148
- raise OSError(
149
- f"Serial connection broken while filling read buffer: {e}"
150
- ) from e
151
-
152
- if not chunk:
153
- _LOGGER.debug("Stream ended while filling read buffer.")
154
- raise OSError(
155
- "Serial connection broken: stream ended while filling read buffer"
156
- )
157
-
158
- self._buffer.extend(chunk)
159
- self.trim_to(DEFAULT_BUFFER_SIZE)
160
-
161
154
  @property
162
155
  def buffer(self) -> bytearray:
163
156
  """Return the internal buffer."""
@@ -177,22 +170,23 @@ class Header(NamedTuple):
177
170
  class FrameReader:
178
171
  """Represents a frame reader."""
179
172
 
180
- __slots__ = ("_buffer",)
173
+ __slots__ = ("_reader",)
181
174
 
182
- _buffer: BufferManager
175
+ _reader: BufferedReader
183
176
 
184
177
  def __init__(self, reader: StreamReader) -> None:
185
178
  """Initialize a new frame reader."""
186
- self._buffer = BufferManager(reader)
179
+ self._reader = BufferedReader(reader)
187
180
 
188
181
  async def _read_header(self) -> Header:
189
182
  """Locate and read a frame header."""
190
183
  while True:
191
- if self._buffer.seek_to(FRAME_START):
192
- header_bytes = await self._buffer.peek(HEADER_SIZE)
193
- return Header(*struct_header.unpack_from(header_bytes)[DELIMITER_SIZE:])
184
+ if self._reader.seek_to(FRAME_START):
185
+ header_bytes = await self._reader.peek(HEADER_SIZE)
186
+ header_fields = struct_header.unpack_from(header_bytes)
187
+ return Header(*header_fields[DELIMITER_SIZE:])
194
188
 
195
- await self._buffer.fill()
189
+ await self._reader.read_into_buffer(MAX_FRAME_LENGTH)
196
190
 
197
191
  @timeout(READER_TIMEOUT)
198
192
  async def read(self) -> Frame | None:
@@ -201,22 +195,22 @@ class FrameReader:
201
195
  frame_length, recipient, sender, econet_type, econet_version = header
202
196
 
203
197
  if frame_length > MAX_FRAME_LENGTH or frame_length < MIN_FRAME_LENGTH:
204
- await self._buffer.consume(HEADER_SIZE)
198
+ await self._reader.consume(HEADER_SIZE)
205
199
  raise ReadError(
206
200
  f"Unexpected frame length ({frame_length}), expected between "
207
201
  f"{MIN_FRAME_LENGTH} and {MAX_FRAME_LENGTH}"
208
202
  )
209
203
 
210
- frame_bytes = await self._buffer.peek(frame_length)
204
+ frame_bytes = await self._reader.peek(frame_length)
211
205
  checksum = bcc(frame_bytes[:BCC_INDEX])
212
206
  if checksum != frame_bytes[BCC_INDEX]:
213
- await self._buffer.consume(HEADER_SIZE)
207
+ await self._reader.consume(HEADER_SIZE)
214
208
  raise ChecksumError(
215
209
  f"Incorrect frame checksum: calculated {checksum}, "
216
210
  f"expected {frame_bytes[BCC_INDEX]}. Frame data: {frame_bytes.hex()}"
217
211
  )
218
212
 
219
- await self._buffer.consume(frame_length)
213
+ await self._reader.consume(frame_length)
220
214
  if recipient not in (DeviceType.ECONET, DeviceType.ALL):
221
215
  _LOGGER.debug(
222
216
  "Skipping frame intended for different recipient (%s)", recipient
@@ -2,9 +2,13 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from collections.abc import Mapping
5
+ import asyncio
6
+ from collections.abc import Awaitable, Callable, Mapping
7
+ from functools import wraps
6
8
  from typing import TypeVar
7
9
 
10
+ from typing_extensions import ParamSpec
11
+
8
12
  KT = TypeVar("KT") # Key type.
9
13
  VT = TypeVar("VT") # Value type.
10
14
 
@@ -40,4 +44,24 @@ def is_divisible(a: float, b: float, precision: int = 6) -> bool:
40
44
  return a_scaled % b_scaled == 0
41
45
 
42
46
 
43
- __all__ = ["ensure_dict", "is_divisible", "to_camelcase"]
47
+ T = TypeVar("T")
48
+ P = ParamSpec("P")
49
+
50
+
51
+ def timeout(
52
+ seconds: float,
53
+ ) -> Callable[[Callable[P, Awaitable[T]]], Callable[P, Awaitable[T]]]:
54
+ """Decorate a timeout for the awaitable."""
55
+
56
+ def decorator(func: Callable[P, Awaitable[T]]) -> Callable[P, Awaitable[T]]:
57
+ @wraps(func)
58
+ async def wrapper(*args: P.args, **kwargs: P.kwargs) -> T:
59
+ return await asyncio.wait_for(func(*args, **kwargs), timeout=seconds)
60
+
61
+ setattr(wrapper, "_has_timeout_seconds", seconds)
62
+ return wrapper
63
+
64
+ return decorator
65
+
66
+
67
+ __all__ = ["ensure_dict", "is_divisible", "to_camelcase", "timeout"]
@@ -26,7 +26,7 @@ classifiers = [
26
26
  dependencies = [
27
27
  "dataslots==1.2.0",
28
28
  "pyserial-asyncio==0.6",
29
- "typing-extensions==4.14.0"
29
+ "typing-extensions>=4.14.0,<5.0"
30
30
  ]
31
31
  dynamic = ["version"]
32
32
 
@@ -45,8 +45,8 @@ test = [
45
45
  "pyserial-asyncio-fast==0.16",
46
46
  "pytest==8.4.1",
47
47
  "pytest-asyncio==1.0.0",
48
- "ruff==0.11.13",
49
- "tox==4.26.0",
48
+ "ruff==0.12.1",
49
+ "tox==4.27.0",
50
50
  "types-pyserial==3.5.0.20250326"
51
51
  ]
52
52
  docs = [
@@ -1,3 +1,3 @@
1
1
  dataslots==1.2.0
2
2
  pyserial-asyncio==0.6
3
- typing-extensions==4.14.0
3
+ typing-extensions>=4.14.0,<5.0
@@ -7,7 +7,7 @@ pre-commit==4.2.0
7
7
  pyserial-asyncio-fast==0.16
8
8
  pytest-asyncio==1.0.0
9
9
  pytest==8.4.1
10
- ruff==0.11.13
10
+ ruff==0.12.1
11
11
  tomli==2.2.1
12
- tox==4.26.0
12
+ tox==4.27.0
13
13
  types-pyserial==3.5.0.20250326
@@ -139,6 +139,15 @@ class TestParameter:
139
139
  assert result == 6
140
140
  assert isinstance(result, int)
141
141
 
142
+ def test_hash(self, parameter: Parameter) -> None:
143
+ """Test __hash__.
144
+
145
+ Checks parameter hashing.
146
+ """
147
+ assert hash(parameter) == hash(
148
+ frozenset({("value", 6), ("min_value", 0), ("max_value", 10)})
149
+ )
150
+
142
151
  @pytest.mark.parametrize(
143
152
  ("func_name", "other", "expected_result", "expected_type"),
144
153
  [
@@ -6,22 +6,21 @@ from asyncio import StreamReader, StreamWriter
6
6
  from importlib import reload
7
7
  import logging
8
8
  import sys
9
- from typing import Final
9
+ from typing import Any, Final
10
10
  from unittest.mock import AsyncMock, Mock, patch
11
11
 
12
12
  import pytest
13
13
  from serial import EIGHTBITS, PARITY_NONE, STOPBITS_ONE
14
14
 
15
+ import pyplumio.connection
15
16
  from pyplumio.connection import Connection, SerialConnection, TcpConnection
16
17
  from pyplumio.exceptions import ConnectionFailedError
17
18
  from pyplumio.protocol import Protocol
18
19
 
19
20
 
20
21
  @pytest.fixture(name="use_fast", params=(True, False))
21
- def fixture_use_fast(request, monkeypatch, caplog):
22
+ def fixture_use_fast(request, monkeypatch, caplog) -> Any:
22
23
  """Try with and without serial-asyncio-fast package."""
23
- import pyplumio.connection
24
-
25
24
  if not request.param:
26
25
  monkeypatch.setitem(sys.modules, "serial_asyncio_fast", None)
27
26
 
@@ -47,6 +47,7 @@ def test_data_type(
47
47
 
48
48
  assert data_type.size == len(buffer)
49
49
  assert data_type.to_bytes() == buffer
50
+ assert hash(data_type) == hash(expected)
50
51
  assert repr(data_type) == f"{cls.__qualname__}(value={expected})"
51
52
 
52
53
  if not isinstance(
@@ -56,6 +57,12 @@ def test_data_type(
56
57
  assert cls().__eq__(UNDEFINED) is NotImplemented
57
58
 
58
59
 
60
+ def test_hash_no_value() -> None:
61
+ """Test data type hash with no value."""
62
+ undefined = data_types.Undefined()
63
+ assert hash(undefined) == hash(type(undefined))
64
+
65
+
59
66
  def test_bitarray() -> None:
60
67
  """Test a bit array data type."""
61
68
  buffer = bytearray([0x55])
@@ -45,6 +45,7 @@ async def test_clamp(input_value, expected) -> None:
45
45
  """Test the clamp filter."""
46
46
  test_callback = AsyncMock()
47
47
  wrapped_callback = filters.clamp(test_callback, min_value=10, max_value=15)
48
+ assert hash(wrapped_callback) == hash(test_callback)
48
49
  await wrapped_callback(input_value)
49
50
  test_callback.assert_awaited_once_with(expected)
50
51
 
@@ -53,6 +54,7 @@ async def test_deadband() -> None:
53
54
  """Test the deadband filter."""
54
55
  test_callback = AsyncMock()
55
56
  wrapped_callback = filters.deadband(test_callback, tolerance=0.1)
57
+ assert hash(wrapped_callback) == hash(test_callback)
56
58
  await wrapped_callback(1)
57
59
  test_callback.assert_awaited_once_with(1)
58
60
  test_callback.reset_mock()
@@ -73,6 +75,7 @@ async def test_on_change() -> None:
73
75
  """Test the value changed filter."""
74
76
  test_callback = AsyncMock()
75
77
  wrapped_callback = filters.on_change(test_callback)
78
+ assert hash(wrapped_callback) == hash(test_callback)
76
79
  await wrapped_callback(1)
77
80
  test_callback.assert_awaited_once_with(1)
78
81
  test_callback.reset_mock()
@@ -93,6 +96,7 @@ async def test_on_change_parameter() -> None:
93
96
  test_parameter.values = ParameterValues(0, 0, 1)
94
97
  test_parameter.update_pending.is_set = Mock(return_value=False)
95
98
  wrapped_callback = filters.on_change(test_callback)
99
+ assert hash(wrapped_callback) == hash(test_callback)
96
100
  await wrapped_callback(test_parameter)
97
101
  test_callback.assert_awaited_once_with(test_parameter)
98
102
  test_callback.reset_mock()
@@ -130,6 +134,7 @@ async def test_debounce() -> None:
130
134
  """Test the debounce filter."""
131
135
  test_callback = AsyncMock()
132
136
  wrapped_callback = filters.debounce(test_callback, min_calls=3)
137
+ assert hash(wrapped_callback) == hash(test_callback)
133
138
  await wrapped_callback(1)
134
139
  test_callback.assert_awaited_once_with(1)
135
140
  test_callback.reset_mock()
@@ -147,6 +152,7 @@ async def test_throttle(frozen_time) -> None:
147
152
  """Test the throttle filter."""
148
153
  test_callback = AsyncMock()
149
154
  wrapped_callback = filters.throttle(test_callback, seconds=5)
155
+ assert hash(wrapped_callback) == hash(test_callback)
150
156
  await wrapped_callback(1)
151
157
  test_callback.assert_awaited_once_with(1)
152
158
  test_callback.reset_mock()
@@ -172,6 +178,7 @@ async def test_delta() -> None:
172
178
  """Test the delta filter."""
173
179
  test_callback = AsyncMock()
174
180
  wrapped_callback = filters.delta(test_callback)
181
+ assert hash(wrapped_callback) == hash(test_callback)
175
182
 
176
183
  await wrapped_callback(5)
177
184
  test_callback.assert_not_awaited()
@@ -201,6 +208,7 @@ async def test_aggregate(use_numpy, frozen_time) -> None:
201
208
  """Test the aggregate filter."""
202
209
  test_callback = AsyncMock()
203
210
  wrapped_callback = filters.aggregate(test_callback, seconds=5, sample_size=5)
211
+ assert hash(wrapped_callback) == hash(test_callback)
204
212
  await wrapped_callback(1)
205
213
  test_callback.assert_not_awaited()
206
214
 
@@ -236,6 +244,7 @@ async def test_aggregate_sample_size(frozen_time) -> None:
236
244
  """Test the aggregate filter with sample size."""
237
245
  test_callback = AsyncMock()
238
246
  wrapped_callback = filters.aggregate(test_callback, seconds=5, sample_size=2)
247
+ assert hash(wrapped_callback) == hash(test_callback)
239
248
 
240
249
  # Zero seconds passed, current sample size is 1.
241
250
  await wrapped_callback(1)
@@ -264,6 +273,7 @@ async def test_custom(filter_func, input_value, callback) -> None:
264
273
  """Test the custom filter."""
265
274
  test_callback = AsyncMock()
266
275
  wrapped_callback = filters.custom(test_callback, filter_func)
276
+ assert hash(wrapped_callback) == hash(test_callback)
267
277
  await wrapped_callback(input_value)
268
278
 
269
279
  if callback: