enforce-rules 3.2.20__tar.gz → 3.2.22__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.20
3
+ Version: 3.2.22
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
@@ -65,7 +65,7 @@ MAJOR: 3
65
65
 
66
66
  MINOR: 2
67
67
 
68
- PATCH: 20
68
+ PATCH: 22
69
69
 
70
70
  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).
71
71
 
@@ -226,7 +226,7 @@ List must be strictly increasing.
226
226
  ```python
227
227
  numbers = validate([1, 5, 9], {"increasing": True})
228
228
  ```
229
- decreasing
229
+ ## decreasing
230
230
 
231
231
  List must be strictly decreasing.
232
232
 
@@ -7,7 +7,7 @@ MAJOR: 3
7
7
 
8
8
  MINOR: 2
9
9
 
10
- PATCH: 20
10
+ PATCH: 22
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
 
@@ -168,7 +168,7 @@ List must be strictly increasing.
168
168
  ```python
169
169
  numbers = validate([1, 5, 9], {"increasing": True})
170
170
  ```
171
- decreasing
171
+ ## decreasing
172
172
 
173
173
  List must be strictly decreasing.
174
174
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "enforce-rules"
3
- version = "3.2.20"
3
+ version = "3.2.22"
4
4
  description = "Runtime rule validation for Python using dictionary-based constraints."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -4,6 +4,7 @@ import re
4
4
  from datetime import datetime
5
5
  from chess import Piece
6
6
  from pydantic import Field, validate_call
7
+ from string import punctuation
7
8
 
8
9
  Number: TypeAlias = int | float
9
10
  LengthType: TypeAlias = Annotated[int, Field(ge=0)]
@@ -153,11 +154,13 @@ def _validate_chess_symbol(
153
154
  def _validate_is_password(value: str, rule: bool) -> None:
154
155
  if not rule:
155
156
  return
156
- try:
157
- _validate_min_length(value, 8)
158
- except ValueError:
157
+
158
+ if len(value) < 8:
159
159
  raise ValueError("Password must be at least 8 characters.")
160
160
 
161
+ if not isinstance(value, str):
162
+ raise ValueError("Password must be a string.")
163
+
161
164
  if not any(char.isdigit() for char in value):
162
165
  raise ValueError("Password must have at least one digit.")
163
166
 
@@ -167,19 +170,8 @@ def _validate_is_password(value: str, rule: bool) -> None:
167
170
  if not any(char.islower() for char in value):
168
171
  raise ValueError("Password must have at least one lowercase letter.")
169
172
 
170
- symbols: Container[str] = {
171
- "!", "\"", "#", "$", "%", "&", "'", "(", ")", "*", "+", ",", "-", ".", "/",
172
- ":", ";", "<", "=", ">", "?", "@",
173
- "[", "\\", "]", "^", "_", "`",
174
- "{", "|", "}", "~",
175
- }
176
-
177
- def is_symbol(char: str) -> bool:
178
- return char in symbols
179
-
180
- if not any(is_symbol(char) for char in value):
173
+ if not any(char in string.punctuation for char in value):
181
174
  raise ValueError("Password must have at least one symbol.")
182
-
183
175
  # -----------------------------
184
176
  # VALIDATE() — DEFINED LAST
185
177
  # -----------------------------
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: enforce-rules
3
- Version: 3.2.20
3
+ Version: 3.2.22
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
@@ -65,7 +65,7 @@ MAJOR: 3
65
65
 
66
66
  MINOR: 2
67
67
 
68
- PATCH: 20
68
+ PATCH: 22
69
69
 
70
70
  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).
71
71
 
@@ -226,7 +226,7 @@ List must be strictly increasing.
226
226
  ```python
227
227
  numbers = validate([1, 5, 9], {"increasing": True})
228
228
  ```
229
- decreasing
229
+ ## decreasing
230
230
 
231
231
  List must be strictly decreasing.
232
232
 
File without changes
File without changes