fix(string-constructor): resolve Optional typing crash and regex warnings

- Fixed TypeError caused by invalid use of typing.Optional with two arguments.
  Replaced Optional[Dict[str, Any], None] with correct Optional[Dict[str, Any]] = None.
- Updated __escape_match() to pass integer brace counts instead of raw strings
  to _n_brackets_after_escape_for_existing_key, preventing runtime errors.
- Converted regex patterns to raw strings (r\'...\') to eliminate SyntaxWarning
  about invalid escape sequences (\\s, \\{).
This commit is contained in:
MaraScott
2025-08-29 14:09:52 +02:00
parent 200dff7c81
commit f764fefe76
2 changed files with 13 additions and 13 deletions
+9 -9
View File
@@ -8,16 +8,16 @@ from inspect import getdoc as _getdoc
import re as _re
_re_indent_match = _re.compile("(\t*)( +)(\t*)(.*?)$").match
_re_tab_indent_match = _re.compile("(\t+)(.*?)$").match
_re_indent_match = _re.compile(r"(\t*)( +)(\t*)(.*?)$").match
_re_tab_indent_match = _re.compile(r"(\t+)(.*?)$").match
_re_list_line_match = _re.compile(
"(\s*)("
"[-*•]+"
"|"
"[a-zA-Z]\s*[.)]"
"|"
"[0-9+]\s*[.)]"
")\s+"
r"(\s*)("
r"[-*•]+"
r"|"
r"[a-zA-Z]\s*[.)]"
r"|"
r"[0-9+]\s*[.)]"
r")\s+"
).match