# Path: torext/errors.py
# class CommandArgumentError(TorextException):
#     pass


import sys
import inspect
import functools
import time
from .errors import CommandArgumentError
                if not i in self.keyword_parameters:
                    raise CommandArgumentError('Unknown keyword parameter %s' % i)

        # Convert keyword args type
        # NOTE As keyword arguments passed as arguments are allwed,
        # and only recognized keyword arguments will be converted,
        # so keyword arguments passed as arguments will not be converted.
        for i in keyword_args:
            if i in self.keyword_parameters:
                default = self.keyword_parameters[i]
                converted = self._convert_to_type(
                    keyword_args[i], self._get_value_type(default))
                keyword_args[i] = converted

        return args, keyword_args

    def _get_value_type(self, value):
        if isinstance(value, self.allow_types):
            typ = type(value)
        elif value is None:
            typ = None
        else:
            raise TypeError('Parameters for command function can only be type of %s' % self.allow_types)
        return typ

    def _convert_to_type(self, source, typ):
        if typ in (int, float, str, str):
            try:
                v = typ(source)
            except ValueError:

# Path: torext/errors.py
# class CommandArgumentError(TorextException):
#     pass


# Path: torext/script.py
import sys
import inspect
import functools
import time
from .errors import CommandArgumentError

                if not i in self.keyword_parameters:
                    raise CommandArgumentError('Unknown keyword parameter %s' % i)

        # Convert keyword args type
        # NOTE As keyword arguments passed as arguments are allwed,
        # and only recognized keyword arguments will be converted,
        # so keyword arguments passed as arguments will not be converted.
        for i in keyword_args:
            if i in self.keyword_parameters:
                default = self.keyword_parameters[i]
                converted = self._convert_to_type(
                    keyword_args[i], self._get_value_type(default))
                keyword_args[i] = converted

        return args, keyword_args

    def _get_value_type(self, value):
        if isinstance(value, self.allow_types):
            typ = type(value)
        elif value is None:
            typ = None
        else:
            raise TypeError('Parameters for command function can only be type of %s' % self.allow_types)
        return typ

    def _convert_to_type(self, source, typ):
        if typ in (int, float, str, str):
            try:
                v = typ(source)
            except ValueError:

                raise CommandArgumentError("'%s' could not be converted to %s"