5f6b5d3851d0b719f401eafbfc569420405d1ef3,bokeh/models/formatters.py,FuncTickFormatter,from_py_func,#Any#Any#,215

Before Change


                                   "("conda install -c bokeh flexx" or "pip install flexx")")
        argspec = inspect.getargspec(func)

        if (len(argspec[0]) - len(argspec[3] or [])) != 1:
            raise ValueError("Function `func` must have exactly one positional argument, but %d were supplied." % (len(argspec[0]) - len(argspec[3] or [])))

        all_args = argspec[0][:]
        func_arg = argspec[0].pop(0)
        func_kwargs = dict(zip(argspec[0], argspec[3] or []))

        // Set the transpiled functions as `formatter` so that we can call it
        code = pyscript.py2js(func, "formatter")

        // We wrap the transpiled function into an anonymous function with a single
        // arg that matches that of func and all args inside `formatter`
        wrapped_code = "function (%s) {%sreturn formatter(%s)};" % (func_arg, code, ", ".join(all_args))

        return cls(code=wrapped_code, args=func_kwargs)

    @classmethod

After Change


        if len(default_names) - len(default_values) != 0:
            raise ValueError("Function `func` may only contain keyword arguments.")

        if default_values and not any([isinstance(value, Model) for value in default_values]):
            raise ValueError("Default value must be a plot object.")

        func_kwargs = dict(zip(default_names, default_values))

        // Wrap the code attr in a function named `formatter` and call it
        // with arguments that match the `args` attr
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 8

Instances


Project Name: bokeh/bokeh
Commit Name: 5f6b5d3851d0b719f401eafbfc569420405d1ef3
Time: 2016-08-16
Author: canavandl@gmail.com
File Name: bokeh/models/formatters.py
Class Name: FuncTickFormatter
Method Name: from_py_func


Project Name: soft-matter/trackpy
Commit Name: 42be11c7824427fb0a8490f3bcd635410ded57b3
Time: 2017-07-27
Author: caspervdw@gmail.com
File Name: trackpy/linking/find_link.py
Class Name: FindLinker
Method Name: get_relocate_candidates


Project Name: dit/dit
Commit Name: 55f6f1ab292abe7a10a93982fa6df48f8d4c4854
Time: 2014-10-25
Author: chebee7i@gmail.com
File Name: dit/math/aitchison.py
Class Name:
Method Name: closure


Project Name: GPflow/GPflowOpt
Commit Name: 90e37a0b94d8ff6bc4a950c9aa58792eca86fbb7
Time: 2017-08-06
Author: joachim.vanderherten@ugent.be
File Name: GPflowOpt/optim.py
Class Name: StagedOptimizer
Method Name: optimize