concepts.dm.crow.crow_function.CrowFunction#
- class CrowFunction[source]#
Bases:
CrowFunctionBase
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 function is execution-dependent.
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 simulation-dependent.
Whether the function is static (i.e., its grounded value will never change).
Whether the function can be cached.
The evaluation mode of the function.
Whether the function is a generator placeholder.
The list of inplace generators.
Whether the function is a SGC (state-goal-constraint) function.
- __call__(*args, **kwargs)#
Call self as a function.
- __init__(name, ftype, derived_expression=None, generator_placeholder=False, inplace_generators=None, sgc=False, simulation=False, execution=False)[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.
generator_placeholder (bool)
sgc (bool)
simulation (bool)
execution (bool)
- __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)#
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#
- evaluation_mode: CrowFunctionEvaluationMode#
The evaluation mode of the function. This enum has three values:
- inplace_generators: Tuple[str, ...]#
The list of inplace generators. This is usually used together with generator-placeholder 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#