# Path: infi/pyutils/exceptions.py
# class SignatureException(ReflectionException):
#     pass
# 
# class InvalidKeywordArgument(ReflectionException):
#     pass
# 
# class UnknownArguments(SignatureException):
#     pass
# 
# class MissingArguments(SignatureException):
#     pass


from types import MethodType
from .exceptions import (
    SignatureException,
    InvalidKeywordArgument,
    UnknownArguments,
    MissingArguments,
    )
from numbers import Number
import copy
import inspect
import itertools
import platform
            if arg_name in returned:
                raise SignatureException("%s is given more than once to %s" % (arg_name, self.func_name))
            returned[arg_name] = arg

    def _check_missing_arguments(self, args_dict):
        required_arguments = self.get_required_arg_names()
        missing_arguments = required_arguments - set(args_dict)
        if missing_arguments:
            raise MissingArguments("The following arguments were not specified: %s" % ",".join(map(repr, missing_arguments)))
    def _check_unknown_arguments(self, args_dict):
        positional_arg_count = len([arg_name for arg_name in args_dict if isinstance(arg_name, Number)])
        num_args = self.get_num_args()
        if positional_arg_count and not self.has_variable_args():
            raise UnknownArguments("%s receives %s positional arguments (%s specified)" % (self.func_name, num_args, num_args + positional_arg_count))
        unknown = set(arg for arg in args_dict if not isinstance(arg, Number)) - set(self.get_arg_names())
        if unknown and not self.has_variable_kwargs():
            raise UnknownArguments("%s received unknown argument(s): %s" % (self.func_name, ",".join(unknown)))



def is_bound_method(obj):
    return isinstance(obj, MethodType) and _has_self(obj)
def is_function(obj):
    return isinstance(obj, FunctionType) or isinstance(obj, BuiltinFunctionType)
def is_class(obj):
    return isinstance(obj, type) or isinstance(obj, ClassType)
def _has_self(f):
    return _get_self(f) is not None
def _get_self(f):
    if _IS_PY3:

# Path: infi/pyutils/exceptions.py
# class SignatureException(ReflectionException):
#     pass
# 
# class InvalidKeywordArgument(ReflectionException):
#     pass
# 
# class UnknownArguments(SignatureException):
#     pass
# 
# class MissingArguments(SignatureException):
#     pass


# Path: infi/pyutils/function_signature.py
from types import MethodType
from .exceptions import (
    SignatureException,
    InvalidKeywordArgument,
    UnknownArguments,
    MissingArguments,
    )
from numbers import Number
import copy
import inspect
import itertools
import platform

            if arg_name in returned:
                raise SignatureException("%s is given more than once to %s" % (arg_name, self.func_name))
            returned[arg_name] = arg

    def _check_missing_arguments(self, args_dict):
        required_arguments = self.get_required_arg_names()
        missing_arguments = required_arguments - set(args_dict)
        if missing_arguments:
            raise MissingArguments("The following arguments were not specified: %s" % ",".join(map(repr, missing_arguments)))
    def _check_unknown_arguments(self, args_dict):
        positional_arg_count = len([arg_name for arg_name in args_dict if isinstance(arg_name, Number)])
        num_args = self.get_num_args()
        if positional_arg_count and not self.has_variable_args():
            raise UnknownArguments("%s receives %s positional arguments (%s specified)" % (self.func_name, num_args, num_args + positional_arg_count))
        unknown = set(arg for arg in args_dict if not isinstance(arg, Number)) - set(self.get_arg_names())
        if unknown and not self.has_variable_kwargs():
            raise UnknownArguments("%s received unknown argument(s): %s" % (self.func_name, ",".join(unknown)))



def is_bound_method(obj):
    return isinstance(obj, MethodType) and _has_self(obj)
def is_function(obj):
    return isinstance(obj, FunctionType) or isinstance(obj, BuiltinFunctionType)
def is_class(obj):
    return isinstance(obj, type) or isinstance(obj, ClassType)
def _has_self(f):
    return _get_self(f) is not None
def _get_self(f):
    if _IS_PY3:

        return f.__self__