# 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

_NO_DEFAULT = object()

class Argument(object):
    def __init__(self, name, default=_NO_DEFAULT):
        super(Argument, self).__init__()
        self.name = name
        self.default = default
    def has_default(self):
        return self.default is not _NO_DEFAULT

class FunctionSignature(object):
    def __init__(self, func):
        super(FunctionSignature, self).__init__()
        self.func = func
        self.func_name = func.__name__
        self._build_arguments()
    def is_bound_method(self):
        return is_bound_method(self.func)
    def is_class_method(self):
        return is_class_method(self.func)
    def _iter_args_and_defaults(self, args, defaults):
        defaults = [] if defaults is None else defaults
        filled_defaults = itertools.chain(itertools.repeat(_NO_DEFAULT, len(args) - len(defaults)), defaults)
        return izip(args, filled_defaults)

    def _build_arguments(self):
        self._args = []
        try:
            args, varargs_name, kwargs_name, defaults = inspect.getargspec(self.func)

# 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


_NO_DEFAULT = object()

class Argument(object):
    def __init__(self, name, default=_NO_DEFAULT):
        super(Argument, self).__init__()
        self.name = name
        self.default = default
    def has_default(self):
        return self.default is not _NO_DEFAULT

class FunctionSignature(object):
    def __init__(self, func):
        super(FunctionSignature, self).__init__()
        self.func = func
        self.func_name = func.__name__
        self._build_arguments()
    def is_bound_method(self):
        return is_bound_method(self.func)
    def is_class_method(self):
        return is_class_method(self.func)
    def _iter_args_and_defaults(self, args, defaults):
        defaults = [] if defaults is None else defaults
        filled_defaults = itertools.chain(itertools.repeat(_NO_DEFAULT, len(args) - len(defaults)), defaults)
        return izip(args, filled_defaults)

    def _build_arguments(self):
        self._args = []
        try:
            args, varargs_name, kwargs_name, defaults = inspect.getargspec(self.func)

        except TypeError: