def process_arguments(self, func, args):
pos_args = []<EOL>kw_args = {}<EOL>while len(args) > <NUM_LIT:0>:<EOL><INDENT>if func.metadata.spec_filled(pos_args, kw_args) and not self._is_flag(args[<NUM_LIT:0>]):<EOL><INDENT>break<EOL><DEDENT>arg = args.pop(<NUM_LIT:0>)<EOL>if arg == '<STR_LIT>':<EOL><INDENT>break<EOL><DEDENT>elif self._is_flag(arg):<EOL><INDENT>arg_value = None<EOL>arg_name = None<EOL>if len(arg) == <NUM_LIT:2>:<EOL><INDENT>arg_name = func.metadata.match_shortname(arg[<NUM_LIT:1>:], filled_args=pos_args)<EOL><DEDENT>else:<EOL><INDENT>if not arg.startswith('<STR_LIT>'):<EOL><INDENT>raise ArgumentError("<STR_LIT>", argument=arg)<EOL><DEDENT>arg = arg[<NUM_LIT:2>:]<EOL>if '<STR_LIT:=>' in arg:<EOL><INDENT>arg, arg_value = arg.split('<STR_LIT:=>', <NUM_LIT:1>)<EOL><DEDENT>arg_name = func.metadata.match_shortname(arg, filled_args=pos_args)<EOL><DEDENT>arg_type = func.metadata.param_type(arg_name)<EOL>if arg_type is None:<EOL><INDENT>raise ArgumentError("<STR_LIT>", argument=arg_name)<EOL><DEDENT>if arg_value is None:<EOL><INDENT>arg_value = self._extract_arg_value(arg_name, arg_type, args)<EOL><DEDENT>kw_args[arg_name] = arg_value<EOL><DEDENT>else:<EOL><INDENT>pos_args.append(arg)<EOL><DEDENT><DEDENT>if len(args) > <NUM_LIT:0> and args[<NUM_LIT:0>] == '<STR_LIT>':<EOL><INDENT>args.pop(<NUM_LIT:0>)<EOL><DEDENT>return pos_args, kw_args, args<EOL>
Process arguments from the command line into positional and kw args.

        Arguments are consumed until the argument spec for the function is filled
        or a -- is found or there are no more arguments.  Keyword arguments can be
        specified using --field=value, -f value or --field value.  Positional
        arguments are specified just on the command line itself.

        If a keyword argument (`field`) is a boolean, it can be set to True by just passing
        --field or -f without needing to explicitly pass True unless this would cause
        ambiguity in parsing since the next expected positional argument is also a boolean
        or a string.

        Args:
            func (callable): A function previously annotated with type information
            args (list): A list of all of the potential arguments to this function.

        Returns:
            (args, kw_args, unused args): A tuple with a list of args, a dict of
                keyword args and a list of any unused args that were not processed.