This is a development version (9.18.0.dev) and may be unstable.Go to latest (9.17.0)
{ } Raw JSON

bundles / IPython 9.18.0.dev / IPython / utils / _process_common / arg_split_with_quotes

function

IPython.utils._process_common:arg_split_with_quotes

source: /IPython/utils/_process_common.py:237

Signature

def arg_split_with_quotes(commandline: str, strict: bool = True) → list[tuple[str, bool]]

Summary

Split a command line and report which tokens were originally quoted.

Extended Summary

Returns a list of (token, was_quoted) pairs. token is the unquoted form, as shlex.split(posix=True) returns, and was_quoted is True if that token had any single- or double-quote characters in commandline.

Useful for callers like %run that want to honor shell quoting when deciding whether to apply further expansion (glob, tilde) to a token.

Detection is shlex-based on both passes so the quote semantics are the same on Posix and Windows. If strict is False, malformed input (e.g. an unbalanced quote) returns whatever was parsed so far instead of raising.

Aliases

  • IPython.utils._process_common.arg_split_with_quotes