MCPcopy Create free account
hub / github.com/apache/madlib / _match_arguments_partial

Method _match_arguments_partial

src/madpack/argparse.py:2038–2052  ·  view source on GitHub ↗
(self, actions, arg_strings_pattern)

Source from the content-addressed store, hash-verified

2036 return len(match.group(1))
2037
2038 def _match_arguments_partial(self, actions, arg_strings_pattern):
2039 # progressively shorten the actions list by slicing off the
2040 # final actions until we find a match
2041 result = []
2042 for i in range(len(actions), 0, -1):
2043 actions_slice = actions[:i]
2044 pattern = ''.join([self._get_nargs_pattern(action)
2045 for action in actions_slice])
2046 match = _re.match(pattern, arg_strings_pattern)
2047 if match is not None:
2048 result.extend([len(string) for string in match.groups()])
2049 break
2050
2051 # return the list of arg string counts
2052 return result
2053
2054 def _parse_optional(self, arg_string):
2055 # if it's an empty string, it was meant to be a positional

Callers

nothing calls this directly

Calls 2

_get_nargs_patternMethod · 0.95
rangeFunction · 0.85

Tested by

no test coverage detected