def default(self, raw_args):
        """Parses API commands (ex `ctrl echo msg:7`) into calls to CtrlServer.

        API commands are those given by the `list` command. Note that a
        heuristic is used to convert params (like "7" in the example above)
        into the types expected by the method that will be called and passed
        that param by CtrlServer. It has held up well so far.

        :param raw_args: Command from user to be parsed/passed to CtrlServer.
        :type raw_args: string

        """
        obj_name, _, rest = raw_args.partition(" ")
        if self.ctrl_client.objects in obj_name:
            method_name, _, params = rest.partition(" ")
            if method_name in self.ctrl_client.objects[obj_name]:
                try:
                    param_dict = {}
                    # Split param into its key:value strs and iterate on them
                    for param in params.split():
                        # Split key:value param pair
                        key, value = param.split(":")

                        # We need to convert param's value, which was given to
                        # this method as a string in raw_args, to the type
                        # expected by the method it will be passed to.
                        # This is a dirty heuristic (that so far works well)!

                        # Try converting to int/float - easy to know if wrong
                        try:
                            if "." in value:
                                value = float(value)
                            else:
                                value = int(value)
                        except ValueError:
                            # It wasn't an int or float, assume string or bool
                            # Check if bool
                            if value == "True":
                                value = True
                            elif value == "False":
                                value = False
                            # If user gave key:'value', strip '' chars
                            elif value.startswith("'") and value.endswith("'"):
                                value = value[1:-1]
                            # Either bool or string at this point
                        param_dict[key] = value
                except IndexError:
                    print "Bad parameter list"
                    return
                except ValueError:
                    print "Bad parameter value"
                    return
                result = self.ctrl_client.call(
                    obj_name, method_name, param_dict)
                print "-->", result
            else:
                print "Unknown API method:", method_name
        else:
            print "Unknown command:", obj_name
dataset/ETHPy150Open IEEERobotics/bot/bot/interface/cli.py/CLI.default/swapped operands of `in`