egauge-python 0.9.1__tar.gz → 0.9.2__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 (49) hide show
  1. {egauge-python-0.9.1 → egauge-python-0.9.2}/PKG-INFO +11 -1
  2. {egauge-python-0.9.1 → egauge-python-0.9.2}/README.md +9 -0
  3. egauge-python-0.9.2/egauge/ctid/__init__.py +7 -0
  4. {egauge-python-0.9.1 → egauge-python-0.9.2}/egauge/ctid/ctid.py +25 -25
  5. {egauge-python-0.9.1 → egauge-python-0.9.2}/egauge/examples/test_register.py +7 -15
  6. {egauge-python-0.9.1 → egauge-python-0.9.2}/egauge/webapi/device/ctid_info.py +6 -5
  7. {egauge-python-0.9.1 → egauge-python-0.9.2}/egauge/webapi/device/register.py +5 -7
  8. {egauge-python-0.9.1 → egauge-python-0.9.2}/egauge_python.egg-info/PKG-INFO +11 -1
  9. {egauge-python-0.9.1 → egauge-python-0.9.2}/egauge_python.egg-info/requires.txt +3 -3
  10. {egauge-python-0.9.1 → egauge-python-0.9.2}/egauge_python.egg-info/top_level.txt +1 -0
  11. {egauge-python-0.9.1 → egauge-python-0.9.2}/setup.py +5 -4
  12. egauge-python-0.9.1/egauge/ctid/__init__.py +0 -4
  13. {egauge-python-0.9.1 → egauge-python-0.9.2}/LICENSE +0 -0
  14. {egauge-python-0.9.1 → egauge-python-0.9.2}/egauge/ctid/bit_stuffer.py +0 -0
  15. {egauge-python-0.9.1 → egauge-python-0.9.2}/egauge/ctid/encoder.py +0 -0
  16. {egauge-python-0.9.1 → egauge-python-0.9.2}/egauge/ctid/intel_hex_encoder.py +0 -0
  17. {egauge-python-0.9.1 → egauge-python-0.9.2}/egauge/ctid/waveform.py +0 -0
  18. {egauge-python-0.9.1 → egauge-python-0.9.2}/egauge/examples/data/test-ctid-decoder.raw +0 -0
  19. {egauge-python-0.9.1 → egauge-python-0.9.2}/egauge/examples/test_capture.py +0 -0
  20. {egauge-python-0.9.1 → egauge-python-0.9.2}/egauge/examples/test_common.py +0 -0
  21. {egauge-python-0.9.1 → egauge-python-0.9.2}/egauge/examples/test_ctid.py +0 -0
  22. {egauge-python-0.9.1 → egauge-python-0.9.2}/egauge/examples/test_ctid_decoder.py +0 -0
  23. {egauge-python-0.9.1 → egauge-python-0.9.2}/egauge/examples/test_local.py +0 -0
  24. {egauge-python-0.9.1 → egauge-python-0.9.2}/egauge/pyside/__init__.py +0 -0
  25. {egauge-python-0.9.1 → egauge-python-0.9.2}/egauge/pyside/ansi2html.py +0 -0
  26. {egauge-python-0.9.1 → egauge-python-0.9.2}/egauge/pyside/terminal.py +0 -0
  27. {egauge-python-0.9.1 → egauge-python-0.9.2}/egauge/webapi/__init__.py +0 -0
  28. {egauge-python-0.9.1 → egauge-python-0.9.2}/egauge/webapi/auth.py +0 -0
  29. {egauge-python-0.9.1 → egauge-python-0.9.2}/egauge/webapi/cloud/__init__.py +0 -0
  30. {egauge-python-0.9.1 → egauge-python-0.9.2}/egauge/webapi/cloud/credentials.py +0 -0
  31. {egauge-python-0.9.1 → egauge-python-0.9.2}/egauge/webapi/cloud/credentials_dialog.py +0 -0
  32. {egauge-python-0.9.1 → egauge-python-0.9.2}/egauge/webapi/cloud/gui/credentials_dialog.py +0 -0
  33. {egauge-python-0.9.1 → egauge-python-0.9.2}/egauge/webapi/cloud/serial_number.py +0 -0
  34. {egauge-python-0.9.1 → egauge-python-0.9.2}/egauge/webapi/device/__init__.py +0 -0
  35. {egauge-python-0.9.1 → egauge-python-0.9.2}/egauge/webapi/device/capture.py +0 -0
  36. {egauge-python-0.9.1 → egauge-python-0.9.2}/egauge/webapi/device/device.py +0 -0
  37. {egauge-python-0.9.1 → egauge-python-0.9.2}/egauge/webapi/device/local.py +0 -0
  38. {egauge-python-0.9.1 → egauge-python-0.9.2}/egauge/webapi/device/physical_quantity.py +0 -0
  39. {egauge-python-0.9.1 → egauge-python-0.9.2}/egauge/webapi/device/physical_units.py +0 -0
  40. {egauge-python-0.9.1 → egauge-python-0.9.2}/egauge/webapi/device/register_row.py +0 -0
  41. {egauge-python-0.9.1 → egauge-python-0.9.2}/egauge/webapi/device/register_type.py +0 -0
  42. {egauge-python-0.9.1 → egauge-python-0.9.2}/egauge/webapi/device/virtual_register.py +0 -0
  43. {egauge-python-0.9.1 → egauge-python-0.9.2}/egauge/webapi/error.py +0 -0
  44. {egauge-python-0.9.1 → egauge-python-0.9.2}/egauge/webapi/json_api.py +0 -0
  45. {egauge-python-0.9.1 → egauge-python-0.9.2}/egauge_python.egg-info/SOURCES.txt +0 -0
  46. {egauge-python-0.9.1 → egauge-python-0.9.2}/egauge_python.egg-info/dependency_links.txt +0 -0
  47. {egauge-python-0.9.1 → egauge-python-0.9.2}/egauge_python.egg-info/entry_points.txt +0 -0
  48. {egauge-python-0.9.1 → egauge-python-0.9.2}/pyproject.toml +0 -0
  49. {egauge-python-0.9.1 → egauge-python-0.9.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: egauge-python
3
- Version: 0.9.1
3
+ Version: 0.9.2
4
4
  Summary: .
5
5
  Home-page: https://bitbucket.org/egauge/python/
6
6
  Author: David Mosberger-Tang
@@ -16,6 +16,7 @@ Classifier: Programming Language :: Python :: 3.6
16
16
  Requires-Python: >=3.11
17
17
  Description-Content-Type: text/markdown
18
18
  Provides-Extra: examples
19
+ Provides-Extra: pyside
19
20
  License-File: LICENSE
20
21
 
21
22
  # eGauge open source Python code
@@ -27,6 +28,15 @@ Please see LICENSE for details. eGauge Systems LLC reserves the
27
28
  rights to add, modify, or remove code from this repository or the
28
29
  entire repository without notice.
29
30
 
31
+ ## egauge.pyside.terminal Support
32
+
33
+ To use module `egauge.pyside.terminal`, be sure to install the package
34
+ with the `pyside` extra dependencies:
35
+
36
+ ```sh
37
+ pip install egauge-python[pyside]
38
+ ```
39
+
30
40
  ## Example Programs
31
41
 
32
42
  Example programs can be found in the `egauge.examples` module. If you
@@ -7,6 +7,15 @@ Please see LICENSE for details. eGauge Systems LLC reserves the
7
7
  rights to add, modify, or remove code from this repository or the
8
8
  entire repository without notice.
9
9
 
10
+ ## egauge.pyside.terminal Support
11
+
12
+ To use module `egauge.pyside.terminal`, be sure to install the package
13
+ with the `pyside` extra dependencies:
14
+
15
+ ```sh
16
+ pip install egauge-python[pyside]
17
+ ```
18
+
10
19
  ## Example Programs
11
20
 
12
21
  Example programs can be found in the `egauge.examples` module. If you
@@ -0,0 +1,7 @@
1
+ from .bit_stuffer import * # NOQA
2
+ from .ctid import * # NOQA
3
+ from .waveform import * # NOQA
4
+ from .intel_hex_encoder import (
5
+ intel_hex_encode as intel_hex_encode,
6
+ CTID_TABLE_ADDR as CTID_TABLE_ADDR,
7
+ )
@@ -406,35 +406,35 @@ class Table:
406
406
  self.version = CTID_VERSION
407
407
  self.mfg_id = 0
408
408
  self.model = ""
409
- self.serial_number = 0
409
+ self.serial_number: int = 0
410
410
  self.sensor_type = SENSOR_TYPE_AC
411
- self.r_source = 0
412
- self.r_load = 0 # undefined
413
-
414
- self.size = 0
415
- self.rated_current = 0
416
- self.voltage_at_rated_current = 0
417
- self.phase_at_rated_current = 0
418
- self.voltage_temp_coeff = 0
419
- self.phase_temp_coeff = 0
411
+ self.r_source: float = 0
412
+ self.r_load: float = 0 # undefined
413
+
414
+ self.size: float = 0
415
+ self.rated_current: float = 0
416
+ self.voltage_at_rated_current: float = 0
417
+ self.phase_at_rated_current: float = 0
418
+ self.voltage_temp_coeff: float = 0
419
+ self.phase_temp_coeff: float = 0
420
420
  self.cal_table = {1.5: [0, 0], 5: [0, 0], 15: [0, 0], 50: [0, 0]}
421
- self.bias_voltage = 0
421
+ self.bias_voltage: float = 0
422
422
  self.reserved = 0
423
423
  self.mfg_info = 0
424
- self.scale = 0
425
- self.offset = 0
426
- self.delay = 0
427
- self.sensor_unit = 0
428
- self.threshold = 0
429
- self.hysteresis = 0
430
- self.debounce_time = 0
431
- self.edge_mask = 0
432
- self.ntc_a = 0
433
- self.ntc_b = 0
434
- self.ntc_c = 0
435
- self.ntc_m = 0
436
- self.ntc_n = 0
437
- self.ntc_k = 0
424
+ self.scale: float = 0
425
+ self.offset: float = 0
426
+ self.delay: float = 0
427
+ self.sensor_unit: int = 0
428
+ self.threshold: float = 0
429
+ self.hysteresis: float = 0
430
+ self.debounce_time: int = 0
431
+ self.edge_mask: int = 0
432
+ self.ntc_a: float = 0
433
+ self.ntc_b: float = 0
434
+ self.ntc_c: float = 0
435
+ self.ntc_m: float = 0
436
+ self.ntc_n: float = 0
437
+ self.ntc_k: float = 0
438
438
 
439
439
  # internal data:
440
440
  self._raw_data = b""
@@ -15,12 +15,6 @@ Second, it calculates how much the registers have changed since the
15
15
  start of the month and outputs the change both as the accrued value
16
16
  and the average value since the beginning of the month.
17
17
 
18
- Install egauge-python with a command of the form:
19
-
20
- pip install egauge-python[examples]
21
-
22
- to ensure that pytz is installed on your system.
23
-
24
18
  You can set environment variables:
25
19
 
26
20
  EGDEV - the URL of the meter to use (e.g., http://eGaugeXXX.local)
@@ -33,9 +27,7 @@ Alternatively, you can edit examples/test_common.py to suit your needs.
33
27
 
34
28
  import argparse
35
29
  import sys
36
- from datetime import datetime
37
-
38
- import pytz
30
+ from datetime import datetime, timezone
39
31
 
40
32
  from egauge.examples import test_common
41
33
  from egauge.webapi.device import PhysicalQuantity, Register, UnitSystem
@@ -70,9 +62,9 @@ if ts is None:
70
62
  sys.exit(1)
71
63
 
72
64
  # Print the current time of the meter in human-readable form:
73
- dt = datetime.fromtimestamp(round(ts), tz=pytz.utc)
74
- time_str = dt.strftime("%Y-%m-%d %H:%M:%S")
75
- print(f"\nRegister rates as of {time_str} (meter time):")
65
+ dt = datetime.fromtimestamp(round(ts), tz=timezone.utc)
66
+ time_str = dt.strftime("%Y-%m-%d %H:%M:%S %Z")
67
+ print(f"\nRegister rates as of {time_str} (time on the meter):")
76
68
 
77
69
  # Output the register rates, nicely formatted:
78
70
  for regname in ret.regs:
@@ -90,9 +82,9 @@ for regname in ret.regs:
90
82
  # data rows (now and the start of the month):
91
83
  delta = ret[0] - ret[1]
92
84
 
93
- dt = datetime.fromtimestamp(round(ret[1].ts), tz=pytz.utc)
94
- time_str = dt.strftime("%Y-%m-%d %H:%M:%S")
95
- print(f"\nRegister change since {time_str} (start of month in meter time):")
85
+ dt = datetime.fromtimestamp(round(ret[1].ts), tz=timezone.utc)
86
+ time_str = dt.strftime("%Y-%m-%d %H:%M:%S %Z")
87
+ print(f"\nRegister change since {time_str} (start of month on the meter):")
96
88
  print(34 * " " + f"{'Accumulated':18s}" + 14 * " " + "Average")
97
89
 
98
90
  # Output the changes since the start of the month:
@@ -34,6 +34,7 @@ import datetime
34
34
  import os
35
35
  import secrets
36
36
  import time
37
+ from collections.abc import Sequence
37
38
 
38
39
  from egauge import ctid, webapi
39
40
 
@@ -480,7 +481,7 @@ class CTidInfo:
480
481
  port_number, reply.get("polarity"), ctid_info_to_table(reply)
481
482
  )
482
483
 
483
- def put(self, port_info: PortInfo | list[PortInfo]):
484
+ def put(self, port_info: PortInfo | Sequence[PortInfo]):
484
485
  """Store CTid info for a given port to the meter.
485
486
 
486
487
  Note that this only stores the info on the meter - it does not
@@ -495,12 +496,12 @@ class CTidInfo:
495
496
  Raises CTidInfoError on errors.
496
497
 
497
498
  """
498
- if isinstance(port_info, list):
499
- resource = "/ctid"
500
- data = {"info": [pi.as_dict() for pi in port_info]}
501
- else:
499
+ if isinstance(port_info, PortInfo):
502
500
  resource = f"/ctid/{port_info.port}"
503
501
  data = port_info.as_dict()
502
+ else:
503
+ resource = "/ctid"
504
+ data = {"info": [pi.as_dict() for pi in port_info]}
504
505
  reply = self.dev.put(resource, json_data=data)
505
506
  if reply is None:
506
507
  raise CTidInfoError("PUT of CTid info failed.")
@@ -36,6 +36,7 @@ import json
36
36
  from deprecated import deprecated
37
37
 
38
38
  from ..error import Error
39
+ from ..json_api import JSONAPIError
39
40
  from .device import Device
40
41
  from .physical_quantity import PhysicalQuantity
41
42
  from .register_row import RegisterRow
@@ -115,13 +116,10 @@ class Register:
115
116
  reg_ranges = regnames_to_ranges(dev, regs)
116
117
  if reg_ranges is not None:
117
118
  params["reg"] = reg_ranges
118
- self.raw = self.dev.get("/register", params=params, **kwargs)
119
- if self.raw is None:
120
- raise RegisterError("Failed to read register data.", params)
121
- if "error" in self.raw:
122
- raise RegisterError(
123
- "Error reading register data.", self.raw["error"]
124
- )
119
+ try:
120
+ self.raw = self.dev.get("/register", params=params, **kwargs)
121
+ except JSONAPIError as e:
122
+ raise RegisterError("failed to read registers: {e}", params) from e
125
123
 
126
124
  def _create_regorder(self) -> dict[str, int]:
127
125
  """Create a dictionary mapping a register name to the index
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: egauge-python
3
- Version: 0.9.1
3
+ Version: 0.9.2
4
4
  Summary: .
5
5
  Home-page: https://bitbucket.org/egauge/python/
6
6
  Author: David Mosberger-Tang
@@ -16,6 +16,7 @@ Classifier: Programming Language :: Python :: 3.6
16
16
  Requires-Python: >=3.11
17
17
  Description-Content-Type: text/markdown
18
18
  Provides-Extra: examples
19
+ Provides-Extra: pyside
19
20
  License-File: LICENSE
20
21
 
21
22
  # eGauge open source Python code
@@ -27,6 +28,15 @@ Please see LICENSE for details. eGauge Systems LLC reserves the
27
28
  rights to add, modify, or remove code from this repository or the
28
29
  entire repository without notice.
29
30
 
31
+ ## egauge.pyside.terminal Support
32
+
33
+ To use module `egauge.pyside.terminal`, be sure to install the package
34
+ with the `pyside` extra dependencies:
35
+
36
+ ```sh
37
+ pip install egauge-python[pyside]
38
+ ```
39
+
30
40
  ## Example Programs
31
41
 
32
42
  Example programs can be found in the `egauge.examples` module. If you
@@ -1,11 +1,11 @@
1
- PySide6
2
1
  crcmod
3
2
  deprecated
4
3
  intelhex
5
4
  requests>=2.4.2
6
- wheel
7
5
 
8
6
  [examples]
9
7
  matplotlib
10
- pytz
11
8
  readchar
9
+
10
+ [pyside]
11
+ PySide6
@@ -10,17 +10,18 @@ os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
10
10
 
11
11
  setuptools.setup(
12
12
  name="egauge-python",
13
- version="0.9.1",
13
+ version="0.9.2",
14
14
  packages=setuptools.find_namespace_packages(include="egauge.*"),
15
15
  install_requires=[
16
16
  "crcmod",
17
17
  "deprecated",
18
18
  "intelhex",
19
- "wheel",
20
19
  "requests>=2.4.2",
21
- "PySide6",
22
20
  ],
23
- extras_require={"examples": ["matplotlib", "pytz", "readchar"]},
21
+ extras_require={
22
+ "examples": ["matplotlib", "readchar"],
23
+ "pyside": ["PySide6"],
24
+ },
24
25
  include_package_data=True,
25
26
  entry_points={
26
27
  "console_scripts": ["ctid-encoder = egauge.ctid.encoder:main"]
@@ -1,4 +0,0 @@
1
- from .bit_stuffer import * # NOQA
2
- from .ctid import * # NOQA
3
- from .waveform import * # NOQA
4
- from .intel_hex_encoder import intel_hex_encode as intel_hex_encode
File without changes
File without changes