safeshield 1.6.4__py3-none-any.whl → 1.6.6__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.
Potentially problematic release.
This version of safeshield might be problematic. Click here for more details.
- {safeshield-1.6.4.dist-info → safeshield-1.6.6.dist-info}/METADATA +1 -1
- {safeshield-1.6.4.dist-info → safeshield-1.6.6.dist-info}/RECORD +7 -7
- validator/rules/comparison.py +17 -7
- validator/rules/numeric.py +4 -4
- {safeshield-1.6.4.dist-info → safeshield-1.6.6.dist-info}/WHEEL +0 -0
- {safeshield-1.6.4.dist-info → safeshield-1.6.6.dist-info}/licenses/LICENSE +0 -0
- {safeshield-1.6.4.dist-info → safeshield-1.6.6.dist-info}/top_level.txt +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
safeshield-1.6.
|
|
1
|
+
safeshield-1.6.6.dist-info/licenses/LICENSE,sha256=YxHGBtuH0Vsy-KPvW2_afKE54XIrf1eipLF4v6kaybI,35276
|
|
2
2
|
validator/__init__.py,sha256=udxDzUicPfxBOAQvzsnl3pHur9VUppKbWMgg35hpiww,244
|
|
3
3
|
validator/exceptions.py,sha256=y2v7CaXmeGFHWcnigtLl4U-sFta_jMiXkGKXWIIVglY,366
|
|
4
4
|
validator/factory.py,sha256=SJ2iJmTnFS-4ccH-gzZl_7CAW7Z6YJkZbMImu-po80w,1163
|
|
@@ -12,11 +12,11 @@ validator/rules/array.py,sha256=7xwdXnthWZNDbD4lONgqtOf44OOQq1J6XexYm6BXea4,3512
|
|
|
12
12
|
validator/rules/base.py,sha256=yhxQdGiiM-wY7VtRH-KRU-_wmw7RVJnmJcmayO1EqBk,5870
|
|
13
13
|
validator/rules/basic.py,sha256=8k-REzsSyknhNuw0vPKMxtovvJBVlyZDihXXVznRQpM,6420
|
|
14
14
|
validator/rules/boolean.py,sha256=UuSO9BdBMR5l6sB3dgZqoqOVjqu47yjFrmJ7xylTVKs,5452
|
|
15
|
-
validator/rules/comparison.py,sha256=
|
|
15
|
+
validator/rules/comparison.py,sha256=BnPPPkf_5TiWNbWX-HzYtpqMpeWWKF2vaj5yXoxMpjc,15863
|
|
16
16
|
validator/rules/date.py,sha256=k27U3e08OPZoXyEX0Yj86ZfjCUuhLy4eBmqYbyc4Jn4,7292
|
|
17
17
|
validator/rules/files.py,sha256=3Q0KoadDKqNIiVlBR7b5b-XBs4gOg3ZFu7wU7SrdqWQ,12280
|
|
18
18
|
validator/rules/format.py,sha256=u_BhPQwW30JYHwZIjHD0ZX449csgTPPCJOeoXaQr4M4,7361
|
|
19
|
-
validator/rules/numeric.py,sha256=
|
|
19
|
+
validator/rules/numeric.py,sha256=aY-SU_fgfdm1Em5UFU1t1XbGw9s-FMVyJ5w6IuJ_Ad8,8831
|
|
20
20
|
validator/rules/string.py,sha256=3wgrqAO4V97ZPMc97mwDV6vsNvs6oyJs-ciqQX-FLBs,6268
|
|
21
21
|
validator/rules/utilities.py,sha256=pwo-uhBKDkIV2ZcdVQDBFYMc5ICsKswL904AayBLeBg,17080
|
|
22
22
|
validator/services/__init__.py,sha256=zzKTmqL7v4niFGWHJBfWLqgJ0iTaW_69OzYZN8uInzQ,210
|
|
@@ -25,7 +25,7 @@ validator/services/rule_error_handler.py,sha256=l4jA6WtTRBNGytVA_nSwJpbix_viNWhq
|
|
|
25
25
|
validator/services/rule_preparer.py,sha256=7HSMuSGGgaYWv8dt_m7pL5MQkJcTwFBH9gfmCZwzt8U,5284
|
|
26
26
|
validator/utils/__init__.py,sha256=Yzo-xv285Be-a233M4duDdYtscuHiuBbPSX_C8yViJI,20
|
|
27
27
|
validator/utils/string.py,sha256=0YACzeEaWNEOR9_7O9A8D1ItIbtWfOJ8IfrzcB8VMYA,515
|
|
28
|
-
safeshield-1.6.
|
|
29
|
-
safeshield-1.6.
|
|
30
|
-
safeshield-1.6.
|
|
31
|
-
safeshield-1.6.
|
|
28
|
+
safeshield-1.6.6.dist-info/METADATA,sha256=6Uf7VYaGL3WjE3E8M83Wy0YyQ4fU8fsq-beVKJ2fDfg,6664
|
|
29
|
+
safeshield-1.6.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
30
|
+
safeshield-1.6.6.dist-info/top_level.txt,sha256=iUtV3dlHOIiMfLuY4pruY00lFni8JzOkQ3Nh1II19OE,10
|
|
31
|
+
safeshield-1.6.6.dist-info/RECORD,,
|
validator/rules/comparison.py
CHANGED
|
@@ -10,13 +10,17 @@ class MinRule(Rule):
|
|
|
10
10
|
|
|
11
11
|
def validate(self, field: str, value: Any, params: List[str]) -> bool:
|
|
12
12
|
try:
|
|
13
|
-
min_val = float(params[0])
|
|
13
|
+
min_val = float(self.get_field_value(params[0], params[0]))
|
|
14
14
|
except ValueError:
|
|
15
15
|
return False
|
|
16
|
+
|
|
17
|
+
try:
|
|
18
|
+
numeric_value = float(value)
|
|
19
|
+
return min_val < numeric_value
|
|
20
|
+
except ValueError:
|
|
21
|
+
pass
|
|
16
22
|
|
|
17
|
-
if isinstance(value,
|
|
18
|
-
return value >= min_val
|
|
19
|
-
elif isinstance(value, str):
|
|
23
|
+
if isinstance(value, str):
|
|
20
24
|
try:
|
|
21
25
|
return len(value) >= min_val
|
|
22
26
|
except ValueError:
|
|
@@ -42,7 +46,10 @@ class MaxRule(Rule):
|
|
|
42
46
|
|
|
43
47
|
def validate(self, field: str, value: Any, params: List[str]) -> bool:
|
|
44
48
|
try:
|
|
45
|
-
|
|
49
|
+
try:
|
|
50
|
+
max_val = float(self.get_field_value(params[0], params[0]))
|
|
51
|
+
except ValueError:
|
|
52
|
+
return False
|
|
46
53
|
|
|
47
54
|
# Handle Werkzeug/Flask FileStorage
|
|
48
55
|
if hasattr(value, 'content_length'): # Flask/Werkzeug
|
|
@@ -66,8 +73,11 @@ class MaxRule(Rule):
|
|
|
66
73
|
pass
|
|
67
74
|
|
|
68
75
|
# Numeric validation
|
|
69
|
-
|
|
70
|
-
|
|
76
|
+
try:
|
|
77
|
+
numeric_value = float(value)
|
|
78
|
+
return numeric_value <= max_val
|
|
79
|
+
except ValueError:
|
|
80
|
+
pass
|
|
71
81
|
|
|
72
82
|
# String/collection length validation
|
|
73
83
|
if isinstance(value, (str, list, dict, set, tuple)):
|
validator/rules/numeric.py
CHANGED
|
@@ -89,7 +89,7 @@ class GreaterThanRule(Rule):
|
|
|
89
89
|
|
|
90
90
|
def validate(self, field: str, value: Any, params: List[str]) -> bool:
|
|
91
91
|
try:
|
|
92
|
-
threshold = decimal.Decimal(params[0])
|
|
92
|
+
threshold = decimal.Decimal(self.get_field_value(params[0], params[0]))
|
|
93
93
|
numeric_value = decimal.Decimal(str(value))
|
|
94
94
|
return numeric_value > threshold
|
|
95
95
|
except (decimal.InvalidOperation, TypeError, ValueError):
|
|
@@ -113,7 +113,7 @@ class GreaterThanOrEqualRule(Rule):
|
|
|
113
113
|
|
|
114
114
|
def validate(self, field: str, value: Any, params: List[str]) -> bool:
|
|
115
115
|
try:
|
|
116
|
-
threshold = decimal.Decimal(params[0])
|
|
116
|
+
threshold = decimal.Decimal(self.get_field_value(params[0], params[0]))
|
|
117
117
|
numeric_value = decimal.Decimal(str(value))
|
|
118
118
|
return numeric_value >= threshold
|
|
119
119
|
except (decimal.InvalidOperation, TypeError, ValueError):
|
|
@@ -137,7 +137,7 @@ class LessThanRule(Rule):
|
|
|
137
137
|
|
|
138
138
|
def validate(self, field: str, value: Any, params: List[str]) -> bool:
|
|
139
139
|
try:
|
|
140
|
-
threshold = decimal.Decimal(params[0])
|
|
140
|
+
threshold = decimal.Decimal(self.get_field_value(params[0], params[0]))
|
|
141
141
|
numeric_value = decimal.Decimal(str(value))
|
|
142
142
|
return numeric_value < threshold
|
|
143
143
|
except (decimal.InvalidOperation, TypeError, ValueError):
|
|
@@ -161,7 +161,7 @@ class LessThanOrEqualRule(Rule):
|
|
|
161
161
|
|
|
162
162
|
def validate(self, field: str, value: Any, params: List[str]) -> bool:
|
|
163
163
|
try:
|
|
164
|
-
threshold = decimal.Decimal(params[0])
|
|
164
|
+
threshold = decimal.Decimal(self.get_field_value(params[0], params[0]))
|
|
165
165
|
numeric_value = decimal.Decimal(str(value))
|
|
166
166
|
return numeric_value <= threshold
|
|
167
167
|
except (decimal.InvalidOperation, TypeError, ValueError):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|