osbot-utils 1.61.0__py3-none-any.whl → 1.63.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/base_classes/Type_Safe.py +11 -3
- osbot_utils/helpers/Random_Guid_Short.py +15 -0
- osbot_utils/helpers/flows/Flow.py +5 -2
- osbot_utils/helpers/flows/models/Flow_Run__Event_Data.py +1 -1
- osbot_utils/helpers/trace/Trace_Call.py +2 -2
- osbot_utils/utils/Misc.py +1 -0
- osbot_utils/version +1 -1
- {osbot_utils-1.61.0.dist-info → osbot_utils-1.63.0.dist-info}/METADATA +2 -2
- {osbot_utils-1.61.0.dist-info → osbot_utils-1.63.0.dist-info}/RECORD +11 -10
- {osbot_utils-1.61.0.dist-info → osbot_utils-1.63.0.dist-info}/LICENSE +0 -0
- {osbot_utils-1.61.0.dist-info → osbot_utils-1.63.0.dist-info}/WHEEL +0 -0
@@ -11,10 +11,12 @@ from enum import Enum, EnumMeta
|
|
11
11
|
from typing import List
|
12
12
|
from osbot_utils.base_classes.Type_Safe__List import Type_Safe__List
|
13
13
|
from osbot_utils.helpers.Random_Guid import Random_Guid
|
14
|
+
from osbot_utils.helpers.Random_Guid_Short import Random_Guid_Short
|
15
|
+
from osbot_utils.helpers.Timestamp_Now import Timestamp_Now
|
14
16
|
from osbot_utils.utils.Dev import pprint
|
15
17
|
from osbot_utils.utils.Json import json_parse
|
16
18
|
from osbot_utils.utils.Misc import list_set
|
17
|
-
from osbot_utils.utils.Objects
|
19
|
+
from osbot_utils.utils.Objects import default_value, value_type_matches_obj_annotation_for_attr, \
|
18
20
|
raise_exception_on_obj_type_annotation_mismatch, obj_is_attribute_annotation_of_type, enum_from_value, \
|
19
21
|
obj_is_type_union_compatible, value_type_matches_obj_annotation_for_union_attr, \
|
20
22
|
convert_dict_to_value_from_obj_annotation, dict_to_obj
|
@@ -264,10 +266,16 @@ class Type_Safe:
|
|
264
266
|
enum_type = getattr(self, '__annotations__').get(key)
|
265
267
|
if type(value) is not enum_type: # If the value is not already of the target type
|
266
268
|
value = enum_from_value(enum_type, value) # Try to resolve the value into the enum
|
267
|
-
|
269
|
+
|
270
|
+
# todo: refactor these special cases into a separate method to class
|
271
|
+
elif obj_is_attribute_annotation_of_type(self, key, Decimal): # handle Decimals
|
268
272
|
value = Decimal(value)
|
269
|
-
elif obj_is_attribute_annotation_of_type(self, key, Random_Guid): # handle Random_Guid
|
273
|
+
elif obj_is_attribute_annotation_of_type(self, key, Random_Guid): # handle Random_Guid
|
270
274
|
value = Random_Guid(value)
|
275
|
+
elif obj_is_attribute_annotation_of_type(self, key, Random_Guid_Short): # handle Random_Guid_Short
|
276
|
+
value = Random_Guid_Short(value)
|
277
|
+
elif obj_is_attribute_annotation_of_type(self, key, Timestamp_Now): # handle Timestamp_Now
|
278
|
+
value = Timestamp_Now(value)
|
271
279
|
setattr(self, key, value) # Direct assignment for primitive types and other structures
|
272
280
|
|
273
281
|
return self
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# todo add to osbot utils
|
2
|
+
from osbot_utils.utils.Misc import random_guid_short
|
3
|
+
|
4
|
+
|
5
|
+
class Random_Guid_Short(str):
|
6
|
+
def __new__(cls, value=None):
|
7
|
+
if value is None:
|
8
|
+
value = random_guid_short()
|
9
|
+
return str.__new__(cls, value)
|
10
|
+
|
11
|
+
def __init__(self, value=None):
|
12
|
+
self.value = value if value is not None else random_guid_short()
|
13
|
+
|
14
|
+
def __str__(self):
|
15
|
+
return self
|
@@ -9,7 +9,7 @@ from osbot_utils.helpers.flows.models.Flow_Run__Config import Flow_Run__Config
|
|
9
9
|
from osbot_utils.helpers.flows.Flow__Events import flow_events
|
10
10
|
from osbot_utils.helpers.flows.models.Flow_Run__Event_Data import Flow_Run__Event_Data
|
11
11
|
from osbot_utils.testing.Stdout import Stdout
|
12
|
-
from osbot_utils.utils.Misc
|
12
|
+
from osbot_utils.utils.Misc import random_id, lower, time_now
|
13
13
|
from osbot_utils.utils.Python_Logger import Python_Logger
|
14
14
|
from osbot_utils.utils.Str import ansis_to_texts
|
15
15
|
from osbot_utils.utils.Threads import invoke_in_new_event_loop
|
@@ -24,7 +24,7 @@ FLOW__LOGGING__DATE_FORMAT = '%H:%M:%S'
|
|
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
|
27
|
-
flow_id : str
|
27
|
+
flow_id : str # rename to flow_run_id (or also capture the flow_run_id)
|
28
28
|
flow_name : str
|
29
29
|
flow_config : Flow_Run__Config
|
30
30
|
flow_error : Exception = None
|
@@ -198,6 +198,9 @@ class Flow(Type_Safe):
|
|
198
198
|
*self.flow_args,
|
199
199
|
**self.flow_kwargs)
|
200
200
|
|
201
|
+
def set_flow_id__time_now(self):
|
202
|
+
self.flow_id = time_now(milliseconds_numbers=1)
|
203
|
+
|
201
204
|
def set_flow_target(self, target, *args, **kwargs):
|
202
205
|
self.flow_target = target
|
203
206
|
self.flow_args = args
|
@@ -6,7 +6,7 @@ from osbot_utils.base_classes.Type_Safe import Type_Safe
|
|
6
6
|
class Flow_Run__Event_Data(Type_Safe):
|
7
7
|
data : dict
|
8
8
|
event_source: str
|
9
|
-
flow_id : str = None
|
9
|
+
#flow_id : str = None # todo: add support for capturing the actual flow_idq
|
10
10
|
flow_name : str = None
|
11
11
|
flow_run_id : str = None
|
12
12
|
log_level : int = logging.INFO
|
@@ -9,8 +9,8 @@ from osbot_utils.helpers.trace.Trace_Call__Handler import Trace_Call__H
|
|
9
9
|
from osbot_utils.helpers.trace.Trace_Call__Print_Lines import Trace_Call__Print_Lines
|
10
10
|
from osbot_utils.helpers.trace.Trace_Call__Print_Traces import Trace_Call__Print_Traces
|
11
11
|
from osbot_utils.helpers.trace.Trace_Call__View_Model import Trace_Call__View_Model
|
12
|
-
from osbot_utils.testing.Stdout
|
13
|
-
from osbot_utils.utils.Str
|
12
|
+
from osbot_utils.testing.Stdout import Stdout
|
13
|
+
from osbot_utils.utils.Str import ansi_to_text
|
14
14
|
|
15
15
|
|
16
16
|
def trace_calls(title = None , print_traces = True , show_locals = False, source_code = False ,
|
osbot_utils/utils/Misc.py
CHANGED
osbot_utils/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
v1.
|
1
|
+
v1.63.0
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: osbot_utils
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.63.0
|
4
4
|
Summary: OWASP Security Bot - Utils
|
5
5
|
Home-page: https://github.com/owasp-sbot/OSBot-Utils
|
6
6
|
License: MIT
|
@@ -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
|
|
@@ -2,7 +2,7 @@ osbot_utils/__init__.py,sha256=DdJDmQc9zbQUlPVyTJOww6Ixrn9n4bD3ami5ItQfzJI,16
|
|
2
2
|
osbot_utils/base_classes/Cache_Pickle.py,sha256=kPCwrgUbf_dEdxUz7vW1GuvIPwlNXxuRhb-H3AbSpII,5884
|
3
3
|
osbot_utils/base_classes/Kwargs_To_Disk.py,sha256=HHoy05NC_w35WcT-OnSKoSIV_cLqaU9rdjH0_KNTM0E,1096
|
4
4
|
osbot_utils/base_classes/Kwargs_To_Self.py,sha256=weFNsBfBNV9W_qBkN-IdBD4yYcJV_zgTxBRO-ZlcPS4,141
|
5
|
-
osbot_utils/base_classes/Type_Safe.py,sha256=
|
5
|
+
osbot_utils/base_classes/Type_Safe.py,sha256=eWdLnt-vRqr6bX1TR3tINSqm2KeVXQSzQs6pxq0Ep5I,18476
|
6
6
|
osbot_utils/base_classes/Type_Safe__List.py,sha256=-80C9OhsK6iDR2dAG8yNLAZV0qg5x3faqvSUigFCMJw,517
|
7
7
|
osbot_utils/base_classes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
8
|
osbot_utils/context_managers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -66,6 +66,7 @@ osbot_utils/helpers/Local_Caches.py,sha256=aQmi1HSM0TH6WQPedG2fbz4KCCJ3DQTU9d18r
|
|
66
66
|
osbot_utils/helpers/Print_Table.py,sha256=LEXbyqGg_6WSraI4cob4bNNSu18ddqvALp1zGK7bPhs,19126
|
67
67
|
osbot_utils/helpers/Python_Audit.py,sha256=shpZlluJwqJBAlad6xN01FkgC1TsQ48RLvR5ZjmrKa4,1539
|
68
68
|
osbot_utils/helpers/Random_Guid.py,sha256=_wlyM17SIr-FeYESwnVt4cfkEtRRf-dbYh_lTnrKVG0,379
|
69
|
+
osbot_utils/helpers/Random_Guid_Short.py,sha256=YP_k5OLuYvXWGU2OEnQHk_OGViBQofTWKm3pUdQaJao,404
|
69
70
|
osbot_utils/helpers/Random_Seed.py,sha256=14btja8LDN9cMGWaz4fCNcMRU_eyx49gas-_PQvHgy4,634
|
70
71
|
osbot_utils/helpers/Timestamp_Now.py,sha256=Vmdsm-pgvxkkQ_Qj_9Watr8rXXSvc-aBxWMPFGQx8Z0,371
|
71
72
|
osbot_utils/helpers/Type_Registry.py,sha256=Ajk3SyMSKDi2g9SJYUtTgg7PZkAgydaHcpbGuEN3S94,311
|
@@ -155,7 +156,7 @@ osbot_utils/helpers/cache_requests/Cache__Requests__Row.py,sha256=h-yc7NkpScbHww
|
|
155
156
|
osbot_utils/helpers/cache_requests/Cache__Requests__Table.py,sha256=RgxAYhm-FIrXXteQRtD91pOLq8JXhSzxb51Jb6MTUdY,391
|
156
157
|
osbot_utils/helpers/cache_requests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
157
158
|
osbot_utils/helpers/cache_requests/flows/flow__Cache__Requests.py,sha256=xgx_oExxkcvRwQN1UCobimECIMUKGoIX5oGdCmp8Nyw,243
|
158
|
-
osbot_utils/helpers/flows/Flow.py,sha256=
|
159
|
+
osbot_utils/helpers/flows/Flow.py,sha256=oaNYmCxqYC8DxX7egZDVo7Id4pqqcRymKTTlDmy8pGs,10965
|
159
160
|
osbot_utils/helpers/flows/Flow__Events.py,sha256=_BHXh9v1GfvTI7hGx7eJDkCGeo9VjqDoCTMDeL09Ujc,2843
|
160
161
|
osbot_utils/helpers/flows/Task.py,sha256=3PiU1GCWhnDcgYxYRldo0CWcCcnQDvWvU2cXPCmpSTc,5336
|
161
162
|
osbot_utils/helpers/flows/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -164,7 +165,7 @@ osbot_utils/helpers/flows/decorators/flow.py,sha256=7wj5TtUO_ffbACnagZtZ6LfFgclm
|
|
164
165
|
osbot_utils/helpers/flows/decorators/task.py,sha256=9bhQBPJU1dO-J4FAsFkmxqQMBNtay4FT_b1BdpHJ9sA,734
|
165
166
|
osbot_utils/helpers/flows/models/Flow_Run__Config.py,sha256=3JSPSG3vjM7mdnI-3wgLCc7Nc_3Xjqxn34_A6yUp-4Q,386
|
166
167
|
osbot_utils/helpers/flows/models/Flow_Run__Event.py,sha256=-F_H_Tq119qa9tk8IoX5U36h_f8AE1VueL0olhjH24g,569
|
167
|
-
osbot_utils/helpers/flows/models/Flow_Run__Event_Data.py,sha256=
|
168
|
+
osbot_utils/helpers/flows/models/Flow_Run__Event_Data.py,sha256=Xvv_vtOL-siSdt5nkRCLA7uHxlsA3bTm7ZD_EOkCVAU,405
|
168
169
|
osbot_utils/helpers/flows/models/Flow_Run__Event_Type.py,sha256=-iHKNQ-Ar2UfiCraFYQNHdBQ9fNcTTRoh3kRpXRS_Gc,375
|
169
170
|
osbot_utils/helpers/flows/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
170
171
|
osbot_utils/helpers/html/Dict_To_Css.py,sha256=u6B4Mx7PXr-gDrTrs1hgknnvsZVK4Fic5LqedKjo-lk,1097
|
@@ -244,7 +245,7 @@ osbot_utils/helpers/ssh/SSH__Linux__Amazon.py,sha256=ZJFb7LFTvclAuhH5OoOtJ361NoX
|
|
244
245
|
osbot_utils/helpers/ssh/SSH__Python.py,sha256=O2DAwkbXzwkis8lffoqIL2NPSfYcN44Mr8i9Ey2iMKk,2066
|
245
246
|
osbot_utils/helpers/ssh/TestCase__SSH.py,sha256=MD8sq0_kI4f6pEmEO0cLq2mQOhIqbP45ZxFJNG44Jg4,1773
|
246
247
|
osbot_utils/helpers/ssh/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
247
|
-
osbot_utils/helpers/trace/Trace_Call.py,sha256=
|
248
|
+
osbot_utils/helpers/trace/Trace_Call.py,sha256=O_y6cncgneYrj3ARDMz-o9Yi1LjsESibUqkGFAg0Jk0,8886
|
248
249
|
osbot_utils/helpers/trace/Trace_Call__Config.py,sha256=qd6HpF1olvlQ9BU3-gvxRdnP0l7w7noCXpF561gkyUk,3305
|
249
250
|
osbot_utils/helpers/trace/Trace_Call__Graph.py,sha256=HCrXRKQI42DIQxxyFLcaosWiOcUyoITbeV17ICdXcXM,1156
|
250
251
|
osbot_utils/helpers/trace/Trace_Call__Handler.py,sha256=hdgiawoC4K2DrMAHbz2706SfEcxPdX9kK0gjyWqjSzQ,12400
|
@@ -291,7 +292,7 @@ osbot_utils/utils/Int.py,sha256=PmlUdU4lSwf4gJdmTVdqclulkEp7KPCVUDO6AcISMF4,116
|
|
291
292
|
osbot_utils/utils/Json.py,sha256=yIT2hUI23gYd24Uf3LCjqPNV67zS46rYZftcCM3jw-Q,6492
|
292
293
|
osbot_utils/utils/Json_Cache.py,sha256=mLPkkDZN-3ZVJiDvV1KBJXILtKkTZ4OepzOsDoBPhWg,2006
|
293
294
|
osbot_utils/utils/Lists.py,sha256=tPz5x5s3sRO97WZ_nsxREBPC5cwaHrhgaYBhsrffTT8,5599
|
294
|
-
osbot_utils/utils/Misc.py,sha256=
|
295
|
+
osbot_utils/utils/Misc.py,sha256=4MkG2BE1VzZfV4KPzYZ4jVAoUwoA3pTTVPi609ldLGA,16961
|
295
296
|
osbot_utils/utils/Objects.py,sha256=_BWr7KA8Xzzxu6fyxHSqDqDM1Pkyr5IZUFo_hMf7oTo,17612
|
296
297
|
osbot_utils/utils/Png.py,sha256=V1juGp6wkpPigMJ8HcxrPDIP4bSwu51oNkLI8YqP76Y,1172
|
297
298
|
osbot_utils/utils/Process.py,sha256=lr3CTiEkN3EiBx3ZmzYmTKlQoPdkgZBRjPulMxG-zdo,2357
|
@@ -304,8 +305,8 @@ osbot_utils/utils/Toml.py,sha256=SD6IA4-mrtoBXcI0dIGKV9POMQNd6WYKvmDQq7GQ6ZQ,143
|
|
304
305
|
osbot_utils/utils/Version.py,sha256=Ww6ChwTxqp1QAcxOnztkTicShlcx6fbNsWX5xausHrg,422
|
305
306
|
osbot_utils/utils/Zip.py,sha256=G6Hk_hDcm9yvWzhTKzhT0R_6f0NBIAchHqMxGb3kfh4,14037
|
306
307
|
osbot_utils/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
307
|
-
osbot_utils/version,sha256=
|
308
|
-
osbot_utils-1.
|
309
|
-
osbot_utils-1.
|
310
|
-
osbot_utils-1.
|
311
|
-
osbot_utils-1.
|
308
|
+
osbot_utils/version,sha256=2IflaXKoRpTJA1_I8a84R90o-JFwLcsc7YlBVt7zn4o,8
|
309
|
+
osbot_utils-1.63.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
310
|
+
osbot_utils-1.63.0.dist-info/METADATA,sha256=ow3SezUF70n12L-FywN1kJe8qAJy4c3u7kHT4HZVBp0,1317
|
311
|
+
osbot_utils-1.63.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
312
|
+
osbot_utils-1.63.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|