Skip to content

Commit efcc4c6

Browse files
committed
Bug fixed: remote server does not shut down when the window is closed.
Routine updates.
1 parent c1d71de commit efcc4c6

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

leads/utils.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@
1111

1212

1313
def mean_compressor(sequence: list[T], target_size: int) -> list[T]:
14+
"""
15+
A compression method that reduces data memory usage by averaging adjacent numbers and merging them.
16+
:param sequence: the sequence to compress
17+
:param target_size: expected size
18+
:return: the compressed sequence
19+
"""
1420
chunk_size = int(len(sequence) / target_size)
1521
if chunk_size < 2:
1622
return sequence
@@ -22,6 +28,11 @@ def mean_compressor(sequence: list[T], target_size: int) -> list[T]:
2228

2329

2430
def csv_stringifier(element: T) -> str:
31+
"""
32+
Dump an element as a CSV string.
33+
:param element: the element to stringify
34+
:return: CSV string
35+
"""
2536
return str(element) + ","
2637

2738

@@ -32,6 +43,13 @@ def __init__(self,
3243
chunk_scale: int = 1,
3344
compressor: Compressor = mean_compressor,
3445
stringifier: Stringifier = csv_stringifier) -> None:
46+
"""
47+
:param file: the file into which the data is written
48+
:param max_size: maximum cached size
49+
:param chunk_scale: chunk scaling factor (compression)
50+
:param compressor: compressor interface
51+
:param stringifier: stringifier interface
52+
"""
3553
self._file: _TextIO = open(file, "a") if isinstance(file, str) else file
3654
self._max_size: int = max_size
3755
self._chunk_scale: int = chunk_scale

leads_dashboard/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,4 @@ def start_comm_server(render: _Callable[[], None], server: _Server = _create_ser
6666
server.start(True)
6767
_dpg.start_dearpygui()
6868
_dpg.destroy_context()
69+
server.kill()

0 commit comments

Comments
 (0)