safeshield 1.6.8__tar.gz → 1.6.11__tar.gz
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.
- {safeshield-1.6.8/safeshield.egg-info → safeshield-1.6.11}/PKG-INFO +2 -3
- {safeshield-1.6.8 → safeshield-1.6.11}/requirements.txt +1 -2
- {safeshield-1.6.8 → safeshield-1.6.11/safeshield.egg-info}/PKG-INFO +2 -3
- {safeshield-1.6.8 → safeshield-1.6.11}/safeshield.egg-info/requires.txt +1 -2
- {safeshield-1.6.8 → safeshield-1.6.11}/setup.py +1 -1
- {safeshield-1.6.8 → safeshield-1.6.11}/validator/rules/date.py +29 -14
- {safeshield-1.6.8 → safeshield-1.6.11}/LICENSE +0 -0
- {safeshield-1.6.8 → safeshield-1.6.11}/MANIFEST.in +0 -0
- {safeshield-1.6.8 → safeshield-1.6.11}/README.md +0 -0
- {safeshield-1.6.8 → safeshield-1.6.11}/safeshield.egg-info/SOURCES.txt +0 -0
- {safeshield-1.6.8 → safeshield-1.6.11}/safeshield.egg-info/dependency_links.txt +0 -0
- {safeshield-1.6.8 → safeshield-1.6.11}/safeshield.egg-info/top_level.txt +0 -0
- {safeshield-1.6.8 → safeshield-1.6.11}/setup.cfg +0 -0
- {safeshield-1.6.8 → safeshield-1.6.11}/validator/__init__.py +0 -0
- {safeshield-1.6.8 → safeshield-1.6.11}/validator/core/__init__.py +0 -0
- {safeshield-1.6.8 → safeshield-1.6.11}/validator/core/validator.py +0 -0
- {safeshield-1.6.8 → safeshield-1.6.11}/validator/database/__init__.py +0 -0
- {safeshield-1.6.8 → safeshield-1.6.11}/validator/database/detector.py +0 -0
- {safeshield-1.6.8 → safeshield-1.6.11}/validator/database/manager.py +0 -0
- {safeshield-1.6.8 → safeshield-1.6.11}/validator/exceptions.py +0 -0
- {safeshield-1.6.8 → safeshield-1.6.11}/validator/factory.py +0 -0
- {safeshield-1.6.8 → safeshield-1.6.11}/validator/rules/__init__.py +0 -0
- {safeshield-1.6.8 → safeshield-1.6.11}/validator/rules/array.py +0 -0
- {safeshield-1.6.8 → safeshield-1.6.11}/validator/rules/base.py +0 -0
- {safeshield-1.6.8 → safeshield-1.6.11}/validator/rules/basic.py +0 -0
- {safeshield-1.6.8 → safeshield-1.6.11}/validator/rules/boolean.py +0 -0
- {safeshield-1.6.8 → safeshield-1.6.11}/validator/rules/comparison.py +0 -0
- {safeshield-1.6.8 → safeshield-1.6.11}/validator/rules/files.py +0 -0
- {safeshield-1.6.8 → safeshield-1.6.11}/validator/rules/format.py +0 -0
- {safeshield-1.6.8 → safeshield-1.6.11}/validator/rules/numeric.py +0 -0
- {safeshield-1.6.8 → safeshield-1.6.11}/validator/rules/string.py +0 -0
- {safeshield-1.6.8 → safeshield-1.6.11}/validator/rules/utilities.py +0 -0
- {safeshield-1.6.8 → safeshield-1.6.11}/validator/services/__init__.py +0 -0
- {safeshield-1.6.8 → safeshield-1.6.11}/validator/services/rule_conflict.py +0 -0
- {safeshield-1.6.8 → safeshield-1.6.11}/validator/services/rule_error_handler.py +0 -0
- {safeshield-1.6.8 → safeshield-1.6.11}/validator/services/rule_preparer.py +0 -0
- {safeshield-1.6.8 → safeshield-1.6.11}/validator/utils/__init__.py +0 -0
- {safeshield-1.6.8 → safeshield-1.6.11}/validator/utils/string.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: safeshield
|
|
3
|
-
Version: 1.6.
|
|
3
|
+
Version: 1.6.11
|
|
4
4
|
Summary: Library for Help Validation Control
|
|
5
5
|
Home-page: https://github.com/WunsunTarniho/py-guard
|
|
6
6
|
Author: Wunsun Tarniho
|
|
@@ -21,11 +21,10 @@ Requires-Dist: Pillow==11.2.1
|
|
|
21
21
|
Requires-Dist: psycopg2-binary==2.9.9
|
|
22
22
|
Requires-Dist: python-dotenv==1.1.1
|
|
23
23
|
Requires-Dist: python_dateutil==2.9.0.post0
|
|
24
|
-
Requires-Dist: setuptools==75.8.2
|
|
25
24
|
Requires-Dist: SQLAlchemy==2.0.41
|
|
26
25
|
Requires-Dist: Werkzeug==1.0.1
|
|
27
26
|
Requires-Dist: dnspython==2.4.2
|
|
28
|
-
Requires-Dist: idna==3.
|
|
27
|
+
Requires-Dist: idna==3.6
|
|
29
28
|
Dynamic: author
|
|
30
29
|
Dynamic: author-email
|
|
31
30
|
Dynamic: classifier
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: safeshield
|
|
3
|
-
Version: 1.6.
|
|
3
|
+
Version: 1.6.11
|
|
4
4
|
Summary: Library for Help Validation Control
|
|
5
5
|
Home-page: https://github.com/WunsunTarniho/py-guard
|
|
6
6
|
Author: Wunsun Tarniho
|
|
@@ -21,11 +21,10 @@ Requires-Dist: Pillow==11.2.1
|
|
|
21
21
|
Requires-Dist: psycopg2-binary==2.9.9
|
|
22
22
|
Requires-Dist: python-dotenv==1.1.1
|
|
23
23
|
Requires-Dist: python_dateutil==2.9.0.post0
|
|
24
|
-
Requires-Dist: setuptools==75.8.2
|
|
25
24
|
Requires-Dist: SQLAlchemy==2.0.41
|
|
26
25
|
Requires-Dist: Werkzeug==1.0.1
|
|
27
26
|
Requires-Dist: dnspython==2.4.2
|
|
28
|
-
Requires-Dist: idna==3.
|
|
27
|
+
Requires-Dist: idna==3.6
|
|
29
28
|
Dynamic: author
|
|
30
29
|
Dynamic: author-email
|
|
31
30
|
Dynamic: classifier
|
|
@@ -4,13 +4,30 @@ from datetime import datetime
|
|
|
4
4
|
import zoneinfo
|
|
5
5
|
from dateutil.parser import parse
|
|
6
6
|
|
|
7
|
+
def parse_date(value):
|
|
8
|
+
formats = [
|
|
9
|
+
"%Y-%m-%d",
|
|
10
|
+
"%d/%m/%Y",
|
|
11
|
+
"%m/%d/%Y",
|
|
12
|
+
"%d-%m-%Y",
|
|
13
|
+
"%m-%d-%Y",
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
for fmt in formats:
|
|
17
|
+
try:
|
|
18
|
+
return datetime.strptime(value, fmt)
|
|
19
|
+
except ValueError:
|
|
20
|
+
continue
|
|
21
|
+
|
|
22
|
+
raise ValueError(f"Unable to parse date: {value}")
|
|
23
|
+
|
|
7
24
|
class DateRule(Rule):
|
|
8
25
|
def validate(self, field: str, value: Any, params: List[str]) -> bool:
|
|
9
26
|
if not isinstance(value, str):
|
|
10
27
|
return False
|
|
11
28
|
|
|
12
29
|
try:
|
|
13
|
-
|
|
30
|
+
parse_date(value)
|
|
14
31
|
return True
|
|
15
32
|
except ValueError:
|
|
16
33
|
return False
|
|
@@ -25,7 +42,7 @@ class DateEqualsRule(Rule):
|
|
|
25
42
|
|
|
26
43
|
try:
|
|
27
44
|
if isinstance(value, str):
|
|
28
|
-
date1 =
|
|
45
|
+
date1 = parse_date(value)
|
|
29
46
|
elif isinstance(value, datetime):
|
|
30
47
|
date1 = value
|
|
31
48
|
else:
|
|
@@ -34,7 +51,7 @@ class DateEqualsRule(Rule):
|
|
|
34
51
|
params = list(params)
|
|
35
52
|
params[0] = self.get_field_value(params[0], params[0])
|
|
36
53
|
|
|
37
|
-
date2 =
|
|
54
|
+
date2 = parse_date(params[0])
|
|
38
55
|
return date1 == date2
|
|
39
56
|
except ValueError as e:
|
|
40
57
|
return False
|
|
@@ -57,7 +74,7 @@ class AfterRule(Rule):
|
|
|
57
74
|
def validate(self, field: str, value: Any, params: List[str]) -> bool:
|
|
58
75
|
try:
|
|
59
76
|
if isinstance(value, str):
|
|
60
|
-
date_value =
|
|
77
|
+
date_value = parse_date(value)
|
|
61
78
|
elif isinstance(value, datetime):
|
|
62
79
|
date_value = value
|
|
63
80
|
else:
|
|
@@ -66,7 +83,7 @@ class AfterRule(Rule):
|
|
|
66
83
|
|
|
67
84
|
params = list(params)# Parse comparison date
|
|
68
85
|
params[0] = self.get_field_value(params[0], params[0])
|
|
69
|
-
compare_date =
|
|
86
|
+
compare_date = parse_date(params[0])
|
|
70
87
|
|
|
71
88
|
return date_value > compare_date
|
|
72
89
|
|
|
@@ -91,7 +108,7 @@ class AfterOrEqualRule(Rule):
|
|
|
91
108
|
def validate(self, field: str, value: Any, params: List[str]) -> bool:
|
|
92
109
|
try:
|
|
93
110
|
if isinstance(value, str):
|
|
94
|
-
date_value =
|
|
111
|
+
date_value = parse_date(value)
|
|
95
112
|
elif isinstance(value, datetime):
|
|
96
113
|
date_value = value
|
|
97
114
|
else:
|
|
@@ -99,7 +116,7 @@ class AfterOrEqualRule(Rule):
|
|
|
99
116
|
|
|
100
117
|
params = list(params)
|
|
101
118
|
params[0] = self.get_field_value(params[0], params[0])
|
|
102
|
-
compare_date =
|
|
119
|
+
compare_date = parse_date(params[0])
|
|
103
120
|
|
|
104
121
|
return date_value >= compare_date
|
|
105
122
|
|
|
@@ -126,7 +143,7 @@ class BeforeRule(Rule):
|
|
|
126
143
|
|
|
127
144
|
try:
|
|
128
145
|
if isinstance(value, str):
|
|
129
|
-
date_value =
|
|
146
|
+
date_value = parse_date(value)
|
|
130
147
|
elif isinstance(value, datetime):
|
|
131
148
|
date_value = value
|
|
132
149
|
else:
|
|
@@ -134,7 +151,7 @@ class BeforeRule(Rule):
|
|
|
134
151
|
|
|
135
152
|
params = list(params)
|
|
136
153
|
params[0] = self.get_field_value(params[0], params[0])
|
|
137
|
-
compare_date =
|
|
154
|
+
compare_date = parse_date(params[0])
|
|
138
155
|
|
|
139
156
|
return date_value < compare_date
|
|
140
157
|
|
|
@@ -161,7 +178,7 @@ class BeforeOrEqualRule(Rule):
|
|
|
161
178
|
|
|
162
179
|
try:
|
|
163
180
|
if isinstance(value, str):
|
|
164
|
-
date_value =
|
|
181
|
+
date_value = parse_date(value)
|
|
165
182
|
elif isinstance(value, datetime):
|
|
166
183
|
date_value = value
|
|
167
184
|
else:
|
|
@@ -169,11 +186,9 @@ class BeforeOrEqualRule(Rule):
|
|
|
169
186
|
|
|
170
187
|
params = list(params)
|
|
171
188
|
params[0] = self.get_field_value(params[0], params[0])
|
|
172
|
-
compare_date =
|
|
173
|
-
|
|
189
|
+
compare_date = parse_date(params[0])
|
|
174
190
|
return date_value <= compare_date
|
|
175
|
-
|
|
176
|
-
except (ValueError, TypeError):
|
|
191
|
+
except (ValueError, TypeError) as e:
|
|
177
192
|
return False
|
|
178
193
|
|
|
179
194
|
def message(self, field: str, params: List[str]) -> str:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|