cgse-common 0.16.10__py3-none-any.whl → 0.16.12__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cgse-common
3
- Version: 0.16.10
3
+ Version: 0.16.12
4
4
  Summary: Software framework to support hardware testing
5
5
  Author: IvS KU Leuven
6
6
  Maintainer-email: Rik Huygen <rik.huygen@kuleuven.be>, Sara Regibo <sara.regibo@kuleuven.be>
@@ -22,6 +22,7 @@ Requires-Dist: pandas>=2.2.0; python_version >= '3.10'
22
22
  Requires-Dist: prometheus-client>=0.21.1
23
23
  Requires-Dist: psutil>=6.1.1
24
24
  Requires-Dist: psycopg>=3.2.9
25
+ Requires-Dist: python-dotenv>=1.1.1
25
26
  Requires-Dist: pyyaml>=6.0.2
26
27
  Requires-Dist: pyzmq==23.2.1; python_version == '3.9'
27
28
  Requires-Dist: pyzmq>=25.1.0; python_version >= '3.10'
@@ -8,7 +8,7 @@ egse/counter.py,sha256=7UwBeTAu213xdNdGAOYpUWNQ4jD4yVM1bOG10Ax4UFs,5097
8
8
  egse/decorators.py,sha256=B-zRa1WdLO71zqS5M27JBglcThYPho7seYfa4HOGj5c,27171
9
9
  egse/device.py,sha256=nn2HkN1KIHAmo37WZcqig-p2mQz1LgqpIfj1wPrUTLc,13240
10
10
  egse/dicts.py,sha256=dUAq7PTPvs73OrZb2Fh3loxvYv4ifUiK6bBcgrFU77Y,3972
11
- egse/env.py,sha256=7HKzb61Mtd5f-kNoN6-Lrik1ZriWkplqE36CnBdRtAM,29074
11
+ egse/env.py,sha256=0z57ESbD9qtJSQiK_7CcpEZm5sxwrKkOMQaJGANmTho,29090
12
12
  egse/exceptions.py,sha256=QB3MZRJizecWOj1cPbvG0UcIqFn7NRJ6rw1xtdNSFxw,1225
13
13
  egse/heartbeat.py,sha256=xt5mePu9Zr9fLAhN1MLq1Z7aCOKtNIhRVCAmWhtNwP8,3039
14
14
  egse/hk.py,sha256=AumSpB8SYXes75CB2iiKXfLkMK5IkVDHITFKrf8IT6g,32010
@@ -28,18 +28,18 @@ egse/response.py,sha256=F04uqOYv1ClpHgDLYZlKTuOCSldHs5TezI_4x6zf2Fw,2717
28
28
  egse/scpi.py,sha256=WJ73EaLgRUV6ah1V41l0L7AXI-Dc6Jct7hPHlbbCIcg,15461
29
29
  egse/settings.py,sha256=YrRsMUn_IpOVnhTqUGREQUjMw8-AQ6aUBulQiij9MwY,15486
30
30
  egse/settings.yaml,sha256=mz9O2QqmiptezsMvxJRLhnC1ROwIHENX0nbnhMaXUpE,190
31
- egse/setup.py,sha256=1k-5CjzY3_tZ6XCitNOIyZEWyAUC8LqGcnmdKS68vYw,33945
31
+ egse/setup.py,sha256=iWFe3zx4bIkzaUabpbxedteG8qEc3JYHgpu2HjU7s4E,33973
32
32
  egse/signal.py,sha256=f5pyOiNW9iTSIxV_ce5stIfG0ub9MRbaekE85kQOVzs,7992
33
33
  egse/socketdevice.py,sha256=R8XwYHTH3lFhFngfsGbi_L7bTnTLHxMTEKIF7gmm5rc,7465
34
34
  egse/state.py,sha256=HdU2MFOlYRbawYRZmizV6Y8MgnZrUF0bx4fXaYU-M_s,3023
35
- egse/system.py,sha256=tBlhNoKvop_QpOGQhyhGUBPuAixCDOiClwqeZM-eC4I,75538
35
+ egse/system.py,sha256=3aycoK15UvNdk2yxQ8hx4N-s2Ag4BqTTPQ8eFuJa3Ko,76111
36
36
  egse/task.py,sha256=ODSLE05f31CgWsSVcVFFq1WYUZrJMb1LioPTx6VM824,2804
37
37
  egse/version.py,sha256=e9GvelUZ9mfCDlRju4MWEJeMHJW9kUzK6SKzJpyj91s,6156
38
- egse/zmq_ser.py,sha256=d2lETLkLUll_F1Phc1pI7MEeA41uX7YZ8lhSFmBQZVw,3022
38
+ egse/zmq_ser.py,sha256=YJFupsxuvhI8TJMeS2Hem9oMMcVmSBx0rZv93gvN-hA,3263
39
39
  egse/plugins/metrics/duckdb.py,sha256=E2eeNo3I7ajRuByodaYiPNvC0Zwyc7hsIlhr1W_eXdo,16148
40
40
  egse/plugins/metrics/influxdb.py,sha256=ecxjA_csYwf8RW3sXjiQxZHREfyrfStH1HA_rAs1AA8,6690
41
41
  egse/plugins/metrics/timescaledb.py,sha256=Ug0NWDV1Ky2VeFY6tDZL9xg6AFgnAEh2F_llVPnlRBA,21191
