osbot-utils 2.16.0__py3-none-any.whl → 2.17.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.
@@ -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()
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
- json_file_safe = Json.save_file
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.16.0
1
+ v2.17.0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: osbot_utils
3
- Version: 2.16.0
3
+ Version: 2.17.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
- ![Current Release](https://img.shields.io/badge/release-v2.16.0-blue)
26
+ ![Current Release](https://img.shields.io/badge/release-v2.17.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
 
@@ -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=MD9Peg_nI1X0Z_eaEYfxUkCLgu_jFNAMq3KoUvI_wrw,4945
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,7 +301,7 @@ 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=LW0vqaW1ugOMuMmuofstC_DRr2QCtRvhtaK2IC2N7KA,16301
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
@@ -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=0t7Hwefx8bg4JiZVr-xIbWP3BAk6_ZsnY7iV5pnRLDQ,7137
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=kbPgKTSrHcTYIQSNpjw5655sd1n45CbPrdcXIS_fj5I,8
346
- osbot_utils-2.16.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
347
- osbot_utils-2.16.0.dist-info/METADATA,sha256=rZqC0khpO-fwhN6NfHb27LuW5r5rCgL98vOF_yn2pYA,1329
348
- osbot_utils-2.16.0.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
349
- osbot_utils-2.16.0.dist-info/RECORD,,
345
+ osbot_utils/version,sha256=ZHBqd_qW1PoBoW3OWG9plgM2aZqI6Nk0w_6jIgeVD8k,8
346
+ osbot_utils-2.17.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
347
+ osbot_utils-2.17.0.dist-info/METADATA,sha256=tErQvlAQMNNnFWmAWdtStwvyVOhF2kNJveDfuEPTWsI,1329
348
+ osbot_utils-2.17.0.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
349
+ osbot_utils-2.17.0.dist-info/RECORD,,