| 2655 | return args |
| 2656 | |
| 2657 | def parse_known_intermixed_args(self, args=None, namespace=None): |
| 2658 | # returns a namespace and list of extras |
| 2659 | # |
| 2660 | # positional can be freely intermixed with optionals. optionals are |
| 2661 | # first parsed with all positional arguments deactivated. The 'extras' |
| 2662 | # are then parsed. If the parser definition is incompatible with the |
| 2663 | # intermixed assumptions (e.g. use of REMAINDER, subparsers) a |
| 2664 | # TypeError is raised. |
| 2665 | |
| 2666 | positionals = self._get_positional_actions() |
| 2667 | a = [action for action in positionals |
| 2668 | if action.nargs in [PARSER, REMAINDER]] |
| 2669 | if a: |
| 2670 | raise TypeError('parse_intermixed_args: positional arg' |
| 2671 | ' with nargs=%s'%a[0].nargs) |
| 2672 | |
| 2673 | return self._parse_known_args2(args, namespace, intermixed=True) |
| 2674 | |
| 2675 | # ======================== |
| 2676 | # Value conversion methods |