Class PythonCallableSource

  • All Implemented Interfaces:
    java.io.Serializable

    public class PythonCallableSource
    extends java.lang.Object
    implements java.io.Serializable
    A wrapper object storing a Python function definition that can be evaluated to Python callables in Python SDK.

    The snippet of Python code can be a valid Python expression (such as lambda x: x * x or {str.upper}), a fully qualified name (such as math.sin), or a complete, multi-line function or class definition (such as def foo(x): ... or class Foo: ...).

    Any lines preceding the function definition are first evaluated to provide context in which to define the function which can be useful to declare imports or any other needed values, e.g.

     import math
    
     def helper(x):
       return x * x
    
     def func(y):
       return helper(y) + y
     
    in which case func would get applied to each element.
    See Also:
    Serialized Form
    • Method Detail

      • getPythonCallableCode

        public java.lang.String getPythonCallableCode()