"""
Alternate namespece for toolz such that all functions are curried

Currying provides implicit partial evaluation of all functions

Example:

    Get usually requires two arguments, an index and a collection
    >>> from toolz.curried import get
    >>> get(0, ('a', 'b'))
    'a'

    When we use it in higher order functions we often want to pass a partially
    evaluated form
    >>> data = [(1, 2), (11, 22), (111, 222)])
    >>> map(lambda seq: get(0, seq), data)
    [1, 11, 111]

    The curried version allows simple expression of partial evaluation
    >>> map(get(0), data)
    [1, 11, 111]

See Also:
    toolz.functoolz.curry
"""

import toolz
import toolz.curried_exceptions
from .functoolz import curry
import inspect


def nargs(f):
    try:
        return len(inspect.getargspec(f).args)
    except TypeError:
        return None


def should_curry(f):
    do_curry = set((toolz.map, toolz.filter, toolz.sorted, toolz.reduce))
    return (callable(f) and nargs(f) and nargs(f) > 1
            or f in do_curry)


d = dict((name, curry(f) if should_curry(f) else f)
         for name, f in toolz.__dict__.items()
         if '__' not in name)

exceptions = dict((name, curry(f) if callable(f) else f)
                  for name, f in toolz.curried_exceptions.__dict__.items()
                  if '__' not in name)

locals().update(toolz.merge(d, exceptions))

@@ -421,17 +421,16 @@
 1, 222)%5D
-)
 %0A    %3E%3E%3E
@@ -426,24 +426,29 @@
 2)%5D%0A    %3E%3E%3E 
+list(
 map(lambda s
@@ -461,32 +461,33 @@
 t(0, seq), data)
+)
 %0A    %5B1, 11, 111
@@ -568,16 +568,21 @@
     %3E%3E%3E 
+list(
 map(get(
@@ -590,16 +590,17 @@
 ), data)
+)
 %0A    %5B1,
@@ -746,16 +746,17 @@
 t%0A%0A%0Adef 
+_
 nargs(f)
@@ -861,16 +861,17 @@
 e%0A%0A%0Adef 
+_
 should_c
@@ -973,32 +973,33 @@
 callable(f) and 
+_
 nargs(f) and nar
@@ -995,16 +995,17 @@
 (f) and 
+_
 nargs(f)
@@ -1041,16 +1041,17 @@
 urry)%0A%0A%0A
+_
 d = dict
@@ -1070,16 +1070,17 @@
 y(f) if 
+_
 should_c
@@ -1087,32 +1087,33 @@
 urry(f) else f)%0A
+ 
          for nam
@@ -1135,32 +1135,33 @@
 _dict__.items()%0A
+ 
          if '__'
@@ -1175,16 +1175,17 @@
  name)%0A%0A
+_
 exceptio
@@ -1225,32 +1225,33 @@
 able(f) else f)%0A
+ 
                 
@@ -1301,32 +1301,33 @@
 _dict__.items()%0A
+ 
                 
@@ -1378,19 +1378,21 @@
 z.merge(
+_
 d, 
+_
 exceptio

Fix `curried` doctests. They weren't run before.