osbot-utils 1.61.0__py3-none-any.whl → 1.62.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.
@@ -11,10 +11,11 @@ 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.Timestamp_Now import Timestamp_Now
14
15
  from osbot_utils.utils.Dev import pprint
15
16
  from osbot_utils.utils.Json import json_parse
16
17
  from osbot_utils.utils.Misc import list_set
17
- from osbot_utils.utils.Objects import default_value, value_type_matches_obj_annotation_for_attr, \
18
+ from osbot_utils.utils.Objects import default_value, value_type_matches_obj_annotation_for_attr, \
18
19
  raise_exception_on_obj_type_annotation_mismatch, obj_is_attribute_annotation_of_type, enum_from_value, \
19
20
  obj_is_type_union_compatible, value_type_matches_obj_annotation_for_union_attr, \
20
21
  convert_dict_to_value_from_obj_annotation, dict_to_obj
@@ -264,10 +265,14 @@ class Type_Safe:
264
265
  enum_type = getattr(self, '__annotations__').get(key)
265
266
  if type(value) is not enum_type: # If the value is not already of the target type
266
267
  value = enum_from_value(enum_type, value) # Try to resolve the value into the enum
267
- elif obj_is_attribute_annotation_of_type(self, key, Decimal): # handle Decimals # todo: refactor these special cases into a separate method to class
268
+
269
+ # todo: refactor these special cases into a separate method to class
270
+ elif obj_is_attribute_annotation_of_type(self, key, Decimal): # handle Decimals
268
271
  value = Decimal(value)
269
272
  elif obj_is_attribute_annotation_of_type(self, key, Random_Guid): # handle Random_Guid objects
270
273
  value = Random_Guid(value)
274
+ elif obj_is_attribute_annotation_of_type(self, key, Timestamp_Now):
275
+ value = Timestamp_Now(value)
271
276
  setattr(self, key, value) # Direct assignment for primitive types and other structures
272
277
 