42
- cgse_common-0.16.10.dist-info/METADATA,sha256=X5pqCJ3yD_lj8MFWQnYPPkbmLcY_-Iu0k9niufOMDrY,3033
43
- cgse_common-0.16.10.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
44
- cgse_common-0.16.10.dist-info/entry_points.txt,sha256=erQovXd1bGzsngB0_sfY7IYRNwHIhwq3K8fmQvGS12o,198
45
- cgse_common-0.16.10.dist-info/RECORD,,
42
+ cgse_common-0.16.12.dist-info/METADATA,sha256=NKwp0OrE3-uPhtgcJN2z21aDqPMOIsgIXiQrHIHdZc0,3069
43
+ cgse_common-0.16.12.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
44
+ cgse_common-0.16.12.dist-info/entry_points.txt,sha256=erQovXd1bGzsngB0_sfY7IYRNwHIhwq3K8fmQvGS12o,198
45
+ cgse_common-0.16.12.dist-info/RECORD,,
egse/env.py CHANGED
@@ -42,6 +42,7 @@ locations and settings.
42
42
  from __future__ import annotations
43
43
 
44
44
  __all__ = [
45
+ "bool_env",
45
46
  "env_var",
46
47
  "get_conf_data_location",
47
48
  "get_conf_data_location_env_name",
egse/setup.py CHANGED
@@ -117,6 +117,7 @@ from __future__ import annotations
117
117
  __all__ = [
118
118
  "Setup",
119
119
  "setup_ctx",
120
+ "disentangle_filename",
120
121
  "navdict", # noqa: ignore typo
121
122
  "list_setups",
122
123
  "load_setup_from_disk",
egse/system.py CHANGED
@@ -71,19 +71,32 @@ TIME_FORMAT = "%Y-%m-%dT%H:%M:%S.%f%z"
71
71
  class Periodic:
72
72
  """A timer that periodically invokes a function in the background.
73
73
 
74
- If no callback is provided, a warning message will be logged. In a future, we might send out an event to the
75
- application (will need an event handler).
74
+ This class schedules a callback to be executed at regular intervals using asyncio.
75
+ If no callback is provided, a warning message will be logged. If the callback execution
76
+ takes longer than the interval, and `skip` is True (default), the timer will skip missed
77
+ intervals to maintain the schedule.
76
78
 
77
- When the function execution takes longer then the interval there re several options:
78
-
79
- - if skip is True (default) the interval will take precedence and the
80
79
  Args:
81
- interval: The time between timer events, in seconds.
82
- name: A name to assign the event (for debugging), defaults to `Periodic#`.
83
- callback: A optional callback to invoke when the event is handled.
84
- repeat: The number of times to repeat the timer, or None to repeat forever.
85
- skip: Enable skipping of scheduled function calls that couldn't be sent in time.
86
- pause: Start the timer paused. Use `resume()` to activate the timer.
80
+ interval (float): The time between timer events, in seconds.
81
+ name (str, optional): A name to assign the event (for debugging), defaults to `Periodic#`.
82
+ callback (Callable, optional): A callback to invoke when the event is handled.
83
+ repeat (int, optional): The number of times to repeat the timer, or None to repeat forever.
84
+ skip (bool, optional): Enable skipping of scheduled function calls that couldn't be sent in time.
85
+ pause (bool, optional): Start the timer paused. Use `resume()` to activate the timer.
86
+
87
+ Methods:
88
+ start(): Start the timer.
89
+ stop(): Stop the timer.
90
+ is_running(): Return True if the timer is running.
91
+ is_paused(): Return True if the timer is paused.
92
+ pause(): Pause the timer.
93
+ reset(): Reset the timer to start from the beginning.
94
+ resume(): Resume a paused timer.
95
+
96
+ Note:
97
+ The timer runs asynchronously and is suitable for use in asyncio-based applications.
98
+ If the callback is a coroutine, it will be awaited.
99
+
87
100
  """
88
101
 
89
102
  _periodic_count: int = 0
egse/zmq_ser.py CHANGED
@@ -44,17 +44,26 @@ def recv_zipped_pickle(socket, flags=0, protocol=-1):
44
44
  return pickle.loads(p)
45
45
 
46
46
 
47
- def get_port_number(socket: zmq.Socket) -> int | None:
47
+ def get_port_number(socket: zmq.Socket | None) -> int:
48
48
  """
49
- Returns the port number associated with this socket. Returns None for sockets
50
- that do not bind to a TCP or IPC transport.
49
+ Returns the port number associated with this socket.
50
+
51
+ If the socket is bound to a TCP or IPC transport, the port number is extracted from the
52
+ LAST_ENDPOINT socket option.
53
+
54
+ Returns:
55
+ - 0 for sockets that do not bound to a TCP or IPC transport.
56
+ - 0 if the socket is None.
51
57
  """
58
+ if socket is None:
59
+ return 0
60
+
52
61
  endpoint = socket.getsockopt(zmq.LAST_ENDPOINT)
53
- if endpoint:
62
+ if endpoint and isinstance(endpoint, bytes):
54
63
  port = endpoint.decode("utf-8").split(":")[-1]
55
64
  return int(port)
56
65
  else:
57
- return None
66
+ return 0
58
67
 
59
68
 
60
69
  def zmq_string_request(request: str) -> list: