# Buggy code
def __init__(
    self, kls, func, funcinvplus, funcinvminus, derivplus, derivminus, *args, **kwargs
):
    # print args
    # print kwargs

    self.func = func
    self.funcinvplus = funcinvplus
    self.funcinvminus = funcinvminus
    self.derivplus = derivplus
    self.derivminus = derivminus
    # explicit for self.__dict__.update(kwargs)
    # need to set numargs because inspection does not work
    self.numargs = kwargs.pop("numargs", 0)
    # print self.numargs
    name = kwargs.pop("name", "transfdist")
    longname = kwargs.pop("longname", "Non-linear transformed distribution")
    extradoc = kwargs.pop("extradoc", None)
    a = kwargs.pop("a", -np.inf)  # attached to self in super
    b = kwargs.pop("b", np.inf)  # self.a, self.b would be overwritten
    self.shape = kwargs.pop("shape", False)
    # defines whether it is a `u` shaped or `hump' shaped
    #       transformation

    self.u_args, self.u_kwargs = get_u_argskwargs(**kwargs)
    self.kls = kls  # (self.u_args, self.u_kwargs)
    # possible to freeze the underlying distribution

    super(TransfTwo_gen, self).__init__(
        a=a, b=b, name=name, shapes=kls.shapes, longname=longname, extradoc=extradoc
    )


# Traceback (TypeError)
======================================================================
ERROR: Failure: TypeError (__init__() takes at least 7 arguments (1 given))
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/travis/miniconda/envs/statsmodels-test/lib/python2.7/site-packages/nose/loader.py", line 519, in makeTest
return self._makeTest(obj, parent)
File "/home/travis/miniconda/envs/statsmodels-test/lib/python2.7/site-packages/nose/loader.py", line 578, in _makeTest
return MethodTestCase(obj)
File "/home/travis/miniconda/envs/statsmodels-test/lib/python2.7/site-packages/nose/case.py", line 345, in __init__
self.inst = self.cls()
File "/home/travis/miniconda/envs/statsmodels-test/lib/python2.7/site-packages/statsmodels-0.6.0-py2.7-linux-x86_64.egg/statsmodels/sandbox/distributions/tests/testtransf.py", line 94, in __init__
(squaretg(10), stats.f(1, 10))]      #try both frozen
File "/home/travis/miniconda/envs/statsmodels-test/lib/python2.7/site-packages/scipy/stats/_distn_infrastructure.py", line 739, in __call__
return self.freeze(*args, **kwds)
File "/home/travis/miniconda/envs/statsmodels-test/lib/python2.7/site-packages/scipy/stats/_distn_infrastructure.py", line 736, in freeze
return rv_frozen(self, *args, **kwds)
File "/home/travis/miniconda/envs/statsmodels-test/lib/python2.7/site-packages/scipy/stats/_distn_infrastructure.py", line 431, in __init__
self.dist = dist.__class__(**dist._ctor_param)
TypeError: __init__() takes at least 7 arguments (1 given)
======================================================================
ERROR: Failure: TypeError (__init__() takes at least 7 arguments (1 given))
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/travis/miniconda/envs/statsmodels-test/lib/python2.7/site-packages/nose/loader.py", line 519, in makeTest
return self._makeTest(obj, parent)
File "/home/travis/miniconda/envs/statsmodels-test/lib/python2.7/site-packages/nose/loader.py", line 578, in _makeTest
return MethodTestCase(obj)
File "/home/travis/miniconda/envs/statsmodels-test/lib/python2.7/site-packages/nose/case.py", line 345, in __init__
self.inst = self.cls()
File "/home/travis/miniconda/envs/statsmodels-test/lib/python2.7/site-packages/statsmodels-0.6.0-py2.7-linux-x86_64.egg/statsmodels/sandbox/distributions/tests/testtransf.py", line 94, in __init__
(squaretg(10), stats.f(1, 10))]      #try both frozen
File "/home/travis/miniconda/envs/statsmodels-test/lib/python2.7/site-packages/scipy/stats/_distn_infrastructure.py", line 739, in __call__
return self.freeze(*args, **kwds)
File "/home/travis/miniconda/envs/statsmodels-test/lib/python2.7/site-packages/scipy/stats/_distn_infrastructure.py", line 736, in freeze
return rv_frozen(self, *args, **kwds)
File "/home/travis/miniconda/envs/statsmodels-test/lib/python2.7/site-packages/scipy/stats/_distn_infrastructure.py", line 431, in __init__
self.dist = dist.__class__(**dist._ctor_param)
TypeError: __init__() takes at least 7 arguments (1 given)
----------------------------------------------------------------------
Ran 3116 tests in 601.138s
FAILED (SKIP=23, errors=2)

# Fixed code
def __init__(
    self, kls, func, funcinvplus, funcinvminus, derivplus, derivminus, *args, **kwargs
):
    # print args
    # print kwargs

    self.func = func
    self.funcinvplus = funcinvplus
    self.funcinvminus = funcinvminus
    self.derivplus = derivplus
    self.derivminus = derivminus
    # explicit for self.__dict__.update(kwargs)
    # need to set numargs because inspection does not work
    self.numargs = kwargs.pop("numargs", 0)
    # print self.numargs
    name = kwargs.pop("name", "transfdist")
    longname = kwargs.pop("longname", "Non-linear transformed distribution")
    extradoc = kwargs.pop("extradoc", None)
    a = kwargs.pop("a", -np.inf)  # attached to self in super
    b = kwargs.pop("b", np.inf)  # self.a, self.b would be overwritten
    self.shape = kwargs.pop("shape", False)
    # defines whether it is a `u` shaped or `hump' shaped
    #       transformation

    self.u_args, self.u_kwargs = get_u_argskwargs(**kwargs)
    self.kls = kls  # (self.u_args, self.u_kwargs)
    # possible to freeze the underlying distribution

    super(TransfTwo_gen, self).__init__(
        a=a, b=b, name=name, shapes=kls.shapes, longname=longname, extradoc=extradoc
    )

    # add enough info for self.freeze() to be able to reconstruct the instance
    try:
        self._ctor_param.update(
            dict(
                kls=kls,
                func=func,
                funcinvplus=funcinvplus,
                funcinvminus=funcinvminus,
                derivplus=derivplus,
                derivminus=derivminus,
                shape=self.shape,
            )
        )
    except AttributeError:
        # scipy < 0.14 does not have this, ignore and do nothing
        pass