273
278
  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 import random_id, lower
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 import Stdout
13
- from osbot_utils.utils.Str import ansi_to_text
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/version CHANGED
@@ -1 +1 @@
1
- v1.61.0
1
+ v1.62.0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: osbot_utils
3
- Version: 1.61.0
3
+ Version: 1.62.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
- ![Current Release](https://img.shields.io/badge/release-v1.61.0-blue)
26
+ ![Current Release](https://img.shields.io/badge/release-v1.62.0-blue)
27
27
  [![codecov](https://codecov.io/gh/owasp-sbot/OSBot-Utils/graph/badge.svg?token=GNVW0COX1N)](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=SwgDhPKeC2jUWNmihUXwvDoXFhnZPOSrrsu1YnCyyx0,17961
5
+ osbot_utils/base_classes/Type_Safe.py,sha256=mJwLse2YkJ1N6N_C1_A3V5u-MLMXklHh8sYATfqdmUs,18208
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
@@ -155,7 +155,7 @@ osbot_utils/helpers/cache_requests/Cache__Requests__Row.py,sha256=h-yc7NkpScbHww
155
155
  osbot_utils/helpers/cache_requests/Cache__Requests__Table.py,sha256=RgxAYhm-FIrXXteQRtD91pOLq8JXhSzxb51Jb6MTUdY,391
156
156
  osbot_utils/helpers/cache_requests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
157
157
  osbot_utils/helpers/cache_requests/flows/flow__Cache__Requests.py,sha256=xgx_oExxkcvRwQN1UCobimECIMUKGoIX5oGdCmp8Nyw,243
158
- osbot_utils/helpers/flows/Flow.py,sha256=2oUlvX5wyTZT1K5hkNn8owwCLb84nTUXelpRH1E0IPE,10812
158
+ osbot_utils/helpers/flows/Flow.py,sha256=oaNYmCxqYC8DxX7egZDVo7Id4pqqcRymKTTlDmy8pGs,10965
159
159
  osbot_utils/helpers/flows/Flow__Events.py,sha256=_BHXh9v1GfvTI7hGx7eJDkCGeo9VjqDoCTMDeL09Ujc,2843
160
160
  osbot_utils/helpers/flows/Task.py,sha256=3PiU1GCWhnDcgYxYRldo0CWcCcnQDvWvU2cXPCmpSTc,5336
161
161
  osbot_utils/helpers/flows/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -164,7 +164,7 @@ osbot_utils/helpers/flows/decorators/flow.py,sha256=7wj5TtUO_ffbACnagZtZ6LfFgclm
164
164
  osbot_utils/helpers/flows/decorators/task.py,sha256=9bhQBPJU1dO-J4FAsFkmxqQMBNtay4FT_b1BdpHJ9sA,734
165
165
  osbot_utils/helpers/flows/models/Flow_Run__Config.py,sha256=3JSPSG3vjM7mdnI-3wgLCc7Nc_3Xjqxn34_A6yUp-4Q,386
166
166
  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=FlL1MifonjzHnHYtiVTMeZWu2WxjCNU5-D9VrF18Ces,340
167
+ osbot_utils/helpers/flows/models/Flow_Run__Event_Data.py,sha256=Xvv_vtOL-siSdt5nkRCLA7uHxlsA3bTm7ZD_EOkCVAU,405
168
168
  osbot_utils/helpers/flows/models/Flow_Run__Event_Type.py,sha256=-iHKNQ-Ar2UfiCraFYQNHdBQ9fNcTTRoh3kRpXRS_Gc,375
169
169
  osbot_utils/helpers/flows/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
170
170
  osbot_utils/helpers/html/Dict_To_Css.py,sha256=u6B4Mx7PXr-gDrTrs1hgknnvsZVK4Fic5LqedKjo-lk,1097
@@ -244,7 +244,7 @@ osbot_utils/helpers/ssh/SSH__Linux__Amazon.py,sha256=ZJFb7LFTvclAuhH5OoOtJ361NoX
244
244
  osbot_utils/helpers/ssh/SSH__Python.py,sha256=O2DAwkbXzwkis8lffoqIL2NPSfYcN44Mr8i9Ey2iMKk,2066
245
245
  osbot_utils/helpers/ssh/TestCase__SSH.py,sha256=MD8sq0_kI4f6pEmEO0cLq2mQOhIqbP45ZxFJNG44Jg4,1773
246
246
  osbot_utils/helpers/ssh/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
247
- osbot_utils/helpers/trace/Trace_Call.py,sha256=SNaYju1KA6UKaCZcaDoPadvSahdl0vOX27unGl0-ZEM,8825
247
+ osbot_utils/helpers/trace/Trace_Call.py,sha256=O_y6cncgneYrj3ARDMz-o9Yi1LjsESibUqkGFAg0Jk0,8886
248
248
  osbot_utils/helpers/trace/Trace_Call__Config.py,sha256=qd6HpF1olvlQ9BU3-gvxRdnP0l7w7noCXpF561gkyUk,3305
249
249
  osbot_utils/helpers/trace/Trace_Call__Graph.py,sha256=HCrXRKQI42DIQxxyFLcaosWiOcUyoITbeV17ICdXcXM,1156
250
250
  osbot_utils/helpers/trace/Trace_Call__Handler.py,sha256=hdgiawoC4K2DrMAHbz2706SfEcxPdX9kK0gjyWqjSzQ,12400
@@ -304,8 +304,8 @@ osbot_utils/utils/Toml.py,sha256=SD6IA4-mrtoBXcI0dIGKV9POMQNd6WYKvmDQq7GQ6ZQ,143
304
304
  osbot_utils/utils/Version.py,sha256=Ww6ChwTxqp1QAcxOnztkTicShlcx6fbNsWX5xausHrg,422
305
305
  osbot_utils/utils/Zip.py,sha256=G6Hk_hDcm9yvWzhTKzhT0R_6f0NBIAchHqMxGb3kfh4,14037
306
306
  osbot_utils/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
307
- osbot_utils/version,sha256=AxhppEeDw-7cq3HMr0l7OrPCdy5R5eZ7MF-27O2MVqs,8
308
- osbot_utils-1.61.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
309
- osbot_utils-1.61.0.dist-info/METADATA,sha256=yiavdHaHNU9h8VejBNAUqWYEl8itBbWeIfWhRIFngRU,1317
310
- osbot_utils-1.61.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
311
- osbot_utils-1.61.0.dist-info/RECORD,,
307
+ osbot_utils/version,sha256=t5GvHM3BFJKVwG6I2p5p6SQw4lfzxAW8lcChUt6LLf0,8
308
+ osbot_utils-1.62.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
309
+ osbot_utils-1.62.0.dist-info/METADATA,sha256=PwQ_vRX-GGGAMlrnfCp6kjXQ25nsSSLwG9BI5gAxEOo,1317
310
+ osbot_utils-1.62.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
311
+ osbot_utils-1.62.0.dist-info/RECORD,,