MCPcopy Index your code
hub / github.com/RustPython/RustPython / _match_arguments_partial

Method _match_arguments_partial

Lib/argparse.py:2412–2427  ·  view source on GitHub ↗
(self, actions, arg_strings_pattern)

Source from the content-addressed store, hash-verified

2410 return len(match.group(1))
2411
2412 def _match_arguments_partial(self, actions, arg_strings_pattern):
2413 # progressively shorten the actions list by slicing off the
2414 # final actions until we find a match
2415 for i in range(len(actions), 0, -1):
2416 actions_slice = actions[:i]
2417 pattern = ''.join([self._get_nargs_pattern(action)
2418 for action in actions_slice])
2419 match = _re.match(pattern, arg_strings_pattern)
2420 if match is not None:
2421 result = [len(string) for string in match.groups()]
2422 if (match.end() < len(arg_strings_pattern)
2423 and arg_strings_pattern[match.end()] == 'O'):
2424 while result and not result[-1]:
2425 del result[-1]
2426 return result
2427 return []
2428
2429 def _parse_optional(self, arg_string):
2430 # if it's an empty string, it was meant to be a positional

Callers

nothing calls this directly

Calls 6

_get_nargs_patternMethod · 0.95
lenFunction · 0.85
joinMethod · 0.45
matchMethod · 0.45
groupsMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected