MCPcopy Create free account
hub / github.com/ipython/ipython / arg_split

Function arg_split

IPython/utils/_process_win32.py:179–198  ·  view source on GitHub ↗

Split a command line's arguments in a shell-like manner. This is a special version for windows that use a ctypes call to CommandLineToArgvW to do the argv splitting. The posix parameter is ignored. If strict=False, process_common.arg_split(...strict=False) is used i

(commandline, posix=False, strict=True)

Source from the content-addressed store, hash-verified

177 LocalFree.arg_types = [HLOCAL]
178
179 def arg_split(commandline, posix=False, strict=True):
180 """Split a command line's arguments in a shell-like manner.
181
182 This is a special version for windows that use a ctypes call to CommandLineToArgvW
183 to do the argv splitting. The posix parameter is ignored.
184
185 If strict=False, process_common.arg_split(...strict=False) is used instead.
186 """
187 #CommandLineToArgvW returns path to executable if called with empty string.
188 if commandline.strip() == "":
189 return []
190 if not strict:
191 # not really a cl-arg, fallback on _process_common
192 return py_arg_split(commandline, posix=posix, strict=strict)
193 argvn = c_int()
194 result_pointer = CommandLineToArgvW(py3compat.cast_unicode(commandline.lstrip()), ctypes.byref(argvn))
195 result_array_type = LPCWSTR * argvn.value
196 result = [arg for arg in result_array_type.from_address(ctypes.addressof(result_pointer.contents))]
197 retval = LocalFree(result_pointer)
198 return result
199except AttributeError:
200 arg_split = py_arg_split
201

Callers 7

test_arg_splitFunction · 0.90
test_arg_split_win32Function · 0.90
parse_argstringMethod · 0.90
file_matchesMethod · 0.90
shebangMethod · 0.90
parse_optionsMethod · 0.50
magic_run_completerFunction · 0.50

Calls

no outgoing calls

Tested by 2

test_arg_splitFunction · 0.72
test_arg_split_win32Function · 0.72