MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / parse_args

Method parse_args

tools/python-3.11.9-amd64/Lib/optparse.py:1355–1392  ·  view source on GitHub ↗

parse_args(args : [string] = sys.argv[1:], values : Values = None) -> (values : Values, args : [string]) Parse the command-line options found in 'args' (default: sys.argv[1:]). Any errors result in a call to 'error()', which by def

(self, args=None, values=None)

Source from the content-addressed store, hash-verified

1353 return args[:] # don't modify caller's list
1354
1355 def parse_args(self, args=None, values=None):
1356 """
1357 parse_args(args : [string] = sys.argv[1:],
1358 values : Values = None)
1359 -> (values : Values, args : [string])
1360
1361 Parse the command-line options found in 'args' (default:
1362 sys.argv[1:]). Any errors result in a call to 'error()', which
1363 by default prints the usage message to stderr and calls
1364 sys.exit() with an error message. On success returns a pair
1365 (values, args) where 'values' is a Values instance (with all
1366 your option values) and 'args' is the list of arguments left
1367 over after parsing options.
1368 """
1369 rargs = self._get_args(args)
1370 if values is None:
1371 values = self.get_default_values()
1372
1373 # Store the halves of the argument list as attributes for the
1374 # convenience of callbacks:
1375 # rargs
1376 # the rest of the command-line (the "r" stands for
1377 # "remaining" or "right-hand")
1378 # largs
1379 # the leftover arguments -- ie. what's left after removing
1380 # options and their arguments (the "l" stands for "leftover"
1381 # or "left-hand")
1382 self.rargs = rargs
1383 self.largs = largs = []
1384 self.values = values
1385
1386 try:
1387 stop = self._process_args(largs, rargs, values)
1388 except (BadOptionError, OptionValueError) as err:
1389 self.error(str(err))
1390
1391 args = largs + rargs
1392 return self.check_values(values, args)
1393
1394 def check_values(self, values, args):
1395 """

Callers 15

mainFunction · 0.95
testFunction · 0.95
mainFunction · 0.95
mainFunction · 0.95
pickletools.pyFile · 0.45
nntplib.pyFile · 0.45
code.pyFile · 0.45
pickle.pyFile · 0.45
makelocalealias.pyFile · 0.45
update_file.pyFile · 0.45
highlight.pyFile · 0.45
mainFunction · 0.45

Calls 6

_get_argsMethod · 0.95
get_default_valuesMethod · 0.95
_process_argsMethod · 0.95
errorMethod · 0.95
check_valuesMethod · 0.95
strFunction · 0.85

Tested by

no test coverage detected