osbot-utils 2.16.0__py3-none-any.whl → 2.18.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 +12 -12
- osbot_utils/helpers/flows/Task.py +10 -9
- osbot_utils/type_safe/Type_Safe__Base.py +3 -0
- osbot_utils/type_safe/shared/Type_Safe__Validation.py +1 -1
- osbot_utils/type_safe/steps/Type_Safe__Step__From_Json.py +4 -1
- osbot_utils/utils/Json.py +2 -1
- osbot_utils/version +1 -1
- {osbot_utils-2.16.0.dist-info → osbot_utils-2.18.0.dist-info}/METADATA +2 -2
- {osbot_utils-2.16.0.dist-info → osbot_utils-2.18.0.dist-info}/RECORD +11 -11
- {osbot_utils-2.16.0.dist-info → osbot_utils-2.18.0.dist-info}/LICENSE +0 -0
- {osbot_utils-2.16.0.dist-info → osbot_utils-2.18.0.dist-info}/WHEEL +0 -0
@@ -2,17 +2,17 @@ import asyncio
|
|
2
2
|
import logging
|
3
3
|
import typing
|
4
4
|
|
5
|
-
from osbot_utils.helpers.Dependency_Manager
|
6
|
-
from osbot_utils.type_safe.Type_Safe
|
7
|
-
from osbot_utils.helpers.CFormat
|
8
|
-
from osbot_utils.helpers.flows.models.Flow_Run__Config
|
9
|
-
from osbot_utils.helpers.flows.Flow__Events
|
10
|
-
from osbot_utils.helpers.flows.models.Flow_Run__Event_Data
|
11
|
-
from osbot_utils.testing.Stdout
|
12
|
-
from osbot_utils.utils.Misc
|
13
|
-
from osbot_utils.utils.Python_Logger
|
14
|
-
from osbot_utils.utils.Str
|
15
|
-
from osbot_utils.utils.Threads
|
5
|
+
from osbot_utils.helpers.Dependency_Manager import Dependency_Manager
|
6
|
+
from osbot_utils.type_safe.Type_Safe import Type_Safe
|
7
|
+
from osbot_utils.helpers.CFormat import CFormat, f_dark_grey, f_magenta, f_bold
|
8
|
+
from osbot_utils.helpers.flows.models.Flow_Run__Config import Flow_Run__Config
|
9
|
+
from osbot_utils.helpers.flows.Flow__Events import flow_events
|
10
|
+
from osbot_utils.helpers.flows.models.Flow_Run__Event_Data import Flow_Run__Event_Data
|
11
|
+
from osbot_utils.testing.Stdout import Stdout
|
12
|
+
from osbot_utils.utils.Misc import random_id, lower, time_now
|
13
|
+
from osbot_utils.utils.Python_Logger import Python_Logger
|
14
|
+
from osbot_utils.utils.Str import ansis_to_texts
|
15
|
+
from osbot_utils.utils.Threads import invoke_in_new_event_loop
|
16
16
|
|
17
17
|
FLOW__RANDOM_ID__PREFIX = 'flow_id__'
|
18
18
|
FLOW__RANDOM_NAME__PREFIX = 'flow_name__'
|
@@ -20,7 +20,7 @@ FLOW__LOGGING__LOG_FORMAT = '%(asctime)s.%(msecs)03d | %(levelname)-8s | %(mess
|
|
20
20
|
FLOW__LOGGING__DATE_FORMAT = '%H:%M:%S'
|
21
21
|
|
22
22
|
|
23
|
-
|
23
|
+
# todo: add flow duration
|
24
24
|
class Flow(Type_Safe):
|
25
25
|
captured_exec_logs : list
|
26
26
|
data : dict # dict available to the tasks to add and collect data
|
@@ -1,18 +1,19 @@
|
|
1
|
-
import asyncio
|
2
1
|
import inspect
|
3
2
|
import typing
|
4
3
|
|
5
|
-
from osbot_utils.helpers.flows.models.Flow_Run__Event_Data
|
6
|
-
from osbot_utils.utils.Misc
|
7
|
-
from osbot_utils.helpers.Dependency_Manager
|
8
|
-
from osbot_utils.helpers.flows.Flow__Events
|
9
|
-
from osbot_utils.testing.Stdout
|
10
|
-
from osbot_utils.helpers.CFormat
|
11
|
-
from osbot_utils.type_safe.Type_Safe
|
12
|
-
from osbot_utils.helpers.flows.Flow
|
4
|
+
from osbot_utils.helpers.flows.models.Flow_Run__Event_Data import Flow_Run__Event_Data
|
5
|
+
from osbot_utils.utils.Misc import random_id, lower
|
6
|
+
from osbot_utils.helpers.Dependency_Manager import Dependency_Manager
|
7
|
+
from osbot_utils.helpers.flows.Flow__Events import flow_events
|
8
|
+
from osbot_utils.testing.Stdout import Stdout
|
9
|
+
from osbot_utils.helpers.CFormat import CFormat, f_dark_grey, f_red, f_blue, f_bold
|
10
|
+
from osbot_utils.type_safe.Type_Safe import Type_Safe
|
11
|
+
from osbot_utils.helpers.flows.Flow import Flow
|
13
12
|
|
14
13
|
TASK__RANDOM_ID__PREFIX = 'task_id__'
|
15
14
|
|
15
|
+
# todo: add task duration
|
16
|
+
|
16
17
|
class Task(Type_Safe):
|
17
18
|
data : dict # dict available to the task to add and collect data
|
18
19
|
task_id : str
|
@@ -1,4 +1,5 @@
|
|
1
1
|
from typing import get_args, Union, Optional, Any, ForwardRef
|
2
|
+
from osbot_utils.helpers.Obj_Id import Obj_Id
|
2
3
|
from osbot_utils.type_safe.shared.Type_Safe__Cache import type_safe_cache
|
3
4
|
|
4
5
|
EXACT_TYPE_MATCH = (int, float, str, bytes, bool, complex)
|
@@ -63,6 +64,8 @@ class Type_Safe__Base:
|
|
63
64
|
if len(args) != len(item):
|
64
65
|
raise TypeError(f"Expected tuple of length {len(args)}, but got {len(item)}")
|
65
66
|
for idx, (elem, elem_type) in enumerate(zip(item, args)):
|
67
|
+
if elem_type is Obj_Id: # todo: refactor this out, and figure out better way to handle this kind of de-serialisation
|
68
|
+
elem = elem_type(elem)
|
66
69
|
try:
|
67
70
|
self.is_instance_of_type(elem, elem_type)
|
68
71
|
except TypeError as e:
|
@@ -246,7 +246,7 @@ class Type_Safe__Validation:
|
|
246
246
|
type_safe_raise_exception.immutable_type_error(var_name, var_type)
|
247
247
|
|
248
248
|
def validate_variable_type(self, var_name, var_type, var_value): # Validate type compatibility
|
249
|
-
if var_type and not isinstance(var_value, var_type):
|
249
|
+
if type(var_type) is type and not isinstance(var_value, var_type):
|
250
250
|
type_safe_raise_exception.type_mismatch_error(var_name, var_type, type(var_value))
|
251
251
|
|
252
252
|
type_safe_validation = Type_Safe__Validation()
|
@@ -2,6 +2,7 @@ import sys
|
|
2
2
|
import types
|
3
3
|
from decimal import Decimal
|
4
4
|
from enum import EnumMeta
|
5
|
+
from osbot_utils.helpers.Obj_Id import Obj_Id
|
5
6
|
from osbot_utils.type_safe.Type_Safe import Type_Safe
|
6
7
|
from osbot_utils.type_safe.Type_Safe__List import Type_Safe__List
|
7
8
|
from osbot_utils.helpers.Random_Guid import Random_Guid
|
@@ -100,8 +101,10 @@ class Type_Safe__Step__From_Json:
|
|
100
101
|
value = Random_Guid(value)
|
101
102
|
elif type_safe_annotations.obj_is_attribute_annotation_of_type(_self, key, Random_Guid_Short): # handle Random_Guid_Short
|
102
103
|
value = Random_Guid_Short(value)
|
103
|
-
elif type_safe_annotations.obj_is_attribute_annotation_of_type(_self, key, Timestamp_Now):
|
104
|
+
elif type_safe_annotations.obj_is_attribute_annotation_of_type(_self, key, Timestamp_Now ): # handle Timestamp_Now
|
104
105
|
value = Timestamp_Now(value)
|
106
|
+
elif type_safe_annotations.obj_is_attribute_annotation_of_type(_self, key, Obj_Id ): # handle Obj_Id
|
107
|
+
value = Obj_Id(value)
|
105
108
|
|
106
109
|
setattr(_self, key, value) # Direct assignment for primitive types and other structures
|
107
110
|
|
osbot_utils/utils/Json.py
CHANGED
@@ -170,7 +170,7 @@ json_file_create_gz = Json.save_file_gz
|
|
170
170
|
json_file_contents = Json.load_file
|
171
171
|
json_file_contents_gz = Json.load_file_gz
|
172
172
|
json_file_load = Json.load_file
|
173
|
-
|
173
|
+
json_file_save = Json.save_file
|
174
174
|
json_from_file = Json.load_file
|
175
175
|
json_load_file = Json.load_file
|
176
176
|
json_load_file_and_delete = Json.load_file_and_delete
|
@@ -184,6 +184,7 @@ json_lines_loads = Json.loads_json_lines
|
|
184
184
|
json_parse = Json.loads
|
185
185
|
json_lines_parse = Json.loads_json_lines
|
186
186
|
json_to_bytes = json_dumps_to_bytes
|
187
|
+
json_to_file = json_file_save
|
187
188
|
json_to_str = json_dumps
|
188
189
|
json_round_trip = Json.round_trip
|
189
190
|
json_save = Json.save_file
|
osbot_utils/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
v2.
|
1
|
+
v2.18.0
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: osbot_utils
|
3
|
-
Version: 2.
|
3
|
+
Version: 2.18.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,9 +136,9 @@ 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=
|
139
|
+
osbot_utils/helpers/flows/Flow.py,sha256=75Ld9rYHpKIPGFpAexg3oKdBslonkjf9KlUGwyJuzgQ,11059
|
140
140
|
osbot_utils/helpers/flows/Flow__Events.py,sha256=g7KBafFeA7tV-v31v_m3MT__cZEX63gh8CehnZwRYU0,2840
|
141
|
-
osbot_utils/helpers/flows/Task.py,sha256=
|
141
|
+
osbot_utils/helpers/flows/Task.py,sha256=VUDTz8zy5fSMSWdwAJXpuE0ewdhYSNMAgFyEKXpTIpI,5461
|
142
142
|
osbot_utils/helpers/flows/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
143
143
|
osbot_utils/helpers/flows/decorators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
144
144
|
osbot_utils/helpers/flows/decorators/flow.py,sha256=7wj5TtUO_ffbACnagZtZ6LfFgclmbQSfn2lKkMMrnJI,670
|
@@ -284,7 +284,7 @@ osbot_utils/testing/performance/models/Model__Performance_Measure__Measurement.p
|
|
284
284
|
osbot_utils/testing/performance/models/Model__Performance_Measure__Result.py,sha256=k9HJYNLmW6sjRVsfpduSxHFiVANc1zmYtO_Oz9azpW8,755
|
285
285
|
osbot_utils/testing/performance/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
286
286
|
osbot_utils/type_safe/Type_Safe.py,sha256=Yd6s60Ykgke8YuIone-69Ozc4uzEq2fGHu97HTmhydU,5514
|
287
|
-
osbot_utils/type_safe/Type_Safe__Base.py,sha256=
|
287
|
+
osbot_utils/type_safe/Type_Safe__Base.py,sha256=Bzrh8TxFglB0FEUAQTlgovlnFHnBN4lOX1Vu327r1Vc,5223
|
288
288
|
osbot_utils/type_safe/Type_Safe__Dict.py,sha256=vE_Ut7MabBjOq5Hpr3vdFO5RNf-M-cL83S76CvxD-9g,2488
|
289
289
|
osbot_utils/type_safe/Type_Safe__List.py,sha256=SzSIBkwSOAEpW_V2qh4-f0YHzmgB0T8PczBLbDgZGvg,1340
|
290
290
|
osbot_utils/type_safe/Type_Safe__Method.py,sha256=LOG2sqQyKBNNEiJxk_jngH6IWvpyVueouAzNTlj-_pY,12676
|
@@ -301,12 +301,12 @@ osbot_utils/type_safe/shared/Type_Safe__Convert.py,sha256=mS92_sKjKM_aNSB3ERMEgv
|
|
301
301
|
osbot_utils/type_safe/shared/Type_Safe__Not_Cached.py,sha256=25FAl6SOLxdStco_rm9tgOYLfuKyBWheGdl7vVa56UU,800
|
302
302
|
osbot_utils/type_safe/shared/Type_Safe__Raise_Exception.py,sha256=pbru8k8CTQMNUfmFBndiJhg2KkqEYzFvJAPcNZHeHfQ,829
|
303
303
|
osbot_utils/type_safe/shared/Type_Safe__Shared__Variables.py,sha256=SuZGl9LryQX6IpOE0I_lbzClT-h17UNylC__-M8ltTY,129
|
304
|
-
osbot_utils/type_safe/shared/Type_Safe__Validation.py,sha256=
|
304
|
+
osbot_utils/type_safe/shared/Type_Safe__Validation.py,sha256=CNGuTlfGCwm35d_MQ1ssiNFr2OxsbgI_MczqH_-EK6g,16315
|
305
305
|
osbot_utils/type_safe/shared/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
306
306
|
osbot_utils/type_safe/steps/Type_Safe__Step__Class_Kwargs.py,sha256=snoyJKvZ1crgF2fp0zexwNPnV_E63RfyRIsMAZdrKNY,6995
|
307
307
|
osbot_utils/type_safe/steps/Type_Safe__Step__Default_Kwargs.py,sha256=tzKXDUc0HVP5QvCWsmcPuuZodNvQZ9FeMDNI2x00Ngw,1943
|
308
308
|
osbot_utils/type_safe/steps/Type_Safe__Step__Default_Value.py,sha256=K_tkVQyLUbbWYzDnzoPLCgDBAFYyUjAG4VdLsvjzL1g,4485
|
309
|
-
osbot_utils/type_safe/steps/Type_Safe__Step__From_Json.py,sha256=
|
309
|
+
osbot_utils/type_safe/steps/Type_Safe__Step__From_Json.py,sha256=VAIZNqsmkBFta-mW8JzhKJpxG0i1G1boj3cZlbKToms,12154
|
310
310
|
osbot_utils/type_safe/steps/Type_Safe__Step__Init.py,sha256=v4FD7zxQiOFLiOF1Ma8wZMP8aLgRlXwJZnsIfBu2zeg,1266
|
311
311
|
osbot_utils/type_safe/steps/Type_Safe__Step__Set_Attr.py,sha256=VuKHH9QEYlbAL9R4zwQ5dwexx2sFY6wMx52QmF7eqcg,5219
|
312
312
|
osbot_utils/type_safe/steps/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -326,7 +326,7 @@ osbot_utils/utils/Files.py,sha256=yxteAcyhDcUy1_r9Eihx80V16lV_UAE6cvoOe2Dc7DU,23
|
|
326
326
|
osbot_utils/utils/Functions.py,sha256=0E6alPJ0fJpBiJgFOWooCOi265wSRyxxXAJ5CELBnso,3498
|
327
327
|
osbot_utils/utils/Http.py,sha256=Cm_-b2EgxKoQJ47ThZp-dgHCdeGv4UcCNLfTOH94-7s,7790
|
328
328
|
osbot_utils/utils/Int.py,sha256=PmlUdU4lSwf4gJdmTVdqclulkEp7KPCVUDO6AcISMF4,116
|
329
|
-
osbot_utils/utils/Json.py,sha256=
|
329
|
+
osbot_utils/utils/Json.py,sha256=Ux9lXFAjr51etPpzG3J4phlTnY78_4iA-l0uphWTCEY,7183
|
330
330
|
osbot_utils/utils/Json_Cache.py,sha256=mLPkkDZN-3ZVJiDvV1KBJXILtKkTZ4OepzOsDoBPhWg,2006
|
331
331
|
osbot_utils/utils/Lists.py,sha256=tPz5x5s3sRO97WZ_nsxREBPC5cwaHrhgaYBhsrffTT8,5599
|
332
332
|
osbot_utils/utils/Misc.py,sha256=H_xexJgiTxB3jDeDiW8efGQbO0Zuy8MM0iQ7qXC92JI,17363
|
@@ -342,8 +342,8 @@ osbot_utils/utils/Toml.py,sha256=Rxl8gx7mni5CvBAK-Ai02EKw-GwtJdd3yeHT2kMloik,166
|
|
342
342
|
osbot_utils/utils/Version.py,sha256=Ww6ChwTxqp1QAcxOnztkTicShlcx6fbNsWX5xausHrg,422
|
343
343
|
osbot_utils/utils/Zip.py,sha256=pR6sKliUY0KZXmqNzKY2frfW-YVQEVbLKiyqQX_lc-8,14052
|
344
344
|
osbot_utils/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
345
|
-
osbot_utils/version,sha256=
|
346
|
-
osbot_utils-2.
|
347
|
-
osbot_utils-2.
|
348
|
-
osbot_utils-2.
|
349
|
-
osbot_utils-2.
|
345
|
+
osbot_utils/version,sha256=yvU2Z3SdepC8XR54yIqlis54HN4rMdVZtZIYQGakkME,8
|
346
|
+
osbot_utils-2.18.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
347
|
+
osbot_utils-2.18.0.dist-info/METADATA,sha256=lLFPYDtIGosRSw9Kt7AtS3D8ubb2WDN6QrI9A0lyiRM,1329
|
348
|
+
osbot_utils-2.18.0.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
|
349
|
+
osbot_utils-2.18.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|