steer-core 0.1.4__tar.gz → 0.1.7__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.
- {steer_core-0.1.4 → steer_core-0.1.7}/PKG-INFO +1 -1
- steer_core-0.1.7/steer_core/Apps/ContextManagers.py +55 -0
- steer_core-0.1.7/steer_core/Apps/Performance/CallbackTimer.py +17 -0
- steer_core-0.1.7/steer_core/Decorators/__init__.py +0 -0
- steer_core-0.1.7/steer_core/Mixins/__init__.py +0 -0
- steer_core-0.1.7/steer_core/__init__.py +1 -0
- {steer_core-0.1.4 → steer_core-0.1.7}/steer_core.egg-info/PKG-INFO +1 -1
- {steer_core-0.1.4 → steer_core-0.1.7}/steer_core.egg-info/SOURCES.txt +5 -1
- steer_core-0.1.7/test/test_compound_components_clean.py +0 -0
- steer_core-0.1.4/steer_core/__init__.py +0 -1
- {steer_core-0.1.4 → steer_core-0.1.7}/README.md +0 -0
- {steer_core-0.1.4 → steer_core-0.1.7}/setup.cfg +0 -0
- {steer_core-0.1.4 → steer_core-0.1.7}/setup.py +0 -0
- {steer_core-0.1.4/steer_core/Constants → steer_core-0.1.7/steer_core/Apps/Performance}/__init__.py +0 -0
- {steer_core-0.1.4/steer_core/ContextManagers → steer_core-0.1.7/steer_core/Apps}/__init__.py +0 -0
- {steer_core-0.1.4 → steer_core-0.1.7}/steer_core/Constants/Units.py +0 -0
- {steer_core-0.1.4 → steer_core-0.1.7}/steer_core/Constants/Universal.py +0 -0
- {steer_core-0.1.4/steer_core/Decorators → steer_core-0.1.7/steer_core/Constants}/__init__.py +0 -0
- {steer_core-0.1.4/steer_core/Mixins → steer_core-0.1.7/steer_core/ContextManagers}/__init__.py +0 -0
- /steer_core-0.1.4/test/test_compound_components_clean.py → /steer_core-0.1.7/steer_core/Data/__init__.py +0 -0
- {steer_core-0.1.4 → steer_core-0.1.7}/steer_core/DataManager.py +0 -0
- {steer_core-0.1.4 → steer_core-0.1.7}/steer_core/Decorators/Coordinates.py +0 -0
- {steer_core-0.1.4 → steer_core-0.1.7}/steer_core/Decorators/Electrochemical.py +0 -0
- {steer_core-0.1.4 → steer_core-0.1.7}/steer_core/Decorators/General.py +0 -0
- {steer_core-0.1.4 → steer_core-0.1.7}/steer_core/Decorators/Objects.py +0 -0
- {steer_core-0.1.4 → steer_core-0.1.7}/steer_core/Mixins/Colors.py +0 -0
- {steer_core-0.1.4 → steer_core-0.1.7}/steer_core/Mixins/Coordinates.py +0 -0
- {steer_core-0.1.4 → steer_core-0.1.7}/steer_core/Mixins/Data.py +0 -0
- {steer_core-0.1.4 → steer_core-0.1.7}/steer_core/Mixins/Serializer.py +0 -0
- /steer_core-0.1.4/steer_core/Mixins/validators.py → /steer_core-0.1.7/steer_core/Mixins/Validators.py +0 -0
- {steer_core-0.1.4 → steer_core-0.1.7}/steer_core.egg-info/dependency_links.txt +0 -0
- {steer_core-0.1.4 → steer_core-0.1.7}/steer_core.egg-info/requires.txt +0 -0
- {steer_core-0.1.4 → steer_core-0.1.7}/steer_core.egg-info/top_level.txt +0 -0
- {steer_core-0.1.4 → steer_core-0.1.7}/test/test_compound_components.py +0 -0
- {steer_core-0.1.4 → steer_core-0.1.7}/test/test_slider_controls.py +0 -0
@@ -0,0 +1,55 @@
|
|
1
|
+
import warnings
|
2
|
+
import time
|
3
|
+
from contextlib import contextmanager
|
4
|
+
from typing import List, Dict
|
5
|
+
|
6
|
+
|
7
|
+
@contextmanager
|
8
|
+
def capture_warnings(existing_warnings: List[Dict] = None, source: str = None, clear_source_warnings: bool = True):
|
9
|
+
"""
|
10
|
+
Context manager to capture warnings and format them for Dash.
|
11
|
+
|
12
|
+
Parameters
|
13
|
+
----------
|
14
|
+
existing_warnings : List[Dict], optional
|
15
|
+
Existing warnings to append to
|
16
|
+
source : str, optional
|
17
|
+
Source identifier for the warnings
|
18
|
+
clear_source_warnings : bool, optional
|
19
|
+
Whether to clear existing warnings from the same source before adding new ones
|
20
|
+
|
21
|
+
Yields
|
22
|
+
------
|
23
|
+
List[Dict]
|
24
|
+
The combined list of warnings (existing + new)
|
25
|
+
"""
|
26
|
+
if existing_warnings is None:
|
27
|
+
existing_warnings = []
|
28
|
+
|
29
|
+
# Clear existing warnings from the same source if requested
|
30
|
+
if clear_source_warnings and source:
|
31
|
+
existing_warnings = [w for w in existing_warnings if w.get('source') != source]
|
32
|
+
|
33
|
+
with warnings.catch_warnings(record=True) as warnings_list:
|
34
|
+
warnings.simplefilter("always")
|
35
|
+
|
36
|
+
# Yield the cleaned warnings list
|
37
|
+
yield existing_warnings
|
38
|
+
|
39
|
+
# Process any new warnings after the operation
|
40
|
+
new_warnings = []
|
41
|
+
for w in warnings_list:
|
42
|
+
|
43
|
+
new_warnings.append({
|
44
|
+
'message': str(w.message),
|
45
|
+
'category': w.category.__name__,
|
46
|
+
'filename': w.filename,
|
47
|
+
'lineno': w.lineno,
|
48
|
+
'timestamp': time.time(),
|
49
|
+
'source': source or 'unknown',
|
50
|
+
'id': f"{source}_{int(time.time())}" if source else f"warning_{int(time.time())}"
|
51
|
+
})
|
52
|
+
|
53
|
+
# Add new warnings
|
54
|
+
existing_warnings.extend(new_warnings)
|
55
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
from functools import wraps
|
2
|
+
import time
|
3
|
+
|
4
|
+
|
5
|
+
def timed_callback(func):
|
6
|
+
"""Time callback execution for optimization."""
|
7
|
+
@wraps(func)
|
8
|
+
def wrapper(*args, **kwargs):
|
9
|
+
start = time.time()
|
10
|
+
result = func(*args, **kwargs)
|
11
|
+
duration = time.time() - start
|
12
|
+
|
13
|
+
print(f"CALLBACK: {func.__name__} took {duration:.2f}s")
|
14
|
+
|
15
|
+
return result
|
16
|
+
return wrapper
|
17
|
+
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
__version__ = "0.1.7"
|
@@ -7,10 +7,15 @@ steer_core.egg-info/SOURCES.txt
|
|
7
7
|
steer_core.egg-info/dependency_links.txt
|
8
8
|
steer_core.egg-info/requires.txt
|
9
9
|
steer_core.egg-info/top_level.txt
|
10
|
+
steer_core/Apps/ContextManagers.py
|
11
|
+
steer_core/Apps/__init__.py
|
12
|
+
steer_core/Apps/Performance/CallbackTimer.py
|
13
|
+
steer_core/Apps/Performance/__init__.py
|
10
14
|
steer_core/Constants/Units.py
|
11
15
|
steer_core/Constants/Universal.py
|
12
16
|
steer_core/Constants/__init__.py
|
13
17
|
steer_core/ContextManagers/__init__.py
|
18
|
+
steer_core/Data/__init__.py
|
14
19
|
steer_core/Decorators/Coordinates.py
|
15
20
|
steer_core/Decorators/Electrochemical.py
|
16
21
|
steer_core/Decorators/General.py
|
@@ -22,7 +27,6 @@ steer_core/Mixins/Data.py
|
|
22
27
|
steer_core/Mixins/Serializer.py
|
23
28
|
steer_core/Mixins/Validators.py
|
24
29
|
steer_core/Mixins/__init__.py
|
25
|
-
steer_core/Mixins/validators.py
|
26
30
|
test/test_compound_components.py
|
27
31
|
test/test_compound_components_clean.py
|
28
32
|
test/test_slider_controls.py
|
File without changes
|
@@ -1 +0,0 @@
|
|
1
|
-
__version__ = "0.1.4"
|
File without changes
|
File without changes
|
File without changes
|
{steer_core-0.1.4/steer_core/Constants → steer_core-0.1.7/steer_core/Apps/Performance}/__init__.py
RENAMED
File without changes
|
{steer_core-0.1.4/steer_core/ContextManagers → steer_core-0.1.7/steer_core/Apps}/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{steer_core-0.1.4/steer_core/Decorators → steer_core-0.1.7/steer_core/Constants}/__init__.py
RENAMED
File without changes
|
{steer_core-0.1.4/steer_core/Mixins → steer_core-0.1.7/steer_core/ContextManagers}/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|