enforce-rules 3.2.2__tar.gz → 3.2.3__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: 3.2.2
3
+ Version: 3.2.3
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: 3
63
63
 
64
64
  MINOR: 2
65
65
 
66
- PATCH: 2
66
+ PATCH: 3
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
 
@@ -7,7 +7,7 @@ MAJOR: 3
7
7
 
8
8
  MINOR: 2
9
9
 
10
- PATCH: 2
10
+ PATCH: 3
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
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "enforce-rules"
3
- version = "3.2.2"
3
+ version = "3.2.3"
4
4
  description = "Runtime rule validation for Python using dictionary-based constraints."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -4,7 +4,7 @@ import re
4
4
  from datetime import datetime
5
5
  from chess import Piece
6
6
 
7
-
7
+ Number: TypeAlias = int | float
8
8
  # -----------------------------
9
9
  # VALIDATOR FUNCTIONS (DEFINED FIRST)
10
10
  # -----------------------------
@@ -24,12 +24,12 @@ def _validate_max_length(value: Sequence, expected: int) -> None:
24
24
  raise ValueError(f"Expected max length {expected}, got {len(value)}")
25
25
 
26
26
 
27
- def _validate_min(value: float | int, expected: float | int) -> None:
27
+ def _validate_min(value: Number, expected: Number) -> None:
28
28
  if value < expected:
29
29
  raise ValueError(f"Expected value >= {expected}, got {value}")
30
30
 
31
31
 
32
- def _validate_max(value: float | int, expected: float | int) -> None:
32
+ def _validate_max(value: Number, expected: Number) -> None:
33
33
  if value > expected:
34
34
  raise ValueError(f"Expected value <= {expected}, got {value}")
35
35
 
@@ -84,24 +84,24 @@ def _validate_decreasing(value: Sequence, expected: bool) -> None:
84
84
  raise ValueError("List must be strictly decreasing")
85
85
 
86
86
 
87
- def _validate_sum_min(value: Iterable[float | int], expected: float | int) -> None:
87
+ def _validate_sum_min(value: Iterable[Number], expected: Number) -> None:
88
88
  total = sum(value)
89
89
  if total < expected:
90
90
  raise ValueError(f"Sum must be >= {expected}, got {total}")
91
91
 
92
92
 
93
- def _validate_sum_max(value: Iterable[float | int], expected: float | int) -> None:
93
+ def _validate_sum_max(value: Iterable[Number], expected: Number) -> None:
94
94
  total = sum(value)
95
95
  if total > expected:
96
96
  raise ValueError(f"Sum must be <= {expected}, got {total}")
97
97
 
98
98
 
99
- def _validate_element_min(value: Iterable[float | int], expected: float | int) -> None:
99
+ def _validate_element_min(value: Iterable[Number], expected: Number) -> None:
100
100
  if min(value) < expected:
101
101
  raise ValueError(f"Elements must be >= {expected}")
102
102
 
103
103
 
104
- def _validate_element_max(value: Iterable[float | int], expected: float | int) -> None:
104
+ def _validate_element_max(value: Iterable[Number], expected: Number) -> None:
105
105
  if max(value) > expected:
106
106
  raise ValueError(f"Elements must be <= {expected}")
107
107
 
@@ -111,8 +111,8 @@ def _validate_regex(value: str, pattern: str, flags: object) -> None:
111
111
  if not compiled.search(value):
112
112
  raise ValueError(f"Value '{value}' does not match regex '{pattern}'")
113
113
 
114
- U = TypeVar("U")
115
- def _validate_must_be_true(value: U, func: Callable[[U], bool]) -> None:
114
+ T = TypeVar("T")
115
+ def _validate_must_be_true(value: T, func: Callable[[T], bool]) -> None:
116
116
  if not func(value):
117
117
  raise ValueError("must_be_true rule failed")
118
118
 
@@ -169,8 +169,6 @@ def _validate_is_password(value: str, rule: bool) -> None:
169
169
  # -----------------------------
170
170
  # VALIDATE() — DEFINED LAST
171
171
  # -----------------------------
172
- T = TypeVar("T")
173
- Number: TypeAlias = int | float
174
172
 
175
173
  class ValidateDict(TypedDict, total=False):
176
174
  length: int
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: enforce-rules
3
- Version: 3.2.2
3
+ Version: 3.2.3
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: 3
63
63
 
64
64
  MINOR: 2
65
65
 
66
- PATCH: 2
66
+ PATCH: 3
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
 
File without changes
File without changes