from inspect import getargspec

__all__ = ['autocurry']


class autocurry(object):

    def __init__(self, f, *fargs, **fkwargs):
        self.f = f
        self.fargs = fargs
        self.fkwargs = fkwargs or {}
        self.__name__ = f.__name__

    def __call__(self, *args, **kwargs):
        # merge arguments from previous call with current call
        args = self.fargs + args
        self.fkwargs.update(kwargs)

        # determine number of non-keyword args
        arg_spec = getargspec(self.f)
        num_args = len(arg_spec[0])
        num_args -= len(arg_spec[3]) if arg_spec[3] else 0  # subtract number of arguments which have default values

        # if not enough args are supplied return a curried function
        if len(args) < num_args:
            return autocurry(self.f, *args, **self.fkwargs)
        else:
            return self.f(*args, **self.fkwargs)

@@ -1,16 +1,18 @@
-from
+import
  inspect
  imp
@@ -11,26 +11,19 @@
 pect
- 
+%0A
 import 
-getargspec
+sys
 %0A%0A__
@@ -470,19 +470,435 @@
     
-arg_spec = 
+# Python v3.5 reported getfullargspec as deprecated, but this was%0A        # reversed in v3.6. For simplicity, we'll just do it the new way%0A        # for everything but v3.5, which means the deprecation warning about%0A        # getargspec will still show for v3.5%0A        if sys.version_info%5B0%5D == 3 and sys.version_info%5B1%5D != 5:%0A            arg_spec = inspect.getfullargspec(self.f)%0A        else:%0A            arg_spec = inspect.
 geta

Fix deprecation warning