osbot-utils 2.24.0__py3-none-any.whl → 2.26.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/shared/Type_Safe__Validation.py +10 -6
- osbot_utils/type_safe/steps/Type_Safe__Step__From_Json.py +1 -1
- osbot_utils/version +1 -1
- {osbot_utils-2.24.0.dist-info → osbot_utils-2.26.0.dist-info}/METADATA +2 -2
- {osbot_utils-2.24.0.dist-info → osbot_utils-2.26.0.dist-info}/RECORD +7 -7
- {osbot_utils-2.24.0.dist-info → osbot_utils-2.26.0.dist-info}/LICENSE +0 -0
- {osbot_utils-2.24.0.dist-info → osbot_utils-2.26.0.dist-info}/WHEEL +0 -0
@@ -166,12 +166,16 @@ class Type_Safe__Validation:
|
|
166
166
|
if type(value) is list:
|
167
167
|
return True # if the attribute is a set and the value is a list, then they are compatible
|
168
168
|
if origin_attr_type is type: # Add handling for Type[T]
|
169
|
-
|
170
|
-
if
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
169
|
+
type_args = get_args(attr_type)
|
170
|
+
if type_args:
|
171
|
+
type_arg = get_args(attr_type)[0] # Get T from Type[T]
|
172
|
+
if type_arg == value:
|
173
|
+
return True
|
174
|
+
if isinstance(type_arg, (str, ForwardRef)): # Handle forward reference
|
175
|
+
type_arg = target.__class__ # If it's a forward reference, the target class should be the containing class
|
176
|
+
return isinstance(value, type) and issubclass(value, type_arg) # Check that value is a type and is subclass of type_arg
|
177
|
+
else:
|
178
|
+
return isinstance(value, type)
|
175
179
|
|
176
180
|
if origin_attr_type is Annotated: # if the type is Annotated
|
177
181
|
args = get_args(attr_type)
|
@@ -142,7 +142,7 @@ class Type_Safe__Step__From_Json:
|
|
142
142
|
expected_dict_type = get_args(key_class)[0]
|
143
143
|
if dict_key != expected_dict_type and not issubclass(dict_key,expected_dict_type):
|
144
144
|
raise TypeError(f"Expected {expected_dict_type} class for key but got instance: {dict_key}")
|
145
|
-
new__dict_key =
|
145
|
+
new__dict_key = dict_key
|
146
146
|
elif issubclass(key_class, Type_Safe):
|
147
147
|
new__dict_key = self.deserialize_from_dict(key_class(), dict_key)
|
148
148
|
else:
|
osbot_utils/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
v2.
|
1
|
+
v2.26.0
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: osbot_utils
|
3
|
-
Version: 2.
|
3
|
+
Version: 2.26.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
|
-

|
27
27
|
[](https://codecov.io/gh/owasp-sbot/OSBot-Utils)
|
28
28
|
|
29
29
|
|
@@ -314,12 +314,12 @@ osbot_utils/type_safe/shared/Type_Safe__Json_Compressor__Type_Registry.py,sha256
|
|
314
314
|
osbot_utils/type_safe/shared/Type_Safe__Not_Cached.py,sha256=25FAl6SOLxdStco_rm9tgOYLfuKyBWheGdl7vVa56UU,800
|
315
315
|
osbot_utils/type_safe/shared/Type_Safe__Raise_Exception.py,sha256=pbru8k8CTQMNUfmFBndiJhg2KkqEYzFvJAPcNZHeHfQ,829
|
316
316
|
osbot_utils/type_safe/shared/Type_Safe__Shared__Variables.py,sha256=SuZGl9LryQX6IpOE0I_lbzClT-h17UNylC__-M8ltTY,129
|
317
|
-
osbot_utils/type_safe/shared/Type_Safe__Validation.py,sha256=
|
317
|
+
osbot_utils/type_safe/shared/Type_Safe__Validation.py,sha256=1oamgApW2Pug0vvTqMLPxBLFvtcnp1bFnjSUByfJBrs,19192
|
318
318
|
osbot_utils/type_safe/shared/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
319
319
|
osbot_utils/type_safe/steps/Type_Safe__Step__Class_Kwargs.py,sha256=snoyJKvZ1crgF2fp0zexwNPnV_E63RfyRIsMAZdrKNY,6995
|
320
320
|
osbot_utils/type_safe/steps/Type_Safe__Step__Default_Kwargs.py,sha256=tzKXDUc0HVP5QvCWsmcPuuZodNvQZ9FeMDNI2x00Ngw,1943
|
321
321
|
osbot_utils/type_safe/steps/Type_Safe__Step__Default_Value.py,sha256=K_tkVQyLUbbWYzDnzoPLCgDBAFYyUjAG4VdLsvjzL1g,4485
|
322
|
-
osbot_utils/type_safe/steps/Type_Safe__Step__From_Json.py,sha256=
|
322
|
+
osbot_utils/type_safe/steps/Type_Safe__Step__From_Json.py,sha256=V-ipKwuQq2wjWXj3Nfq5VadxN8F8bPjjNFR5sVH4pRg,12567
|
323
323
|
osbot_utils/type_safe/steps/Type_Safe__Step__Init.py,sha256=v4FD7zxQiOFLiOF1Ma8wZMP8aLgRlXwJZnsIfBu2zeg,1266
|
324
324
|
osbot_utils/type_safe/steps/Type_Safe__Step__Set_Attr.py,sha256=VuKHH9QEYlbAL9R4zwQ5dwexx2sFY6wMx52QmF7eqcg,5219
|
325
325
|
osbot_utils/type_safe/steps/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -355,8 +355,8 @@ osbot_utils/utils/Toml.py,sha256=Rxl8gx7mni5CvBAK-Ai02EKw-GwtJdd3yeHT2kMloik,166
|
|
355
355
|
osbot_utils/utils/Version.py,sha256=Ww6ChwTxqp1QAcxOnztkTicShlcx6fbNsWX5xausHrg,422
|
356
356
|
osbot_utils/utils/Zip.py,sha256=pR6sKliUY0KZXmqNzKY2frfW-YVQEVbLKiyqQX_lc-8,14052
|
357
357
|
osbot_utils/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
358
|
-
osbot_utils/version,sha256=
|
359
|
-
osbot_utils-2.
|
360
|
-
osbot_utils-2.
|
361
|
-
osbot_utils-2.
|
362
|
-
osbot_utils-2.
|
358
|
+
osbot_utils/version,sha256=RZSaVXviZF3y9UfjXr3YrDmllry-euUcFHCuLsyhkPU,8
|
359
|
+
osbot_utils-2.26.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
360
|
+
osbot_utils-2.26.0.dist-info/METADATA,sha256=mfZ8WcLMiykJ8Sn7KstCiYQmPEw1JCGByBinJ1SQXAU,1329
|
361
|
+
osbot_utils-2.26.0.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
|
362
|
+
osbot_utils-2.26.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|