MCPcopy Index your code
hub / github.com/python/cpython / process_n

Method process_n

Lib/test/test_optparse.py:1179–1188  ·  view source on GitHub ↗
(self, option, opt, value, parser_)

Source from the content-addressed store, hash-verified

1177
1178 # Callback that meddles in rargs, largs
1179 def process_n(self, option, opt, value, parser_):
1180 # option is -3, -5, etc.
1181 nargs = int(opt[1:])
1182 rargs = parser_.rargs
1183 if len(rargs) < nargs:
1184 self.fail("Expected %d arguments for %s option." % (nargs, opt))
1185 dest = parser_.values.ensure_value(option.dest, [])
1186 dest.append(tuple(rargs[0:nargs]))
1187 parser_.largs.append(nargs)
1188 del rargs[0:nargs]
1189
1190 def test_callback_meddle_args(self):
1191 self.assertParseOK(["-1", "foo", "-3", "bar", "baz", "qux"],

Callers

nothing calls this directly

Calls 3

ensure_valueMethod · 0.80
failMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected