ErrorAI 1.1.0__tar.gz → 1.2.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.
- {errorai-1.1.0 → errorai-1.2.0}/ErrorAI.egg-info/PKG-INFO +1 -1
- {errorai-1.1.0 → errorai-1.2.0}/PKG-INFO +1 -1
- {errorai-1.1.0 → errorai-1.2.0}/errorai/__init__.py +3 -4
- {errorai-1.1.0 → errorai-1.2.0}/errorai/compat.py +18 -0
- {errorai-1.1.0 → errorai-1.2.0}/pyproject.toml +1 -1
- {errorai-1.1.0 → errorai-1.2.0}/ErrorAI.egg-info/SOURCES.txt +0 -0
- {errorai-1.1.0 → errorai-1.2.0}/ErrorAI.egg-info/dependency_links.txt +0 -0
- {errorai-1.1.0 → errorai-1.2.0}/ErrorAI.egg-info/entry_points.txt +0 -0
- {errorai-1.1.0 → errorai-1.2.0}/ErrorAI.egg-info/requires.txt +0 -0
- {errorai-1.1.0 → errorai-1.2.0}/ErrorAI.egg-info/top_level.txt +0 -0
- {errorai-1.1.0 → errorai-1.2.0}/README.md +0 -0
- {errorai-1.1.0 → errorai-1.2.0}/errorai/__main__.py +0 -0
- {errorai-1.1.0 → errorai-1.2.0}/errorai/bootstrap.py +0 -0
- {errorai-1.1.0 → errorai-1.2.0}/errorai/cli.py +0 -0
- {errorai-1.1.0 → errorai-1.2.0}/errorai/config.py +0 -0
- {errorai-1.1.0 → errorai-1.2.0}/errorai/environment.py +0 -0
- {errorai-1.1.0 → errorai-1.2.0}/errorai/pipeline.py +0 -0
- {errorai-1.1.0 → errorai-1.2.0}/errorai/providers.py +0 -0
- {errorai-1.1.0 → errorai-1.2.0}/errorai/runtime.py +0 -0
- {errorai-1.1.0 → errorai-1.2.0}/errorai/universal.py +0 -0
- {errorai-1.1.0 → errorai-1.2.0}/setup.cfg +0 -0
- {errorai-1.1.0 → errorai-1.2.0}/tests/test_bootstrap.py +0 -0
- {errorai-1.1.0 → errorai-1.2.0}/tests/test_config.py +0 -0
- {errorai-1.1.0 → errorai-1.2.0}/tests/test_runtime.py +0 -0
- {errorai-1.1.0 → errorai-1.2.0}/tests/test_safety.py +0 -0
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
from .compat import catch_errors, global_activate, watch
|
|
2
2
|
from .runtime import configure, get_runtime
|
|
3
3
|
|
|
4
|
-
__version__ = "2.
|
|
4
|
+
__version__ = "2.1.0"
|
|
5
5
|
__all__ = ["get_runtime", "configure", "watch", "catch_errors", "global_activate"]
|
|
6
6
|
|
|
7
|
-
#
|
|
8
|
-
|
|
9
|
-
runtime.initialize()
|
|
7
|
+
# Auto-start runtime on import
|
|
8
|
+
get_runtime().initialize()
|
|
@@ -20,6 +20,9 @@ def watch(func):
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
class catch_errors:
|
|
23
|
+
def __init__(self, func=None):
|
|
24
|
+
self.func = func
|
|
25
|
+
|
|
23
26
|
def __enter__(self):
|
|
24
27
|
return self
|
|
25
28
|
|
|
@@ -29,8 +32,23 @@ class catch_errors:
|
|
|
29
32
|
get_runtime().process_exception(exc_type, exc_value, exc_tb)
|
|
30
33
|
return True
|
|
31
34
|
|
|
35
|
+
def __call__(self, *args, **kwargs):
|
|
36
|
+
if callable(self.func):
|
|
37
|
+
@functools.wraps(self.func)
|
|
38
|
+
def inner(*wargs, **wkwargs):
|
|
39
|
+
try:
|
|
40
|
+
return self.func(*wargs, **wkwargs)
|
|
41
|
+
except Exception as e:
|
|
42
|
+
get_runtime().process_exception(type(e), e, e.__traceback__)
|
|
43
|
+
raise
|
|
44
|
+
return inner(*args, **kwargs)
|
|
45
|
+
|
|
32
46
|
|
|
33
47
|
def global_activate():
|
|
34
48
|
runtime = get_runtime()
|
|
35
49
|
runtime.initialize()
|
|
36
50
|
return runtime
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
# Automatically trigger global activation on import so zero-config works!
|
|
54
|
+
global_activate()
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|