osbot-utils 2.75.0__py3-none-any.whl → 2.76.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/type_safe/type_safe_core/steps/Type_Safe__Step__Class_Kwargs.py +30 -6
- osbot_utils/version +1 -1
- {osbot_utils-2.75.0.dist-info → osbot_utils-2.76.0.dist-info}/METADATA +2 -2
- {osbot_utils-2.75.0.dist-info → osbot_utils-2.76.0.dist-info}/RECORD +6 -6
- {osbot_utils-2.75.0.dist-info → osbot_utils-2.76.0.dist-info}/LICENSE +0 -0
- {osbot_utils-2.75.0.dist-info → osbot_utils-2.76.0.dist-info}/WHEEL +0 -0
@@ -65,15 +65,39 @@ class Type_Safe__Step__Class_Kwargs:
|
|
65
65
|
var_name : str ,
|
66
66
|
var_type : Type )\
|
67
67
|
-> None:
|
68
|
-
var_value = getattr(base_cls, var_name) # Get current value
|
69
|
-
if var_value is None: # Allow None assignments
|
68
|
+
# var_value = getattr(base_cls, var_name) # Get current value
|
69
|
+
# if var_value is None: # Allow None assignments
|
70
|
+
# return
|
71
|
+
#
|
72
|
+
# if type_safe_validation.should_skip_type_check(var_type): # Skip validation if needed
|
73
|
+
# return
|
74
|
+
#
|
75
|
+
# type_safe_validation.validate_variable_type (var_name, var_type, var_value) # Validate type
|
76
|
+
# type_safe_validation.validate_type_immutability(var_name, var_type) # Validate immutability
|
77
|
+
|
78
|
+
var_value = getattr(base_cls, var_name)
|
79
|
+
if var_value is None:
|
70
80
|
return
|
71
|
-
|
72
|
-
if type_safe_validation.should_skip_type_check(var_type): # Skip validation if needed
|
81
|
+
if type_safe_validation.should_skip_type_check(var_type):
|
73
82
|
return
|
74
83
|
|
75
|
-
|
76
|
-
|
84
|
+
# NEW: Try to convert primitive values to Type_Safe__Primitive types
|
85
|
+
from osbot_utils.type_safe.Type_Safe__Primitive import Type_Safe__Primitive
|
86
|
+
if (isinstance(var_type, type) and
|
87
|
+
issubclass(var_type, Type_Safe__Primitive) and
|
88
|
+
type(var_value) in (str, int, float)):
|
89
|
+
try:
|
90
|
+
# Attempt conversion and validate the converted value
|
91
|
+
converted_value = var_type(var_value)
|
92
|
+
# Set the converted value back on the class
|
93
|
+
setattr(base_cls, var_name, converted_value)
|
94
|
+
var_value = converted_value
|
95
|
+
except (ValueError, TypeError):
|
96
|
+
# If conversion fails, let the original validation handle it
|
97
|
+
pass
|
98
|
+
|
99
|
+
type_safe_validation.validate_variable_type(var_name, var_type, var_value)
|
100
|
+
type_safe_validation.validate_type_immutability(var_name, var_type)
|
77
101
|
|
78
102
|
def process_annotation(self, cls : Type , # Process single annotation
|
79
103
|
base_cls : Type ,
|
osbot_utils/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
v2.
|
1
|
+
v2.76.0
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: osbot_utils
|
3
|
-
Version: 2.
|
3
|
+
Version: 2.76.0
|
4
4
|
Summary: OWASP Security Bot - Utils
|
5
5
|
License: MIT
|
6
6
|
Author: Dinis Cruz
|
@@ -21,7 +21,7 @@ Description-Content-Type: text/markdown
|
|
21
21
|
|
22
22
|
# OSBot-Utils
|
23
23
|
|
24
|
-

|
25
25
|

|
26
26
|

|
27
27
|

|
@@ -423,7 +423,7 @@ osbot_utils/type_safe/type_safe_core/shared/Type_Safe__Raise_Exception.py,sha256
|
|
423
423
|
osbot_utils/type_safe/type_safe_core/shared/Type_Safe__Shared__Variables.py,sha256=SuZGl9LryQX6IpOE0I_lbzClT-h17UNylC__-M8ltTY,129
|
424
424
|
osbot_utils/type_safe/type_safe_core/shared/Type_Safe__Validation.py,sha256=aKtlqYU5uaobgpoOnzU4kKqR7mzVLeG8YcUUbWp7n-g,19648
|
425
425
|
osbot_utils/type_safe/type_safe_core/shared/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
426
|
-
osbot_utils/type_safe/type_safe_core/steps/Type_Safe__Step__Class_Kwargs.py,sha256=
|
426
|
+
osbot_utils/type_safe/type_safe_core/steps/Type_Safe__Step__Class_Kwargs.py,sha256=BbMPfCv5-RUZzh-TbyLBvykXZkdkR91jCGJoZ4R697g,8237
|
427
427
|
osbot_utils/type_safe/type_safe_core/steps/Type_Safe__Step__Default_Kwargs.py,sha256=tzKXDUc0HVP5QvCWsmcPuuZodNvQZ9FeMDNI2x00Ngw,1943
|
428
428
|
osbot_utils/type_safe/type_safe_core/steps/Type_Safe__Step__Default_Value.py,sha256=mRu0yV3w7Ch1H8SOfXMRqMBp3ooY95yR_oni7JafJBc,4603
|
429
429
|
osbot_utils/type_safe/type_safe_core/steps/Type_Safe__Step__From_Json.py,sha256=GTZnGC7DvEBA_LxgLw_KZZ1iVUV0EwyIgcZzoh14Bro,15453
|
@@ -462,8 +462,8 @@ osbot_utils/utils/Toml.py,sha256=Rxl8gx7mni5CvBAK-Ai02EKw-GwtJdd3yeHT2kMloik,166
|
|
462
462
|
osbot_utils/utils/Version.py,sha256=Ww6ChwTxqp1QAcxOnztkTicShlcx6fbNsWX5xausHrg,422
|
463
463
|
osbot_utils/utils/Zip.py,sha256=mG42lgTY0tnm14T3P1-DSAIZKkTiYoO3odZ1aOUdc1I,14394
|
464
464
|
osbot_utils/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
465
|
-
osbot_utils/version,sha256=
|
466
|
-
osbot_utils-2.
|
467
|
-
osbot_utils-2.
|
468
|
-
osbot_utils-2.
|
469
|
-
osbot_utils-2.
|
465
|
+
osbot_utils/version,sha256=8BoOt5kr4AI3hSggK9uXi2EyaXnLCCJ0Se4muuaz9wM,8
|
466
|
+
osbot_utils-2.76.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
467
|
+
osbot_utils-2.76.0.dist-info/METADATA,sha256=Nn_qbZC6Qnw6TRHIqJ-oQ_7hH0f67dL4dtcvAeZr8R4,7905
|
468
|
+
osbot_utils-2.76.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
469
|
+
osbot_utils-2.76.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|