MCPcopy Create free account
hub / github.com/fabioz/PyDev.Debugger / remove_quotes_from_args

Function remove_quotes_from_args

_pydev_bundle/pydev_monkey.py:294–323  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

292
293
294def remove_quotes_from_args(args):
295 if sys.platform == "win32":
296 new_args = []
297
298 for x in args:
299 if isinstance(x, Path):
300 x = str(x)
301 else:
302 if not isinstance(x, (bytes, str)):
303 raise InvalidTypeInArgsException(str(type(x)))
304
305 double_quote, two_double_quotes = _get_str_type_compatible(x, ['"', '""'])
306
307 if x != two_double_quotes:
308 if len(x) > 1 and x.startswith(double_quote) and x.endswith(double_quote):
309 x = x[1:-1]
310
311 new_args.append(x)
312 return new_args
313 else:
314 new_args = []
315 for x in args:
316 if isinstance(x, Path):
317 x = x.as_posix()
318 else:
319 if not isinstance(x, (bytes, str)):
320 raise InvalidTypeInArgsException(str(type(x)))
321 new_args.append(x)
322
323 return new_args
324
325
326def quote_arg_win32(arg):

Callers 1

patch_argsFunction · 0.85

Calls 3

_get_str_type_compatibleFunction · 0.85
appendMethod · 0.45

Tested by

no test coverage detected