enforce-rules 2.0.0__tar.gz → 2.0.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: enforce-rules
3
- Version: 2.0.0
3
+ Version: 2.0.2
4
4
  Summary: Runtime rule validation for Python using dictionary-based constraints.
5
5
  Author: Jake Loepker, Microsoft Copilot (AI Assistant)
6
6
  License: BSD 3-Clause License
@@ -63,7 +63,7 @@ MAJOR: 2
63
63
 
64
64
  MINOR: 0
65
65
 
66
- PATCH: 0
66
+ PATCH: 2
67
67
 
68
68
  If you need to catch up, you can see the full version history in the [CHANGELOG](https://github.com/Loepker-James/enforce-rules/blob/main/CHANGELOG.md).
69
69
 
@@ -260,7 +260,21 @@ Turns out I didn't notice this in my code, until 1.1.0. This is the regex flags
260
260
 
261
261
  ```python
262
262
  from re import RegexFlag
263
- cat_or_dog = validate("cat", {"regex": "cat|dog", {"regex_flags": RegexFlag.I | RegexFlag.M | RegexFl
263
+ cat_or_dog = validate("cat", {"regex": "cat|dog", {"regex_flags": RegexFlag.I | RegexFlag.M | RegexFlag.X
264
+ ```
265
+ before_date
266
+
267
+ Value must be strictly before the given datetime.
268
+
269
+ ```python
270
+ validate(datetime(1999, 8, 29), {"before_date": datetime(2000, 1, 1)})
271
+ ```
272
+
273
+ after_date
274
+
275
+ Value must be strictly after the given datetime.
276
+ ```python
277
+ validate(datetime(2026, 8, 29), {"after_date": datetime(2000, 1, 1)})
264
278
  ```
265
279
 
266
280
  must_be_true
@@ -7,7 +7,7 @@ MAJOR: 2
7
7
 
8
8
  MINOR: 0
9
9
 
10
- PATCH: 0
10
+ PATCH: 2
11
11
 
12
12
  If you need to catch up, you can see the full version history in the [CHANGELOG](https://github.com/Loepker-James/enforce-rules/blob/main/CHANGELOG.md).
13
13
 
@@ -204,7 +204,21 @@ Turns out I didn't notice this in my code, until 1.1.0. This is the regex flags
204
204
 
205
205
  ```python
206
206
  from re import RegexFlag
207
- cat_or_dog = validate("cat", {"regex": "cat|dog", {"regex_flags": RegexFlag.I | RegexFlag.M | RegexFl
207
+ cat_or_dog = validate("cat", {"regex": "cat|dog", {"regex_flags": RegexFlag.I | RegexFlag.M | RegexFlag.X
208
+ ```
209
+ before_date
210
+
211
+ Value must be strictly before the given datetime.
212
+
213
+ ```python
214
+ validate(datetime(1999, 8, 29), {"before_date": datetime(2000, 1, 1)})
215
+ ```
216
+
217
+ after_date
218
+
219
+ Value must be strictly after the given datetime.
220
+ ```python
221
+ validate(datetime(2026, 8, 29), {"after_date": datetime(2000, 1, 1)})
208
222
  ```
209
223
 
210
224
  must_be_true
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "enforce-rules"
3
- version = "2.0.0"
3
+ version = "2.0.2"
4
4
  description = "Runtime rule validation for Python using dictionary-based constraints."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -178,7 +178,7 @@ def validate(value: Any, rules: Dict[str, Any]) -> Any:
178
178
  _validate_before_date(value, rule)
179
179
  case "after_date":
180
180
  _validate_after_date(value, rule)
181
- case _:
181
+ case x if x != "regex_flags":
182
182
  raise ValueError(f"Unknown rule: {key}")
183
183
 
184
184
  return value
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: enforce-rules
3
- Version: 2.0.0
3
+ Version: 2.0.2
4
4
  Summary: Runtime rule validation for Python using dictionary-based constraints.
5
5
  Author: Jake Loepker, Microsoft Copilot (AI Assistant)
6
6
  License: BSD 3-Clause License
@@ -63,7 +63,7 @@ MAJOR: 2
63
63
 
64
64
  MINOR: 0
65
65
 
66
- PATCH: 0
66
+ PATCH: 2
67
67
 
68
68
  If you need to catch up, you can see the full version history in the [CHANGELOG](https://github.com/Loepker-James/enforce-rules/blob/main/CHANGELOG.md).
69
69
 
@@ -260,7 +260,21 @@ Turns out I didn't notice this in my code, until 1.1.0. This is the regex flags
260
260
 
261
261
  ```python
262
262
  from re import RegexFlag
263
- cat_or_dog = validate("cat", {"regex": "cat|dog", {"regex_flags": RegexFlag.I | RegexFlag.M | RegexFl
263
+ cat_or_dog = validate("cat", {"regex": "cat|dog", {"regex_flags": RegexFlag.I | RegexFlag.M | RegexFlag.X
264
+ ```
265
+ before_date
266
+
267
+ Value must be strictly before the given datetime.
268
+
269
+ ```python
270
+ validate(datetime(1999, 8, 29), {"before_date": datetime(2000, 1, 1)})
271
+ ```
272
+
273
+ after_date
274
+
275
+ Value must be strictly after the given datetime.
276
+ ```python
277
+ validate(datetime(2026, 8, 29), {"after_date": datetime(2000, 1, 1)})
264
278
  ```
265
279
 
266
280
  must_be_true
File without changes
File without changes