concepts.dm.crow.function.CrowFeature#
- class CrowFeature[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 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.
Whether the feature is an observation variable.
Whether the feature is a state variable.
- __call__(*args, **kwargs)#
Call self as a function.
- __init__(name, ftype, derived_expression=None, observation=None, state=None)[source]#
- Parameters:
name (str) – the name of the function.
ftype (FunctionType) – the function type.
derived_expression (ValueOutputExpression | None) – the expression that this function is derived from.
overridden_call – the overridden call function.
resolved_from – the record of the function that this function is resolved from. This is used for handling partial evaluation and function specialization (for overloadded functions).
function_body – the function body.
observation (bool | None) –
state (bool | None) –
- __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#
- 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#