osbot-utils 2.26.0__py3-none-any.whl → 2.27.0__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.
- osbot_utils/helpers/flows/Flow.py +4 -0
- osbot_utils/helpers/flows/Task.py +5 -1
- osbot_utils/helpers/flows/models/Flow_Run__Config.py +1 -0
- osbot_utils/type_safe/Type_Safe.py +4 -0
- osbot_utils/type_safe/shared/Type_Safe__Json_Compressor.py +4 -4
- osbot_utils/version +1 -1
- {osbot_utils-2.26.0.dist-info → osbot_utils-2.27.0.dist-info}/METADATA +2 -2
- {osbot_utils-2.26.0.dist-info → osbot_utils-2.27.0.dist-info}/RECORD +10 -10
- {osbot_utils-2.26.0.dist-info → osbot_utils-2.27.0.dist-info}/WHEEL +1 -1
- {osbot_utils-2.26.0.dist-info → osbot_utils-2.27.0.dist-info}/LICENSE +0 -0
@@ -11,6 +11,7 @@ from osbot_utils.helpers.flows.models.Flow_Run__Config import Flow_Run__Con
|
|
11
11
|
from osbot_utils.helpers.flows.actions.Flow__Events import flow_events
|
12
12
|
from osbot_utils.helpers.flows.models.Flow_Run__Event_Data import Flow_Run__Event_Data
|
13
13
|
from osbot_utils.testing.Stdout import Stdout
|
14
|
+
from osbot_utils.utils.Dev import pprint
|
14
15
|
from osbot_utils.utils.Misc import random_id, lower, time_now
|
15
16
|
from osbot_utils.utils.Python_Logger import Python_Logger
|
16
17
|
from osbot_utils.utils.Str import ansis_to_texts
|
@@ -280,3 +281,6 @@ class Flow(Type_Safe):
|
|
280
281
|
def json(self) -> typing.Dict[str, typing.Any]: # Convert flow data to JSON
|
281
282
|
return self.flow_data.json()
|
282
283
|
|
284
|
+
def print__flow_data(self):
|
285
|
+
pprint(self.flow_data.json())
|
286
|
+
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import inspect
|
2
|
+
import traceback
|
2
3
|
import typing
|
3
4
|
|
4
5
|
from osbot_utils.helpers.flows.models.Flow_Run__Event_Data import Flow_Run__Event_Data
|
@@ -49,7 +50,6 @@ class Task(Type_Safe):
|
|
49
50
|
return self.execute__after()
|
50
51
|
|
51
52
|
def execute__before(self):
|
52
|
-
self.on_task_start()
|
53
53
|
self.task_flow = self.find_flow()
|
54
54
|
if self.task_flow is None:
|
55
55
|
raise Exception("No Flow found for Task")
|
@@ -60,6 +60,7 @@ class Task(Type_Safe):
|
|
60
60
|
if not self.task_id:
|
61
61
|
self.task_id = self.random_task_id()
|
62
62
|
|
63
|
+
self.on_task_start()
|
63
64
|
flow_events.on__task__start(self.task_event_data())
|
64
65
|
|
65
66
|
self.task_flow.executed_tasks.append(self)
|
@@ -87,6 +88,9 @@ class Task(Type_Safe):
|
|
87
88
|
self.task_return_value = self.task_target(*self.resolved_args, **self.resolved_kwargs)
|
88
89
|
except Exception as error:
|
89
90
|
self.task_error = error
|
91
|
+
if self.task_flow.flow_config.print_error_stack_trace:
|
92
|
+
tb = traceback.format_exc()
|
93
|
+
print(f'{tb}')
|
90
94
|
self.task_flow.log_captured_stdout(stdout)
|
91
95
|
|
92
96
|
async def execute__task_target__async(self):
|
@@ -9,6 +9,7 @@ class Flow_Run__Config(Type_Safe):
|
|
9
9
|
print_logs : bool = False
|
10
10
|
print_none_return_value : bool = False
|
11
11
|
print_finished_message : bool = False
|
12
|
+
print_error_stack_trace : bool = False
|
12
13
|
raise_flow_error : bool = True
|
13
14
|
flow_data__capture_events : bool = False
|
14
15
|
|
@@ -62,6 +62,10 @@ class Type_Safe:
|
|
62
62
|
def json(self):
|
63
63
|
return self.serialize_to_dict()
|
64
64
|
|
65
|
+
def json__compress(self):
|
66
|
+
from osbot_utils.type_safe.shared.Type_Safe__Json_Compressor import Type_Safe__Json_Compressor
|
67
|
+
return Type_Safe__Json_Compressor().compress(self)
|
68
|
+
|
65
69
|
# todo: see if we still need this. now that Type_Safe handles base types, there should be no need for this
|
66
70
|
def merge_with(self, target):
|
67
71
|
original_attrs = {k: v for k, v in self.__dict__.items() if k not in target.__dict__} # Store the original attributes of self that should be retained.
|
@@ -10,12 +10,12 @@ class Type_Safe__Json_Compressor(Type_Safe__Base):
|
|
10
10
|
def __init__(self):
|
11
11
|
self.type_registry = Type_Safe__Json_Compressor__Type_Registry()
|
12
12
|
|
13
|
-
def compress(self,
|
14
|
-
if not
|
15
|
-
return
|
13
|
+
def compress(self, obj: Any) -> dict:
|
14
|
+
if not obj:
|
15
|
+
return obj
|
16
16
|
|
17
17
|
self.type_registry.clear()
|
18
|
-
compressed = self.compress_object(
|
18
|
+
compressed = self.compress_object(obj)
|
19
19
|
|
20
20
|
if self.type_registry.registry:
|
21
21
|
return { "_type_registry": self.type_registry.reverse,
|
osbot_utils/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
v2.
|
1
|
+
v2.27.0
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: osbot_utils
|
3
|
-
Version: 2.
|
3
|
+
Version: 2.27.0
|
4
4
|
Summary: OWASP Security Bot - Utils
|
5
5
|
License: MIT
|
6
6
|
Author: Dinis Cruz
|
@@ -23,7 +23,7 @@ Description-Content-Type: text/markdown
|
|
23
23
|
|
24
24
|
Powerful Python util methods and classes that simplify common apis and tasks.
|
25
25
|
|
26
|
-

|
27
27
|
[](https://codecov.io/gh/owasp-sbot/OSBot-Utils)
|
28
28
|
|
29
29
|
|
@@ -136,8 +136,8 @@ osbot_utils/helpers/cache_requests/Cache__Requests__Row.py,sha256=Sb7E_zDB-LPlWI
|
|
136
136
|
osbot_utils/helpers/cache_requests/Cache__Requests__Table.py,sha256=BW7tXM0TFYma3Db4M-58IKpx0vevLuFsH7QQeiggPaI,388
|
137
137
|
osbot_utils/helpers/cache_requests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
138
138
|
osbot_utils/helpers/cache_requests/flows/flow__Cache__Requests.py,sha256=xgx_oExxkcvRwQN1UCobimECIMUKGoIX5oGdCmp8Nyw,243
|
139
|
-
osbot_utils/helpers/flows/Flow.py,sha256=
|
140
|
-
osbot_utils/helpers/flows/Task.py,sha256=
|
139
|
+
osbot_utils/helpers/flows/Flow.py,sha256=eSqv_pY7vDC1XmX65RyW4swnhQNtMwZXkXnc4De2oc0,13239
|
140
|
+
osbot_utils/helpers/flows/Task.py,sha256=14f51WEaOWIIEiZlMhUtJ3YzK4PnJzvcGs8SivdOfBQ,6530
|
141
141
|
osbot_utils/helpers/flows/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
142
142
|
osbot_utils/helpers/flows/actions/Flow__Data.py,sha256=h9h5yVFIK0ZdXukNFgfRVV1XW0YQartVMcJTakwVqKY,5155
|
143
143
|
osbot_utils/helpers/flows/actions/Flow__Events.py,sha256=g7KBafFeA7tV-v31v_m3MT__cZEX63gh8CehnZwRYU0,2840
|
@@ -145,7 +145,7 @@ osbot_utils/helpers/flows/actions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeR
|
|
145
145
|
osbot_utils/helpers/flows/decorators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
146
146
|
osbot_utils/helpers/flows/decorators/flow.py,sha256=7wj5TtUO_ffbACnagZtZ6LfFgclmbQSfn2lKkMMrnJI,670
|
147
147
|
osbot_utils/helpers/flows/decorators/task.py,sha256=Z5GqoUirnm98HAyvRlVcoXLcmZNagXjOXon2kb5OHsY,755
|
148
|
-
osbot_utils/helpers/flows/models/Flow_Run__Config.py,sha256=
|
148
|
+
osbot_utils/helpers/flows/models/Flow_Run__Config.py,sha256=eW7uYZngnmEv1PZOi3sMyJ3jaTlD6S7juzxaDkNO88Y,588
|
149
149
|
osbot_utils/helpers/flows/models/Flow_Run__Event.py,sha256=2E-T6XXvsF2RnbIt5qq0rktOVBpembYvQudhoyM_6vc,589
|
150
150
|
osbot_utils/helpers/flows/models/Flow_Run__Event_Data.py,sha256=zIAhfz1oUs0ocxbfCPmgj8tsXt2Ycjo0nFdeetKlnZ8,400
|
151
151
|
osbot_utils/helpers/flows/models/Flow_Run__Event_Type.py,sha256=4wYRGAtztlhSV6XZa6DIfAAf7ZLp95KOIGU8G1EC4jc,373
|
@@ -294,7 +294,7 @@ osbot_utils/testing/performance/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm
|
|
294
294
|
osbot_utils/testing/performance/models/Model__Performance_Measure__Measurement.py,sha256=xT_uKzbSYo9AGiJgNmCHSt3ApneNNyKh8vsMVN6IJQ0,1127
|
295
295
|
osbot_utils/testing/performance/models/Model__Performance_Measure__Result.py,sha256=k9HJYNLmW6sjRVsfpduSxHFiVANc1zmYtO_Oz9azpW8,755
|
296
296
|
osbot_utils/testing/performance/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
297
|
-
osbot_utils/type_safe/Type_Safe.py,sha256=
|
297
|
+
osbot_utils/type_safe/Type_Safe.py,sha256=tUz4rzghHSjyzIMuBYANJiTI87F9h9GZVkmvjh3hsQE,5707
|
298
298
|
osbot_utils/type_safe/Type_Safe__Base.py,sha256=Bzrh8TxFglB0FEUAQTlgovlnFHnBN4lOX1Vu327r1Vc,5223
|
299
299
|
osbot_utils/type_safe/Type_Safe__Dict.py,sha256=vE_Ut7MabBjOq5Hpr3vdFO5RNf-M-cL83S76CvxD-9g,2488
|
300
300
|
osbot_utils/type_safe/Type_Safe__List.py,sha256=SzSIBkwSOAEpW_V2qh4-f0YHzmgB0T8PczBLbDgZGvg,1340
|
@@ -309,7 +309,7 @@ osbot_utils/type_safe/methods/type_safe_property.py,sha256=DcJkOIs6swJtkglsZVKLy
|
|
309
309
|
osbot_utils/type_safe/shared/Type_Safe__Annotations.py,sha256=nmVqCbhk4kUYrw_mdYqugxQlv4gM3NUUH89FYTHUg-c,1133
|
310
310
|
osbot_utils/type_safe/shared/Type_Safe__Cache.py,sha256=G03pmpds9sTwU5z5pNLssD_GTvVSIR11nGYbkV5KaiY,7913
|
311
311
|
osbot_utils/type_safe/shared/Type_Safe__Convert.py,sha256=mS92_sKjKM_aNSB3ERMEgv-3DtkLVAS8AZF067G-JWM,2995
|
312
|
-
osbot_utils/type_safe/shared/Type_Safe__Json_Compressor.py,sha256=
|
312
|
+
osbot_utils/type_safe/shared/Type_Safe__Json_Compressor.py,sha256=TDbot_NNzCPXBQv0l5mksWueJNfxlVFDBGxIH8Jf_XY,5426
|
313
313
|
osbot_utils/type_safe/shared/Type_Safe__Json_Compressor__Type_Registry.py,sha256=wYOCg7F1nTrRn8HlnZvrs_8A8WL4gxRYRLnXZpGIiuk,1119
|
314
314
|
osbot_utils/type_safe/shared/Type_Safe__Not_Cached.py,sha256=25FAl6SOLxdStco_rm9tgOYLfuKyBWheGdl7vVa56UU,800
|
315
315
|
osbot_utils/type_safe/shared/Type_Safe__Raise_Exception.py,sha256=pbru8k8CTQMNUfmFBndiJhg2KkqEYzFvJAPcNZHeHfQ,829
|
@@ -355,8 +355,8 @@ osbot_utils/utils/Toml.py,sha256=Rxl8gx7mni5CvBAK-Ai02EKw-GwtJdd3yeHT2kMloik,166
|
|
355
355
|
osbot_utils/utils/Version.py,sha256=Ww6ChwTxqp1QAcxOnztkTicShlcx6fbNsWX5xausHrg,422
|
356
356
|
osbot_utils/utils/Zip.py,sha256=pR6sKliUY0KZXmqNzKY2frfW-YVQEVbLKiyqQX_lc-8,14052
|
357
357
|
osbot_utils/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
358
|
-
osbot_utils/version,sha256=
|
359
|
-
osbot_utils-2.
|
360
|
-
osbot_utils-2.
|
361
|
-
osbot_utils-2.
|
362
|
-
osbot_utils-2.
|
358
|
+
osbot_utils/version,sha256=2yKGk7vQk8voS72-fsPKVRYwaYPim2jqyO2XPZKS4PU,8
|
359
|
+
osbot_utils-2.27.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
360
|
+
osbot_utils-2.27.0.dist-info/METADATA,sha256=sH6l_FyHwMRoGTxMYy2eJOdKAkc_pk7FegSFT_ejO0U,1329
|
361
|
+
osbot_utils-2.27.0.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
362
|
+
osbot_utils-2.27.0.dist-info/RECORD,,
|
File without changes
|