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:
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user