concepts.dm.crow.crow_function.CrowFunctionBase#
- class CrowFunctionBase[source]#
Bases:
Function
The base class for Crow functions. This is the base class for both
CrowFeature
andCrowFunction
.Methods
flags
([short])Return the flags of the function.
from_function
(function[, implementation, sig])Create a function object from an actual Python function.
get_overridden_call
([ftype_index])Get the overridden call function.
get_sub_function
(ftype_index)mark_static
([flag])Mark a predicate as static (i.e., its grounded value will never change).
partial
(*args[, execute_fully_bound_functions])remap_arguments
(remapping)Generate a new Function object with a different argument order.
set_function_body
(function_body)Set the function body.
set_function_name
(function_name)Set the function name.
Attributes
Whether the object is defined as a state feature.
Whether the object is defined as a function.
Return True if the function is overloaded.
Whether the function is static (i.e., its grounded value will never change).
Whether the function can be cached.
- __call__(*args, **kwargs)#
Call self as a function.
- __init__(name, ftype, derived_expression=None)[source]#
Initialize the Crow function.
- Parameters:
name (str) – the name of the function.
ftype (FunctionType) – the type of the function.
derived_expression (ValueOutputExpression | None) – an optional derived expression of the function.
- __new__(**kwargs)#
- classmethod from_function(function, implementation=True, sig=None)#
Create a function object from an actual Python function.
- get_overridden_call(ftype_index=None)#
Get the overridden call function.
- mark_static(flag=True)[source]#
Mark a predicate as static (i.e., its grounded value will never change).
- Parameters:
flag (bool) – Whether to mark the predicate as static.
- partial(*args, execute_fully_bound_functions=False, **kwargs)#
- Return type:
- remap_arguments(remapping)#
Generate a new Function object with a different argument order. Specifically, remapping is a permutation. The i-th argument to the new function will be the remapping[i]-th argument in the old function.
- property all_sub_functions#
- is_cacheable: bool#
Whether the function can be cached. Specifically, if it contains only “ObjectTypes” as arguments, it can be statically evaluated.
- property return_type: ObjectType | ValueType | FunctionType | SequenceType#