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.
code:
error:
I just definition
CustomFunctions, and not use every time. It is very regularly use in a big framework.