@@ -232,14 +232,9 @@ def grok_environment_error(exc: object, prefix: str = "error: ") -> str:
232232
233233
234234# Needed by 'split_quoted()'
235- _wordchars_re = _squote_re = _dquote_re = None
236-
237-
238- def _init_regex ():
239- global _wordchars_re , _squote_re , _dquote_re
240- _wordchars_re = re .compile (rf'[^\\\'\"{ string .whitespace } ]*' )
241- _squote_re = re .compile (r"'(?:[^'\\]|\\.)*'" )
242- _dquote_re = re .compile (r'"(?:[^"\\]|\\.)*"' )
235+ _wordchars_re = re .compile (rf'[^\\\'\"{ string .whitespace } ]*' )
236+ _squote_re = re .compile (r"'(?:[^'\\]|\\.)*'" )
237+ _dquote_re = re .compile (r'"(?:[^"\\]|\\.)*"' )
243238
244239
245240def split_quoted (s : str ) -> list [str ]:
@@ -256,15 +251,14 @@ def split_quoted(s: str) -> list[str]:
256251 # This is a nice algorithm for splitting up a single string, since it
257252 # doesn't require character-by-character examination. It was a little
258253 # bit of a brain-bender to get it working right, though...
259- if _wordchars_re is None :
260- _init_regex ()
261254
262255 s = s .strip ()
263256 words = []
264257 pos = 0
265258
266259 while s :
267260 m = _wordchars_re .match (s , pos )
261+ assert m is not None
268262 end = m .end ()
269263 if end == len (s ):
270264 words .append (s [:end ])
@@ -305,9 +299,6 @@ def split_quoted(s: str) -> list[str]:
305299 return words
306300
307301
308- # split_quoted ()
309-
310-
311302def execute (
312303 func : Callable [[Unpack [_Ts ]], object ],
313304 args : tuple [Unpack [_Ts ]],
0 commit comments