osbot-utils 1.77.0__py3-none-any.whl → 1.78.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.
@@ -20,7 +20,8 @@ from osbot_utils.utils.Misc import list_set
20
20
  from osbot_utils.utils.Objects import default_value, value_type_matches_obj_annotation_for_attr, \
21
21
  raise_exception_on_obj_type_annotation_mismatch, obj_is_attribute_annotation_of_type, enum_from_value, \
22
22
  obj_is_type_union_compatible, value_type_matches_obj_annotation_for_union_attr, \
23
- convert_dict_to_value_from_obj_annotation, dict_to_obj, convert_to_value_from_obj_annotation
23
+ convert_dict_to_value_from_obj_annotation, dict_to_obj, convert_to_value_from_obj_annotation, \
24
+ obj_attribute_annotation
24
25
 
25
26
  # Backport implementations of get_origin and get_args for Python 3.7
26
27
  if sys.version_info < (3, 8): # pragma: no cover
@@ -290,6 +291,14 @@ class Type_Safe:
290
291
  continue
291
292
  if obj_is_attribute_annotation_of_type(self, key, dict): # handle the case when the value is a dict
292
293
  value = self.deserialize_dict__using_key_value_annotations(key, value)
294
+ elif obj_is_attribute_annotation_of_type(self, key, list): # handle the case when the value is a list
295
+ attribute_annotation = obj_attribute_annotation(self, key) # get the annotation for this variable
296
+ expected_type = get_args(attribute_annotation)[0] # get the first arg (which is the type)
297
+ type_safe_list = Type_Safe__List(expected_type) # create a new instance of Type_Safe__List
298
+ for item in value: # next we need to convert all items (to make sure they all match the type)
299
+ new_item = expected_type(**item) # create new object
300
+ type_safe_list.append(new_item) # and add it to the new type_safe_list obejct
301
+ value = type_safe_list # todo: refactor out this create list code, maybe to an deserialize_from_list method
293
302
  else:
294
303
  if value is not None:
295
304
  if obj_is_attribute_annotation_of_type(self, key, EnumMeta): # Handle the case when the value is an Enum
osbot_utils/version CHANGED
@@ -1 +1 @@
1
- v1.77.0
1
+ v1.78.0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: osbot_utils
3
- Version: 1.77.0
3
+ Version: 1.78.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.77.0-blue)
26
+ ![Current Release](https://img.shields.io/badge/release-v1.78.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=HFCSsZzPaLWXsdHwbZnlSXiSQkgUz7-zlSKsZdz4rb8,20723
5
+ osbot_utils/base_classes/Type_Safe.py,sha256=3RnP8MRlwVXdMd0hZBUPM0xQULUo5s4BoWDc4s5VKQ4,22010
6
6
  osbot_utils/base_classes/Type_Safe__List.py,sha256=iWyoc2xjHkTJrZTVnPse9Rljte2tF67oNq8yA7jnAhY,5996
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
@@ -306,8 +306,8 @@ osbot_utils/utils/Toml.py,sha256=-_Yv5T8ZhGGoDSSoNEdFhSsXiK_JPjGkPijm4JoeHSk,166
306
306
  osbot_utils/utils/Version.py,sha256=Ww6ChwTxqp1QAcxOnztkTicShlcx6fbNsWX5xausHrg,422
307
307
  osbot_utils/utils/Zip.py,sha256=pR6sKliUY0KZXmqNzKY2frfW-YVQEVbLKiyqQX_lc-8,14052
308
308
  osbot_utils/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
309
- osbot_utils/version,sha256=WF5rBBvc5bDfeYdDp3zj4uegAHZtcSRyRBknn9Uv_w0,8
310
- osbot_utils-1.77.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
311
- osbot_utils-1.77.0.dist-info/METADATA,sha256=rSXu7wvgm-mtJUOczQ64QcXQ6Zwzm_7MAwleL6x3-I4,1317
312
- osbot_utils-1.77.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
313
- osbot_utils-1.77.0.dist-info/RECORD,,
309
+ osbot_utils/version,sha256=iNZGWI4Q60T4H2HfKcEvHaXbPuwoOyLQAdfo28Caebg,8
310
+ osbot_utils-1.78.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
311
+ osbot_utils-1.78.0.dist-info/METADATA,sha256=Z9xFeZDq27qy4sfwSNZxHuVCf8YRb6bk8DvrL1s2lCA,1317
312
+ osbot_utils-1.78.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
313
+ osbot_utils-1.78.0.dist-info/RECORD,,