MCPcopy Index your code
hub / github.com/ipython/ipython / _tokenize

Function _tokenize

IPython/utils/_process_common.py:242–257  ·  view source on GitHub ↗
(s: str, posix: bool)

Source from the content-addressed store, hash-verified

240 an unbalanced quote) returns whatever was parsed so far instead of raising.
241 """
242 def _tokenize(s: str, posix: bool) -> list[str]:
243 lex = shlex.shlex(s, posix=posix)
244 lex.whitespace_split = True
245 lex.commenters = ''
246 out = []
247 while True:
248 try:
249 out.append(next(lex))
250 except StopIteration:
251 break
252 except ValueError:
253 if strict:
254 raise
255 out.append(lex.token)
256 break
257 return out
258
259 raw_tokens = _tokenize(commandline, posix=False)
260 clean_tokens = _tokenize(commandline, posix=True)

Callers 1

arg_split_with_quotesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…