TimeloopFE
Loading...
Searching...
No Matches
timeloopfe.common.nodes.TypeSpecifier Class Reference

Represents a type specifier for a node in the TimeloopFE library. More...

Collaboration diagram for timeloopfe.common.nodes.TypeSpecifier:

Public Member Functions

 __init__ (self, str name, Type required_type, Any default=default_unspecified_, Union[Callable, None] callfunc=None, Type should_have_been_removed_by=None, bool part_name_match=False, bool no_change_key=False)
 
 removed_by_str (self)
 
Any cast_check_type (self, Any value, "Node" node, str key)
 
Any cast (self, Any value, bool __node_skip_parse=False)
 
 check_type (self, Any value, "Node" node, str key)
 

Public Attributes

str name = name
 
Type required_type = required_type
 
Any default = default
 
Callable callfunc = callfunc
 
Type callfunc = required_type
 
Type should_have_been_removed_by = should_have_been_removed_by
 
Any set_from = self.should_have_been_removed_by
 
bool part_name_match = part_name_match
 
bool no_change_key = no_change_key
 

Detailed Description

Represents a type specifier for a node in the TimeloopFE library.

Attributes: name (str): The name of the type specifier. required_type (Type): The required type for the node. default (Any): The default value for the type specifier. callfunc (Union[Callable, None]): The function to call for casting the value. should_have_been_removed_by (Type): The type that should have removed or transformed the node. part_name_match (bool): Flag indicating if the name should be partially matched. no_change_key (bool): Flag indicating if the key should not be changed.

Methods: removed_by_str(self): Get the string representation of the type that should have removed or transformed the node. cast_check_type(self, value: Any, node: "Node", key: str) -> Any: Check and cast the value to the required type. cast(self, value: Any, __node_skip_parse: bool = False) -> Any: Cast the value to the required type. check_type(self, value: Any, node: "Node", key: str): Check if the value matches the required type.

Constructor & Destructor Documentation

◆ __init__()

timeloopfe.common.nodes.TypeSpecifier.__init__ ( self,
str name,
Type required_type,
Any default = default_unspecified_,
Union[Callable, None] callfunc = None,
Type should_have_been_removed_by = None,
bool part_name_match = False,
bool no_change_key = False )

Member Function Documentation

◆ cast()

Any timeloopfe.common.nodes.TypeSpecifier.cast ( self,
Any value,
bool __node_skip_parse = False )

◆ cast_check_type()

Any timeloopfe.common.nodes.TypeSpecifier.cast_check_type ( self,
Any value,
"Node" node,
str key )

◆ check_type()

timeloopfe.common.nodes.TypeSpecifier.check_type ( self,
Any value,
"Node" node,
str key )

◆ removed_by_str()

timeloopfe.common.nodes.TypeSpecifier.removed_by_str ( self)

Member Data Documentation

◆ callfunc [1/2]

Callable timeloopfe.common.nodes.TypeSpecifier.callfunc = callfunc

◆ callfunc [2/2]

Type timeloopfe.common.nodes.TypeSpecifier.callfunc = required_type

◆ default

Any timeloopfe.common.nodes.TypeSpecifier.default = default

◆ name

str timeloopfe.common.nodes.TypeSpecifier.name = name

◆ no_change_key

bool timeloopfe.common.nodes.TypeSpecifier.no_change_key = no_change_key

◆ part_name_match

bool timeloopfe.common.nodes.TypeSpecifier.part_name_match = part_name_match

◆ required_type

Type timeloopfe.common.nodes.TypeSpecifier.required_type = required_type

◆ set_from

Any timeloopfe.common.nodes.TypeSpecifier.set_from = self.should_have_been_removed_by

◆ should_have_been_removed_by

Type timeloopfe.common.nodes.TypeSpecifier.should_have_been_removed_by = should_have_been_removed_by

The documentation for this class was generated from the following file: