pipda.function
FunctionCall— A function call object that awaits for evaluation</>
register_func(func,cls,plain,name,qualname,doc,module,dispatchable,pipeable,context,kw_context,ast_fallback)(Callable) — Register a function</>
pipda.function.FunctionCall(func, *args, **kwargs)
A function call object that awaits for evaluation
func(Union) — A registered function byregister_funcor an expression,for example,f.col.mean
__array_ufunc__(ufunc,method,*inputs,**kwargs)(FunctionCall) — Allow numpy ufunc to work on Expression objects</>__getattr__(name)(ReferenceAttr) — Wheneverexpr.attris encountered,return a ReferenceAttr object </>__getitem__(item)(ReferenceItem) — Wheneverexpr[item]is encountered,return a ReferenceAttr object </>__hash__()(int) — Make it hashable</>__index__()— Allow Expression object to work as index or part of slice</>__iter__()— Forbiden iterating on Expression objects</>__str__()(str) — Representation of the function call</>
__array_ufunc__(ufunc, method, *inputs, **kwargs) → FunctionCall
Allow numpy ufunc to work on Expression objects
__getattr__(name) → ReferenceAttr
Whenever expr.attr is encountered,return a ReferenceAttr object
__getitem__(item) → ReferenceItem
Whenever expr[item] is encountered,return a ReferenceAttr object
__str__() → str
Representation of the function call
pipda.function.register_func(func=None, cls=<class 'pipda.utils.TypeHolder'>, plain=False, name=None, qualname=None, doc=None, module=None, dispatchable=False, pipeable=False, context=None, kw_context=None, ast_fallback='normal_warning')
Register a function
A function, unlike a verb, is a function that doesn't evaluate its arguments by the first argument, which is the data, it depends on the data from a verb to evaluate the arguments if they are Expression objects.
A function can also be defined as pipeable, so that the first argument can be piped in later.
A function can also be defined as dispatchable. The types of any positional arguments are used to dispatch the implementation.
func(Optional, optional) — The generic function.IfNone(not provided), this function will return a decorator.cls(Type, optional) — The default type to register for _default backendif TypeHolder, it is a generic function, and not counted as a real implementation. For plain or non-dispatchable functions, specify a different type than TypeHolder to indicate the func is a real implementation.plain(bool, optional) — If True, the function will be registered as a plain function,which means it will be called without any evaluation of the arguments. It doesn't support dispatchable and pipeable.name(str | none, optional) — andqualname(str | none, optional) — anddoc(str | none, optional) — andmodule(str | none, optional) — The meta information about the function to overwritefunc'sor when it's not available fromfuncdispatchable(str | bool, optional) — If not False nor None, the function will be registered asa dispatchable function, which means it will be dispatched using the types of the arguments: "first" - Use the first argument "args" - Use all positional arguments "kwargs" - Use all keyword arguments "all" - Use all arguments If False, the function is not dispatchable.pipeable(bool, optional) — If True, the function will work like a verb when a data ispiping in. If dispatchable, the first argument will be used to dispatch the implementation. The rest of the arguments will be evaluated using the data from the first argument.context(ContextType | None, optional) — The context used to evaluate the rest arguments using thefirst argument only when the function is pipeable and the data is piping in.kw_context(Dict[str, ContextType] | None, optional) — The context used to evaluate the keyword argumentsast_fallback(str, optional) — What's the supposed way to call the func whenAST node detection fails. piping - Suppose this func is called likedata >> func(...)normal - Suppose this func is called likefunc(data, ...)piping_warning - Suppose piping call, but show a warning normal_warning - Suppose normal call, but show a warning raise - Raise an error
The registered func or a decorator to register a func