egauge-python 0.7.4__tar.gz → 0.8.0__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 (46) hide show
  1. {egauge-python-0.7.4/egauge_python.egg-info → egauge-python-0.8.0}/PKG-INFO +3 -3
  2. {egauge-python-0.7.4 → egauge-python-0.8.0}/README.md +2 -2
  3. egauge-python-0.8.0/egauge/ctid/__init__.py +3 -0
  4. {egauge-python-0.7.4 → egauge-python-0.8.0}/egauge/ctid/ctid.py +0 -1
  5. {egauge-python-0.7.4/egauge/pyside2 → egauge-python-0.8.0/egauge/pyside}/ansi2html.py +1 -2
  6. {egauge-python-0.7.4/egauge/pyside2 → egauge-python-0.8.0/egauge/pyside}/terminal.py +9 -8
  7. {egauge-python-0.7.4 → egauge-python-0.8.0}/egauge/webapi/__init__.py +4 -4
  8. {egauge-python-0.7.4 → egauge-python-0.8.0}/egauge/webapi/auth.py +0 -2
  9. {egauge-python-0.7.4 → egauge-python-0.8.0}/egauge/webapi/cloud/__init__.py +2 -2
  10. {egauge-python-0.7.4 → egauge-python-0.8.0}/egauge/webapi/cloud/credentials.py +11 -10
  11. {egauge-python-0.7.4 → egauge-python-0.8.0}/egauge/webapi/cloud/gui/credentials_dialog.py +11 -5
  12. {egauge-python-0.7.4 → egauge-python-0.8.0}/egauge/webapi/cloud/serial_number.py +2 -4
  13. {egauge-python-0.7.4 → egauge-python-0.8.0}/egauge/webapi/device/__init__.py +9 -9
  14. {egauge-python-0.7.4 → egauge-python-0.8.0}/egauge/webapi/device/capture.py +3 -4
  15. {egauge-python-0.7.4 → egauge-python-0.8.0}/egauge/webapi/device/ctid_info.py +1 -2
  16. {egauge-python-0.7.4 → egauge-python-0.8.0}/egauge/webapi/device/device.py +26 -1
  17. {egauge-python-0.7.4 → egauge-python-0.8.0}/egauge/webapi/device/local.py +1 -2
  18. {egauge-python-0.7.4 → egauge-python-0.8.0}/egauge/webapi/device/physical_quantity.py +1 -3
  19. {egauge-python-0.7.4 → egauge-python-0.8.0}/egauge/webapi/device/register_row.py +2 -3
  20. {egauge-python-0.7.4 → egauge-python-0.8.0}/egauge/webapi/device/register_type.py +109 -62
  21. {egauge-python-0.7.4 → egauge-python-0.8.0}/egauge/webapi/device/virtual_register.py +2 -4
  22. {egauge-python-0.7.4 → egauge-python-0.8.0}/egauge/webapi/json_api.py +5 -5
  23. {egauge-python-0.7.4 → egauge-python-0.8.0/egauge_python.egg-info}/PKG-INFO +3 -3
  24. {egauge-python-0.7.4 → egauge-python-0.8.0}/egauge_python.egg-info/SOURCES.txt +3 -3
  25. {egauge-python-0.7.4 → egauge-python-0.8.0}/egauge_python.egg-info/requires.txt +2 -2
  26. {egauge-python-0.7.4 → egauge-python-0.8.0}/examples/test_capture.py +2 -3
  27. {egauge-python-0.7.4 → egauge-python-0.8.0}/examples/test_ctid.py +1 -2
  28. {egauge-python-0.7.4 → egauge-python-0.8.0}/examples/test_register.py +2 -4
  29. egauge-python-0.8.0/pyproject.toml +10 -0
  30. {egauge-python-0.7.4 → egauge-python-0.8.0}/setup.py +3 -2
  31. egauge-python-0.7.4/egauge/ctid/__init__.py +0 -3
  32. egauge-python-0.7.4/pyproject.toml +0 -3
  33. {egauge-python-0.7.4 → egauge-python-0.8.0}/LICENSE +0 -0
  34. {egauge-python-0.7.4 → egauge-python-0.8.0}/egauge/ctid/bit_stuffer.py +0 -0
  35. {egauge-python-0.7.4 → egauge-python-0.8.0}/egauge/ctid/encoder.py +0 -0
  36. {egauge-python-0.7.4 → egauge-python-0.8.0}/egauge/ctid/waveform.py +0 -0
  37. {egauge-python-0.7.4/egauge/pyside2 → egauge-python-0.8.0/egauge/pyside}/__init__.py +0 -0
  38. {egauge-python-0.7.4 → egauge-python-0.8.0}/egauge/webapi/device/physical_units.py +0 -0
  39. {egauge-python-0.7.4 → egauge-python-0.8.0}/egauge/webapi/device/register.py +0 -0
  40. {egauge-python-0.7.4 → egauge-python-0.8.0}/egauge/webapi/error.py +0 -0
  41. {egauge-python-0.7.4 → egauge-python-0.8.0}/egauge_python.egg-info/dependency_links.txt +0 -0
  42. {egauge-python-0.7.4 → egauge-python-0.8.0}/egauge_python.egg-info/entry_points.txt +0 -0
  43. {egauge-python-0.7.4 → egauge-python-0.8.0}/egauge_python.egg-info/top_level.txt +0 -0
  44. {egauge-python-0.7.4 → egauge-python-0.8.0}/examples/test_common.py +0 -0
  45. {egauge-python-0.7.4 → egauge-python-0.8.0}/examples/test_local.py +0 -0
  46. {egauge-python-0.7.4 → egauge-python-0.8.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: egauge-python
3
- Version: 0.7.4
3
+ Version: 0.8.0
4
4
  Summary: .
5
5
  Home-page: https://bitbucket.org/egauge/python/
6
6
  Author: David Mosberger-Tang
@@ -69,9 +69,9 @@ The classes in this module support manufacturing CTid® sensors. CTid®
69
69
  is patented technology and shall be used in accordance with the
70
70
  licensing agreements governing its use.
71
71
 
72
- ### egauge.pyside2
72
+ ### egauge.pyside
73
73
 
74
- The classes in this module support QT5-based graphical
74
+ The classes in this module support QT6-based graphical
75
75
  user-interfaces.
76
76
 
77
77
  ## Source Code Conventions
@@ -49,9 +49,9 @@ The classes in this module support manufacturing CTid® sensors. CTid®
49
49
  is patented technology and shall be used in accordance with the
50
50
  licensing agreements governing its use.
51
51
 
52
- ### egauge.pyside2
52
+ ### egauge.pyside
53
53
 
54
- The classes in this module support QT5-based graphical
54
+ The classes in this module support QT6-based graphical
55
55
  user-interfaces.
56
56
 
57
57
  ## Source Code Conventions
@@ -0,0 +1,3 @@
1
+ from .bit_stuffer import * # NOQA
2
+ from .ctid import * # NOQA
3
+ from .waveform import * # NOQA
@@ -35,7 +35,6 @@ import crcmod
35
35
 
36
36
  from .bit_stuffer import BitStuffer
37
37
 
38
-
39
38
  CTID_VERSION = 5 # latest version of CTid Specification this code supports
40
39
  START_SYM = 0xFF
41
40
 
@@ -40,9 +40,8 @@
40
40
  ESC [ 41 m: Background-color red.
41
41
  ESC [ 32 m: Foreground-color red.
42
42
  """
43
- import re
44
-
45
43
  import html
44
+ import re
46
45
 
47
46
  HTML_STYLE = {
48
47
  1: "font-weight:bold",
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright (c) 2014, 2016-2017, 2020 eGauge Systems LLC
2
+ # Copyright (c) 2014, 2016-2017, 2020, 2024 eGauge Systems LLC
3
3
  # 1644 Conestoga St, Suite 2
4
4
  # Boulder, CO 80301
5
5
  # voice: 720-545-9767
@@ -31,8 +31,8 @@
31
31
 
32
32
  import re
33
33
 
34
- from PySide2.QtWidgets import QApplication
35
- from PySide2.QtGui import QCursor, QTextCursor
34
+ from PySide6.QtGui import QCursor, QTextCursor
35
+ from PySide6.QtWidgets import QApplication
36
36
 
37
37
  from . import ansi2html
38
38
 
@@ -184,9 +184,10 @@ if __name__ == "__main__":
184
184
  test_incomplete_ansi_csi("s") # save cursor position
185
185
 
186
186
  import sys
187
- from PySide2 import QtCore, QtWidgets
188
- from PySide2.QtCore import Qt, QBasicTimer
189
- from PySide2.QtWidgets import QApplication, QMainWindow, QMessageBox
187
+
188
+ from PySide6 import QtCore, QtWidgets
189
+ from PySide6.QtCore import QBasicTimer
190
+ from PySide6.QtWidgets import QApplication, QMainWindow
190
191
 
191
192
  class Ui_MainWindow:
192
193
  def setupUi(self, MainWindow):
@@ -213,7 +214,7 @@ if __name__ == "__main__":
213
214
  QtWidgets.QPlainTextEdit.WidgetWidth
214
215
  )
215
216
  self.plainTextEdit.setReadOnly(True)
216
- self.plainTextEdit.setTabStopWidth(80)
217
+ self.plainTextEdit.setTabStopDistance(80)
217
218
  self.plainTextEdit.setCursorWidth(16)
218
219
  self.plainTextEdit.setBackgroundVisible(False)
219
220
  self.plainTextEdit.setCenterOnScroll(False)
@@ -281,4 +282,4 @@ if __name__ == "__main__":
281
282
  window = QMainWindow()
282
283
  ui = UI()
283
284
  window.show()
284
- sys.exit(app.exec_())
285
+ sys.exit(app.exec())
@@ -27,7 +27,7 @@
27
27
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
28
28
  # THE SOFTWARE.
29
29
  #
30
- from .auth import *
31
- from .error import *
32
- from . import cloud
33
- from . import device
30
+ from .auth import * # NOQA
31
+ from .error import * # NOQA
32
+ from . import cloud # NOQA
33
+ from . import device # NOQA
@@ -35,7 +35,6 @@ import hashlib
35
35
  import os
36
36
  import secrets
37
37
  import types
38
-
39
38
  from functools import wraps
40
39
  from urllib.parse import urlparse
41
40
 
@@ -43,7 +42,6 @@ import requests
43
42
 
44
43
  from . import json_api
45
44
 
46
-
47
45
  # The name of the optional environment variable storing a token:
48
46
  ENV_EGAUGE_API_TOKEN = "EGAUGE_API_TOKEN"
49
47
 
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright (c) 2020 eGauge Systems LLC
2
+ # Copyright (c) 2020, 2024 eGauge Systems LLC
3
3
  # 1644 Conestoga St, Suite 2
4
4
  # Boulder, CO 80301
5
5
  # voice: 720-545-9767
@@ -27,4 +27,4 @@
27
27
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
28
28
  # THE SOFTWARE.
29
29
  #
30
- from .serial_number import *
30
+ from .serial_number import * # NOQA
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env python3
2
2
  #
3
- # Copyright (c) 2021-2022 eGauge Systems LLC
3
+ # Copyright (c) 2021-2022, 2024 eGauge Systems LLC
4
4
  # 1644 Conestoga St, Suite 2
5
5
  # Boulder, CO 80301
6
6
  # voice: 720-545-9767
@@ -23,7 +23,7 @@ from functools import partial
23
23
 
24
24
  import egauge.webapi.cloud.credentials
25
25
 
26
- # this `self' is a Pyside2 Ui_MainWindow:
26
+ # this `self' is a Pyside6 Ui_MainWindow:
27
27
  auth = webapi.auth.TokenAuth(ask=partial(credentials.ask, self))
28
28
  self.sn_api = webapi.cloud.SerialNumber(auth=auth)
29
29
 
@@ -33,12 +33,13 @@ import egauge.webapi.cloud.credentials
33
33
  import getpass
34
34
 
35
35
  try:
36
- from PySide2.QtWidgets import QDialog
36
+ from PySide6.QtWidgets import QDialog
37
+
37
38
  from .gui.credentials_dialog import Ui_Credentials_Dialog
38
39
 
39
- have_pyside2 = True
40
+ have_pyside = True
40
41
  except ModuleNotFoundError:
41
- have_pyside2 = False
42
+ have_pyside = False
42
43
 
43
44
  class QDialog:
44
45
  """Dummy class for use by Credentials_Dialog."""
@@ -58,12 +59,12 @@ class CredentialsManager:
58
59
  should set the previous_login_failed member to False after the
59
60
  credentials have been used successfully.
60
61
 
61
- If GUI_PARENT is not None, it must be the QT5 (PySide2) parent
62
+ If GUI_PARENT is not None, it must be the QT5 (PySide6) parent
62
63
  window to use for the dialog. If it is None, the credentials
63
64
  will be requested via standard I/O (getpass).
64
65
 
65
66
  """
66
- self.parent = gui_parent if have_pyside2 else None
67
+ self.parent = gui_parent if have_pyside else None
67
68
  self.previous_login_failed = False
68
69
 
69
70
  def ask(self):
@@ -75,7 +76,7 @@ class CredentialsManager:
75
76
  """
76
77
  if self.parent:
77
78
  dialog = CredentialsDialog(self.parent, self.previous_login_failed)
78
- dialog.exec_()
79
+ dialog.exec()
79
80
  if not dialog.accepted:
80
81
  raise LoginCanceled()
81
82
  self.previous_login_failed = True
@@ -107,9 +108,9 @@ class CredentialsDialog(QDialog, Ui_Credentials_Dialog):
107
108
  self.prompt_label.setText(prompt)
108
109
  self.username_lineEdit.setFocus()
109
110
 
110
- def exec_(self):
111
+ def exec(self):
111
112
  self.accepted = False
112
- super().exec_()
113
+ super().exec()
113
114
 
114
115
  def accept(self):
115
116
  super().accept()
@@ -3,15 +3,21 @@
3
3
  ################################################################################
4
4
  ## Form generated from reading UI file 'credentials_dialog.ui'
5
5
  ##
6
- ## Created by: Qt User Interface Compiler version 5.15.2
6
+ ## Created by: Qt User Interface Compiler version 6.7.2
7
7
  ##
8
8
  ## WARNING! All changes made in this file will be lost when recompiling UI file!
9
9
  ################################################################################
10
10
 
11
- from PySide2.QtCore import *
12
- from PySide2.QtGui import *
13
- from PySide2.QtWidgets import *
14
-
11
+ from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
12
+ QMetaObject, QObject, QPoint, QRect,
13
+ QSize, QTime, QUrl, Qt)
14
+ from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
15
+ QFont, QFontDatabase, QGradient, QIcon,
16
+ QImage, QKeySequence, QLinearGradient, QPainter,
17
+ QPalette, QPixmap, QRadialGradient, QTransform)
18
+ from PySide6.QtWidgets import (QAbstractButton, QApplication, QDialog, QDialogButtonBox,
19
+ QGridLayout, QLabel, QLineEdit, QSizePolicy,
20
+ QVBoxLayout, QWidget)
15
21
 
16
22
  class Ui_Credentials_Dialog(object):
17
23
  def setupUi(self, Credentials_Dialog):
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright (c) 2020 eGauge Systems LLC
2
+ # Copyright (c) 2020, 2024 eGauge Systems LLC
3
3
  # 1644 Conestoga St, Suite 2
4
4
  # Boulder, CO 80301
5
5
  # voice: 720-545-9767
@@ -32,11 +32,9 @@
32
32
 
33
33
  """
34
34
  import logging
35
-
36
35
  import urllib.parse
37
36
 
38
37
  from .. import json_api
39
-
40
38
  from ..error import Error
41
39
 
42
40
  log = logging.getLogger(__name__)
@@ -101,7 +99,7 @@ class SerialNumber:
101
99
  reply = self._post("models/allocate/", json_data=data)
102
100
  if reply is None:
103
101
  raise SerialNumberError("POST to allocate SN failed.", model_name)
104
- if not "serial" in reply:
102
+ if "serial" not in reply:
105
103
  log.error(
106
104
  "Failed to allocate SN: model=%s, reply=%s.", model_name, reply
107
105
  )
@@ -27,12 +27,12 @@
27
27
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
28
28
  # THE SOFTWARE.
29
29
  #
30
- from .capture import *
31
- from .ctid_info import *
32
- from .device import *
33
- from .local import *
34
- from .physical_quantity import *
35
- from .physical_units import *
36
- from .register import *
37
- from .register_row import *
38
- from .virtual_register import *
30
+ from .capture import * # NOQA
31
+ from .ctid_info import * # NOQA
32
+ from .device import * # NOQA
33
+ from .local import * # NOQA
34
+ from .physical_quantity import * # NOQA
35
+ from .physical_units import * # NOQA
36
+ from .register import * # NOQA
37
+ from .register_row import * # NOQA
38
+ from .virtual_register import * # NOQA
@@ -29,16 +29,14 @@
29
29
  #
30
30
  """This module provides access to the eGauge WebAPI's /api/capture
31
31
  service."""
32
+ import time
32
33
  from dataclasses import dataclass, field
33
34
  from decimal import Decimal
34
35
  from enum import Enum
35
36
  from typing import Dict, List, Optional, Union
36
37
 
37
- import time
38
-
39
-
40
- from .device import Device
41
38
  from ..error import Error
39
+ from .device import Device
42
40
 
43
41
 
44
42
  class CaptureError(Error):
@@ -331,6 +329,7 @@ class Capture:
331
329
  if ci >= len(channel_names):
332
330
  ci = 0
333
331
  sample_count += 1
332
+ name = channel_names[ci]
334
333
  if cs is None:
335
334
  continue # we're not interested in this channel
336
335
  cs.ts.append(dt)
@@ -35,8 +35,7 @@ import os
35
35
  import secrets
36
36
  import time
37
37
 
38
- from egauge import ctid
39
- from egauge import webapi
38
+ from egauge import ctid, webapi
40
39
 
41
40
  from ..error import Error
42
41
 
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright (c) 2020, 2022-2023 eGauge Systems LLC
2
+ # Copyright (c) 2020, 2022-2024 eGauge Systems LLC
3
3
  # 1644 Conestoga St, Suite 2
4
4
  # Boulder, CO 80301
5
5
  # voice: 720-545-9767
@@ -29,6 +29,7 @@
29
29
  #
30
30
  """Module to provide access to a device's JSON WebAPI."""
31
31
 
32
+ import socket
32
33
  from dataclasses import dataclass
33
34
  from types import SimpleNamespace
34
35
  from typing import List
@@ -63,12 +64,17 @@ class Device:
63
64
  server should be validated against.
64
65
 
65
66
  """
67
+ self.dev_uri = dev_uri
66
68
  self.api_uri = dev_uri + "/api"
67
69
  self.auth = auth
68
70
  self._reg_info = None # cached register info
69
71
  self._chan_info = None # cached channel info
70
72
  self._verify = verify
71
73
 
74
+ def __str__(self) -> str:
75
+ """Returns the URI used to access the device."""
76
+ return self.dev_uri
77
+
72
78
  def get(self, resource, **kwargs):
73
79
  """Issue GET request for /api resource RESOURCE and return the parsed
74
80
  JSON data or None if the request failed or returned invalid
@@ -194,3 +200,22 @@ class Device:
194
200
  """Clear the cached contents for this device."""
195
201
  self._reg_info = None
196
202
  self._chan_info = None
203
+
204
+ def is_up(self, timeout: float = 1) -> bool:
205
+ """Check if the device is up and running.
206
+
207
+ This method attempts to read /sys/time. If a valid response
208
+ is received within the specified timeout, True is returned,
209
+ otherwise False is returned.
210
+
211
+ Keyword arguments:
212
+
213
+ timeout -- The maximum number of seconds to wait for a
214
+ response (default 1).
215
+
216
+ """
217
+ try:
218
+ ret = self.get("/sys/time", timeout=timeout)
219
+ except (json_api.JSONAPIError, socket.error):
220
+ ret = None
221
+ return ret is not None
@@ -30,11 +30,10 @@
30
30
  import decimal
31
31
  import json
32
32
 
33
+ from ..error import Error
33
34
  from .register_row import RegisterRow
34
35
  from .register_type import RegisterType
35
36
 
36
- from ..error import Error
37
-
38
37
 
39
38
  class LocalError(Error):
40
39
  """All errors in this module raise this exception."""
@@ -27,14 +27,12 @@
27
27
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
28
28
  # THE SOFTWARE.
29
29
  #
30
- from typing import List, Union
31
-
32
30
  import re
31
+ from typing import List, Union
33
32
 
34
33
  from .physical_units import PhysicalValue
35
34
  from .register_type import RegisterType, Units, UnitSystem
36
35
 
37
-
38
36
  UNIT_PATTERN = re.compile(r"(.*)/(.*)$")
39
37
 
40
38
 
@@ -34,10 +34,9 @@ import json
34
34
 
35
35
  from deprecated import deprecated
36
36
 
37
- from .register_type import Units
38
- from .physical_quantity import PhysicalQuantity
39
-
40
37
  from ..error import Error
38
+ from .physical_quantity import PhysicalQuantity
39
+ from .register_type import Units
41
40
 
42
41
 
43
42
  class RegRowError(Error):
@@ -8,8 +8,13 @@
8
8
 
9
9
  from enum import Enum
10
10
 
11
- from .physical_units import AlternateUnit, PhysicalUnits, \
12
- PhysicalUnitConversion, PrimaryUnit
11
+ from .physical_units import (
12
+ AlternateUnit,
13
+ PhysicalUnitConversion,
14
+ PhysicalUnits,
15
+ PrimaryUnit,
16
+ )
17
+
13
18
 
14
19
  class UnitSystem(Enum):
15
20
  METRIC = 0
@@ -330,11 +335,11 @@ def _create_units():
330
335
  p31 = PrimaryUnit("A·s")
331
336
  pus.add(p31)
332
337
 
333
- c2 = PhysicalUnitConversion(False,
338
+ c3 = PhysicalUnitConversion(False,
334
339
  lambda x, t=None: (1/3600)*x,
335
340
  lambda x, t=None: 3600*x
336
341
  )
337
- au = AlternateUnit("Ah", p31, c2)
342
+ au = AlternateUnit("Ah", p31, c3)
338
343
  pus.add(au)
339
344
  pus.add_scaled(au, "yAh", 1e+24, "yocto")
340
345
  pus.add_scaled(au, "zAh", 1e+21, "zepto")
@@ -353,41 +358,41 @@ def _create_units():
353
358
  pus.add_scaled(au, "ZAh", 1 / 1e+21, "zetta")
354
359
  pus.add_scaled(au, "YAh", 1 / 1e+24, "yotta")
355
360
 
356
- c9 = PhysicalUnitConversion(False,
361
+ c11 = PhysicalUnitConversion(False,
357
362
  lambda x, t=None: (1/100)*x,
358
363
  lambda x, t=None: 100*x
359
364
  )
360
- au = AlternateUnit("hPa", p24, c9)
365
+ au = AlternateUnit("hPa", p24, c11)
361
366
  pus.add(au)
362
367
 
363
- c10 = PhysicalUnitConversion(False,
368
+ c12 = PhysicalUnitConversion(False,
364
369
  lambda x, t=None: 1.0e-5*x,
365
370
  lambda x, t=None: 100000.0*x
366
371
  )
367
- au = AlternateUnit("bar", p24, c10)
372
+ au = AlternateUnit("bar", p24, c12)
368
373
  pus.add(au)
369
374
 
370
- c11 = PhysicalUnitConversion(False,
375
+ c13 = PhysicalUnitConversion(False,
371
376
  lambda x, t=None: 0.00014503773773*x,
372
377
  lambda x, t=None: 6894.7572931783*x
373
378
  )
374
- au = AlternateUnit("psi", p24, c11)
379
+ au = AlternateUnit("psi", p24, c13)
375
380
  pus.add(au)
376
381
 
377
- c12 = PhysicalUnitConversion(False,
382
+ c14 = PhysicalUnitConversion(False,
378
383
  lambda x, t=None: 0.000295300999981497*x,
379
384
  lambda x, t=None: 3386.375258*x
380
385
  )
381
- au = AlternateUnit("inHg", p24, c12)
386
+ au = AlternateUnit("inHg", p24, c14)
382
387
  pus.add(au)
383
- au = AlternateUnit("psi·s", p25, c11)
388
+ au = AlternateUnit("psi·s", p25, c13)
384
389
  pus.add(au)
385
- au = AlternateUnit("inHg·s", p25, c12)
390
+ au = AlternateUnit("inHg·s", p25, c14)
386
391
  pus.add(au)
387
392
 
388
393
  p32 = PrimaryUnit("VA·s")
389
394
  pus.add(p32)
390
- au = AlternateUnit("VAh", p32, c2)
395
+ au = AlternateUnit("VAh", p32, c3)
391
396
  pus.add(au)
392
397
  pus.add_scaled(au, "yVAh", 1e+24, "yocto")
393
398
  pus.add_scaled(au, "zVAh", 1e+21, "zepto")
@@ -408,7 +413,7 @@ def _create_units():
408
413
 
409
414
  p33 = PrimaryUnit("V·s")
410
415
  pus.add(p33)
411
- au = AlternateUnit("Vh", p33, c2)
416
+ au = AlternateUnit("Vh", p33, c3)
412
417
  pus.add(au)
413
418
  pus.add_scaled(au, "yVh", 1e+24, "yocto")
414
419
  pus.add_scaled(au, "zVh", 1e+21, "zepto")
@@ -442,9 +447,16 @@ def _create_units():
442
447
  pus.add(au)
443
448
  pus.add_scaled(au, "MBH", 1 / 1000)
444
449
 
450
+ c2 = PhysicalUnitConversion(False,
451
+ lambda x, t=None: 3.412141633e-5*x,
452
+ lambda x, t=None: 29307.1070183211*x
453
+ )
454
+ au = AlternateUnit("therm/h", p0, c2)
455
+ pus.add(au)
456
+
445
457
  p34 = PrimaryUnit("W·s")
446
458
  pus.add(p34)
447
- au = AlternateUnit("Wh", p34, c2)
459
+ au = AlternateUnit("Wh", p34, c3)
448
460
  pus.add(au)
449
461
  pus.add_scaled(au, "yWh", 1e+24, "yocto")
450
462
  pus.add_scaled(au, "zWh", 1e+21, "zepto")
@@ -463,23 +475,30 @@ def _create_units():
463
475
  pus.add_scaled(au, "ZWh", 1 / 1e+21, "zetta")
464
476
  pus.add_scaled(au, "YWh", 1 / 1e+24, "yotta")
465
477
 
466
- c3 = PhysicalUnitConversion(False,
478
+ c4 = PhysicalUnitConversion(False,
467
479
  lambda x, t=None: x,
468
480
  lambda x, t=None: x
469
481
  )
470
- au = AlternateUnit("J", p34, c3)
482
+ au = AlternateUnit("J", p34, c4)
471
483
  pus.add(au)
472
484
 
473
- c4 = PhysicalUnitConversion(False,
485
+ c5 = PhysicalUnitConversion(False,
474
486
  lambda x, t=None: 0.000947817077749151*x,
475
487
  lambda x, t=None: 1055.0559*x
476
488
  )
477
- au = AlternateUnit("Btu", p34, c4)
489
+ au = AlternateUnit("Btu", p34, c5)
490
+ pus.add(au)
491
+
492
+ c6 = PhysicalUnitConversion(False,
493
+ lambda x, t=None: 9.47817077749151e-9*x,
494
+ lambda x, t=None: 105505590.0*x
495
+ )
496
+ au = AlternateUnit("therm", p34, c6)
478
497
  pus.add(au)
479
498
 
480
499
  p35 = PrimaryUnit("W·s/m²")
481
500
  pus.add(p35)
482
- au = AlternateUnit("Wh/m²", p35, c2)
501
+ au = AlternateUnit("Wh/m²", p35, c3)
483
502
  pus.add(au)
484
503
  pus.add_scaled(au, "yWh/m²", 1e+24, "yocto")
485
504
  pus.add_scaled(au, "zWh/m²", 1e+21, "zepto")
@@ -498,55 +517,55 @@ def _create_units():
498
517
  pus.add_scaled(au, "ZWh/m²", 1 / 1e+21, "zetta")
499
518
  pus.add_scaled(au, "YWh/m²", 1 / 1e+24, "yotta")
500
519
 
501
- c18 = PhysicalUnitConversion(False,
520
+ c20 = PhysicalUnitConversion(False,
502
521
  lambda x, t=None: 0.00220462*x,
503
522
  lambda x, t=None: 453.59290943564*x
504
523
  )
505
- au = AlternateUnit("lbs", p27, c18)
524
+ au = AlternateUnit("lbs", p27, c20)
506
525
  pus.add(au)
507
526
 
508
- c19 = PhysicalUnitConversion(False,
527
+ c21 = PhysicalUnitConversion(False,
509
528
  lambda x, t=None: 1.0e-6*x,
510
529
  lambda x, t=None: 1000000.0*x
511
530
  )
512
- au = AlternateUnit("T", p27, c19)
531
+ au = AlternateUnit("T", p27, c21)
513
532
  pus.add(au)
514
533
  pus.add_scaled(au, "kT", 1 / 1000, "kiloton")
515
534
  pus.add_scaled(au, "MT", 1 / 1000000, "megaton")
516
535
  pus.add_scaled(au, "GT", 1 / 1000000000, "gigaton")
517
536
  pus.add_scaled(au, "TT", 1 / 1000000000000, "teraton")
518
537
  pus.add_scaled(au, "PT", 1 / 1000000000000000, "petaton")
519
- au = AlternateUnit("lbs/s", p10, c18)
538
+ au = AlternateUnit("lbs/s", p10, c20)
520
539
  pus.add(au)
521
- au = AlternateUnit("lbs·s", p28, c18)
540
+ au = AlternateUnit("lbs·s", p28, c20)
522
541
  pus.add(au)
523
542
 
524
- c15 = PhysicalUnitConversion(False,
543
+ c17 = PhysicalUnitConversion(False,
525
544
  lambda x, t=None: 1.09361329833771*x,
526
545
  lambda x, t=None: 0.9144*x
527
546
  )
528
- au = AlternateUnit("yd", p12, c15)
547
+ au = AlternateUnit("yd", p12, c17)
529
548
  pus.add(au)
530
549
 
531
- c16 = PhysicalUnitConversion(False,
550
+ c18 = PhysicalUnitConversion(False,
532
551
  lambda x, t=None: 3.28083989501312*x,
533
552
  lambda x, t=None: 0.3048*x
534
553
  )
535
- au = AlternateUnit("ft", p12, c16)
554
+ au = AlternateUnit("ft", p12, c18)
536
555
  pus.add(au)
537
556
 
538
- c17 = PhysicalUnitConversion(False,
557
+ c19 = PhysicalUnitConversion(False,
539
558
  lambda x, t=None: 0.000621371192237334*x,
540
559
  lambda x, t=None: 1609.344*x
541
560
  )
542
- au = AlternateUnit("mi", p12, c17)
561
+ au = AlternateUnit("mi", p12, c19)
543
562
  pus.add(au)
544
563
 
545
- c13 = PhysicalUnitConversion(False,
564
+ c15 = PhysicalUnitConversion(False,
546
565
  lambda x, t=None: 3600*x,
547
566
  lambda x, t=None: (1/3600)*x
548
567
  )
549
- au = AlternateUnit("m/h", p11, c13)
568
+ au = AlternateUnit("m/h", p11, c15)
550
569
  pus.add(au)
551
570
  pus.add_scaled(au, "ym/h", 1e+24, "yocto")
552
571
  pus.add_scaled(au, "zm/h", 1e+21, "zepto")
@@ -565,70 +584,98 @@ def _create_units():
565
584
  pus.add_scaled(au, "Zm/h", 1 / 1e+21, "zetta")
566
585
  pus.add_scaled(au, "Ym/h", 1 / 1e+24, "yotta")
567
586
 
568
- c14 = PhysicalUnitConversion(False,
587
+ c16 = PhysicalUnitConversion(False,
569
588
  lambda x, t=None: 2.2369362920544*x,
570
589
  lambda x, t=None: 0.44704*x
571
590
  )
572
- au = AlternateUnit("mph", p11, c14)
591
+ au = AlternateUnit("mph", p11, c16)
573
592
  pus.add(au)
574
593
 
575
594
  p36 = PrimaryUnit("m³")
576
595
  pus.add(p36)
577
596
 
578
- c20 = PhysicalUnitConversion(False,
597
+ c22 = PhysicalUnitConversion(False,
579
598
  lambda x, t=None: 1000.0*x,
580
599
  lambda x, t=None: 0.001*x
581
600
  )
582
- au = AlternateUnit("L", p36, c20)
601
+ au = AlternateUnit("L", p36, c22)
583
602
  pus.add(au)
584
603
 
585
- c23 = PhysicalUnitConversion(False,
604
+ c25 = PhysicalUnitConversion(False,
586
605
  lambda x, t=None: 264.200792602378*x,
587
606
  lambda x, t=None: 0.003785*x
588
607
  )
589
- au = AlternateUnit("gal", p36, c23)
608
+ au = AlternateUnit("gal", p36, c25)
590
609
  pus.add(au)
591
- au = AlternateUnit("L/s", p23, c20)
610
+
611
+ c30 = PhysicalUnitConversion(False,
612
+ lambda x, t=None: 35.314667*x,
613
+ lambda x, t=None: 0.0283168463686774*x
614
+ )
615
+ au = AlternateUnit("ft³", p36, c30)
592
616
  pus.add(au)
593
617
 
594
- c21 = PhysicalUnitConversion(False,
618
+ c31 = PhysicalUnitConversion(False,
619
+ lambda x, t=None: 0.35314667*x,
620
+ lambda x, t=None: 2.83168463686774*x
621
+ )
622
+ au = AlternateUnit("ccf", p36, c31)
623
+ pus.add(au)
624
+ au = AlternateUnit("L/s", p23, c22)
625
+ pus.add(au)
626
+
627
+ c23 = PhysicalUnitConversion(False,
595
628
  lambda x, t=None: 60000.0*x,
596
629
  lambda x, t=None: 1.66666666666667e-5*x
597
630
  )
598
- au = AlternateUnit("L/m", p23, c21)
631
+ au = AlternateUnit("L/m", p23, c23)
599
632
  pus.add(au)
600
633
 
601
- c22 = PhysicalUnitConversion(False,
634
+ c24 = PhysicalUnitConversion(False,
602
635
  lambda x, t=None: 3600000.0*x,
603
636
  lambda x, t=None: 2.77777777777778e-7*x
604
637
  )
605
- au = AlternateUnit("L/h", p23, c22)
638
+ au = AlternateUnit("L/h", p23, c24)
606
639
  pus.add(au)
607
- au = AlternateUnit("gal/s", p23, c23)
640
+ au = AlternateUnit("gal/s", p23, c25)
608
641
  pus.add(au)
609
642
 
610
- c24 = PhysicalUnitConversion(False,
643
+ c26 = PhysicalUnitConversion(False,
611
644
  lambda x, t=None: 15852.0475561427*x,
612
645
  lambda x, t=None: 6.30833333333334e-5*x
613
646
  )
614
- au = AlternateUnit("gpm", p23, c24)
647
+ au = AlternateUnit("gpm", p23, c26)
615
648
  pus.add(au)
616
649
 
617
- c25 = PhysicalUnitConversion(False,
650
+ c27 = PhysicalUnitConversion(False,
618
651
  lambda x, t=None: 951122.85336856*x,
619
652
  lambda x, t=None: 1.05138888888889e-6*x
620
653
  )
621
- au = AlternateUnit("gph", p23, c25)
654
+ au = AlternateUnit("gph", p23, c27)
655
+ pus.add(au)
656
+
657
+ c28 = PhysicalUnitConversion(False,
658
+ lambda x, t=None: 127132.8012*x,
659
+ lambda x, t=None: 7.86579065796593e-6*x
660
+ )
661
+ au = AlternateUnit("ft³/h", p23, c28)
662
+ pus.add(au)
663
+
664
+ c29 = PhysicalUnitConversion(False,
665
+ lambda x, t=None: 1271.328012*x,
666
+ lambda x, t=None: 0.000786579065796593*x
667
+ )
668
+ au = AlternateUnit("ccf/h", p23, c29)
622
669
  pus.add(au)
623
670
 
624
671
  p37 = PrimaryUnit("m·s")
625
672
  pus.add(p37)
626
- au = AlternateUnit("ft·s", p37, c16)
673
+ au = AlternateUnit("ft·s", p37, c18)
627
674
  pus.add(au)
628
675
 
629
676
  p38 = PrimaryUnit("var·s")
630
677
  pus.add(p38)
631
- au = AlternateUnit("vahr", p38, c2)
678
+ au = AlternateUnit("vahr", p38, c3)
632
679
  pus.add(au)
633
680
  pus.add_scaled(au, "yvahr", 1e+24, "yocto")
634
681
  pus.add_scaled(au, "zvahr", 1e+21, "zepto")
@@ -647,42 +694,42 @@ def _create_units():
647
694
  pus.add_scaled(au, "Zvahr", 1 / 1e+21, "zetta")
648
695
  pus.add_scaled(au, "Yvahr", 1 / 1e+24, "yotta")
649
696
 
650
- c5 = PhysicalUnitConversion(False,
697
+ c7 = PhysicalUnitConversion(False,
651
698
  lambda x, t=None: (9/5)*x + 32,
652
699
  lambda x, t=None: (5/9)*x - 160/9,
653
700
  lambda x, t=None: (9/5)*x,
654
701
  lambda y, t=None: (5/9)*y
655
702
  )
656
- au = AlternateUnit("°F", p8, c5)
703
+ au = AlternateUnit("°F", p8, c7)
657
704
  pus.add(au)
658
705
 
659
- c6 = PhysicalUnitConversion(False,
706
+ c8 = PhysicalUnitConversion(False,
660
707
  lambda x, t=None: x + 273.15,
661
708
  lambda x, t=None: x - 273.15,
662
709
  lambda x, t=None: x,
663
710
  lambda y, t=None: y
664
711
  )
665
- au = AlternateUnit("°K", p8, c6)
712
+ au = AlternateUnit("°K", p8, c8)
666
713
  pus.add(au)
667
714
 
668
- c7 = PhysicalUnitConversion(True,
715
+ c9 = PhysicalUnitConversion(True,
669
716
  lambda x, t=None: 273.15*t + x,
670
717
  lambda x, t=None: -273.15*t + x,
671
718
  lambda x, t=None: x,
672
719
  lambda y, t=None: y
673
720
  )
674
- au = AlternateUnit("°K·s", p9, c7)
721
+ au = AlternateUnit("°K·s", p9, c9)
675
722
  pus.add(au)
676
723
  pus.add_scaled(au, "°K·h", 1 / 3600, "Kelvin degree hours")
677
724
  pus.add_scaled(au, "°K·d", 1 / 86400, "Kelvin degree days")
678
725
 
679
- c8 = PhysicalUnitConversion(True,
726
+ c10 = PhysicalUnitConversion(True,
680
727
  lambda x, t=None: 32*t + (9/5)*x,
681
728
  lambda x, t=None: -160/9*t + (5/9)*x,
682
729
  lambda x, t=None: (9/5)*x,
683
730
  lambda y, t=None: (5/9)*y
684
731
  )
685
- au = AlternateUnit("°F·s", p9, c8)
732
+ au = AlternateUnit("°F·s", p9, c10)
686
733
  pus.add(au)
687
734
  pus.add_scaled(au, "°F·h", 1 / 3600, "Fahrenheight degree hours")
688
735
  pus.add_scaled(au, "°F·d", 1 / 86400, "Fahrenheit degree days")
@@ -27,16 +27,14 @@
27
27
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
28
28
  # THE SOFTWARE.
29
29
  #
30
+ import re
30
31
  from dataclasses import dataclass
31
- from enum import auto, Enum
32
+ from enum import Enum, auto
32
33
  from types import SimpleNamespace
33
34
  from typing import Callable, List
34
35
 
35
- import re
36
-
37
36
  from ..error import Error
38
37
 
39
-
40
38
  ID_PATTERN = re.compile(r"[A-Z]+")
41
39
  NUMBER_PATTERN = re.compile(r"(\d+)")
42
40
 
@@ -80,7 +80,7 @@ def get(resource, **kwargs):
80
80
  raise UnauthenticatedError(r)
81
81
  if r.status_code < 200 or r.status_code > 299:
82
82
  if log.getEffectiveLevel() <= logging.DEBUG:
83
- log.exception(
83
+ log.debug(
84
84
  "HTTP GET status code %s. Keyword args: %s",
85
85
  r.status_code,
86
86
  kwargs,
@@ -124,7 +124,7 @@ def patch(resource, json_data, **kwargs):
124
124
  raise UnauthenticatedError(r)
125
125
  if not 200 <= r.status_code <= 299:
126
126
  if log.getEffectiveLevel() <= logging.DEBUG:
127
- log.exception(
127
+ log.debug(
128
128
  "HTTP PATCH status code %s. "
129
129
  "Resource %s, Data: %s, keyword args: %s",
130
130
  r.status_code,
@@ -171,7 +171,7 @@ def put(resource, json_data, **kwargs):
171
171
  raise UnauthenticatedError(r)
172
172
  if not 200 <= r.status_code <= 299:
173
173
  if log.getEffectiveLevel() <= logging.DEBUG:
174
- log.exception(
174
+ log.debug(
175
175
  "HTTP PUT status code %s. "
176
176
  "Resource %s, Data: %s, keyword args: %s",
177
177
  r.status_code,
@@ -218,7 +218,7 @@ def post(resource, json_data, **kwargs):
218
218
  raise UnauthenticatedError(r)
219
219
  if not 200 <= r.status_code <= 299:
220
220
  if log.getEffectiveLevel() <= logging.DEBUG:
221
- log.exception(
221
+ log.debug(
222
222
  "HTTP POST status code %s. "
223
223
  "Resource %s, Data: %s, keyword args: %s",
224
224
  r.status_code,
@@ -261,7 +261,7 @@ def delete(resource, **kwargs):
261
261
  raise UnauthenticatedError(r)
262
262
  if r.status_code < 200 or r.status_code > 299:
263
263
  if log.getEffectiveLevel() <= logging.DEBUG:
264
- log.exception(
264
+ log.debug(
265
265
  "HTTP DELETE status code %s. Keyword args: %s",
266
266
  r.status_code,
267
267
  kwargs,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: egauge-python
3
- Version: 0.7.4
3
+ Version: 0.8.0
4
4
  Summary: .
5
5
  Home-page: https://bitbucket.org/egauge/python/
6
6
  Author: David Mosberger-Tang
@@ -69,9 +69,9 @@ The classes in this module support manufacturing CTid® sensors. CTid®
69
69
  is patented technology and shall be used in accordance with the
70
70
  licensing agreements governing its use.
71
71
 
72
- ### egauge.pyside2
72
+ ### egauge.pyside
73
73
 
74
- The classes in this module support QT5-based graphical
74
+ The classes in this module support QT6-based graphical
75
75
  user-interfaces.
76
76
 
77
77
  ## Source Code Conventions
@@ -7,9 +7,9 @@ egauge/ctid/bit_stuffer.py
7
7
  egauge/ctid/ctid.py
8
8
  egauge/ctid/encoder.py
9
9
  egauge/ctid/waveform.py
10
- egauge/pyside2/__init__.py
11
- egauge/pyside2/ansi2html.py
12
- egauge/pyside2/terminal.py
10
+ egauge/pyside/__init__.py
11
+ egauge/pyside/ansi2html.py
12
+ egauge/pyside/terminal.py
13
13
  egauge/webapi/__init__.py
14
14
  egauge/webapi/auth.py
15
15
  egauge/webapi/error.py
@@ -1,9 +1,9 @@
1
+ PySide6
1
2
  crcmod
2
3
  deprecated
3
4
  intelhex
4
- wheel
5
- pexpect
6
5
  requests>=2.4.2
6
+ wheel
7
7
 
8
8
  [examples]
9
9
  matplotlib
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env python3
2
2
  #
3
- # Copyright (c) 2023 eGauge Systems LLC
3
+ # Copyright (c) 2023-2024 eGauge Systems LLC
4
4
  #
5
5
  # See LICENSE file for details.
6
6
  #
@@ -28,9 +28,8 @@ Alternatively, you can edit examples/test_common.py to suit your needs.
28
28
 
29
29
  import sys
30
30
 
31
- from matplotlib import pyplot
32
-
33
31
  import test_common
32
+ from matplotlib import pyplot
34
33
 
35
34
  from egauge.webapi.device import Capture, TriggerMode
36
35
 
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env python3
2
2
  #
3
- # Copyright (c) 2023 eGauge Systems LLC
3
+ # Copyright (c) 2023-2024 eGauge Systems LLC
4
4
  #
5
5
  # See LICENSE file for details.
6
6
  #
@@ -27,7 +27,6 @@ Alternatively, you can edit examples/test_common.py to suit your needs.
27
27
  import sys
28
28
 
29
29
  import readchar
30
-
31
30
  import test_common
32
31
 
33
32
  from egauge.webapi.device import CTidInfo, PortInfo
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env python3
2
2
  #
3
- # Copyright (c) 2023 eGauge Systems LLC
3
+ # Copyright (c) 2023-2024 eGauge Systems LLC
4
4
  #
5
5
  # See LICENSE file for details.
6
6
  #
@@ -32,14 +32,12 @@ Alternatively, you can edit examples/test_common.py to suit your needs.
32
32
  """
33
33
 
34
34
  import argparse
35
-
36
35
  from datetime import datetime
37
36
 
38
37
  import pytz
39
-
40
38
  import test_common
41
39
 
42
- from egauge.webapi.device import Register, PhysicalQuantity, UnitSystem
40
+ from egauge.webapi.device import PhysicalQuantity, Register, UnitSystem
43
41
 
44
42
  parser = argparse.ArgumentParser(
45
43
  description="Demonstrate the use of class egauge.webapi.device.Register."
@@ -0,0 +1,10 @@
1
+ [tool.ruff]
2
+ line-length = 79
3
+
4
+ exclude = [
5
+ "egauge/webapi/cloud/gui/*.py"
6
+ ]
7
+
8
+ [tool.ruff.lint]
9
+ extend-select = ["I", "SLF"]
10
+ ignore = ["E741"]
@@ -1,4 +1,5 @@
1
1
  import os
2
+
2
3
  import setuptools
3
4
 
4
5
  with open(os.path.join(os.path.dirname(__file__), "README.md")) as readme:
@@ -9,15 +10,15 @@ os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
9
10
 
10
11
  setuptools.setup(
11
12
  name="egauge-python",
12
- version="0.7.4",
13
+ version="0.8.0",
13
14
  packages=setuptools.find_namespace_packages(include="egauge.*"),
14
15
  install_requires=[
15
16
  "crcmod",
16
17
  "deprecated",
17
18
  "intelhex",
18
19
  "wheel",
19
- "pexpect",
20
20
  "requests>=2.4.2",
21
+ "PySide6",
21
22
  ],
22
23
  extras_require={
23
24
  "examples": [
@@ -1,3 +0,0 @@
1
- from .bit_stuffer import *
2
- from .ctid import *
3
- from .waveform import *
@@ -1,3 +0,0 @@
1
- [tool.black]
2
- line-length = 79
3
- extend-exclude = '/gui/'
File without changes
File without changes