Skip to content

When definition custom functions, built-in funciton not working #133

@iyaozhen

Description

@iyaozhen

code:

# __version__ = '0.9.2'
import jmespath
from jmespath import functions

class CustomFunctions(functions.Functions):
    @functions.signature({'types': ['number']}, {'types': ['number']})
    def _func_my_add(self, x, y):
        return x + y

# options = jmespath.Options(custom_functions=CustomFunctions())

print jmespath.search('length(`test`)', {})

error:

TypeError: unbound method _func_length() must be called with CustomFunctions instance as first argument (got Functions instance instead)

I just definition CustomFunctions, and not use every time. It is very regularly use in a big framework.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions