(self, action, arg_strings_pattern)
| 2388 | return [arg_line] |
| 2389 | |
| 2390 | def _match_argument(self, action, arg_strings_pattern): |
| 2391 | # match the pattern for this action to the arg strings |
| 2392 | nargs_pattern = self._get_nargs_pattern(action) |
| 2393 | match = _re.match(nargs_pattern, arg_strings_pattern) |
| 2394 | |
| 2395 | # raise an exception if we weren't able to find a match |
| 2396 | if match is None: |
| 2397 | nargs_errors = { |
| 2398 | None: _('expected one argument'), |
| 2399 | OPTIONAL: _('expected at most one argument'), |
| 2400 | ONE_OR_MORE: _('expected at least one argument'), |
| 2401 | } |
| 2402 | msg = nargs_errors.get(action.nargs) |
| 2403 | if msg is None: |
| 2404 | msg = ngettext('expected %s argument', |
| 2405 | 'expected %s arguments', |
| 2406 | action.nargs) % action.nargs |
| 2407 | raise ArgumentError(action, msg) |
| 2408 | |
| 2409 | # return the number of arguments matched |
| 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 |
nothing calls this directly
no test coverage detected