FileParameter#
- class maize.core.interface.FileParameter(*args: Any, **kwargs: Any)[source]#
Bases:
Parameter
[P
]Allows provision of files as parameters to nodes.
- Parameters:
exist_required – If
True
will raise an exception if the specified file can’t be found- Raises:
FileNotFoundError – If the input file doesn’t exist
See also
Parameter
Allows specifying values as parameters
- __init__(default: P | None = None, exist_required: bool = True, optional: bool = False) None [source]#
Methods
__init__
([default, exist_required, optional])build
(name, parent)Instantiate an interface from the description.
check
(value)Checks if a value is valid using type annotations.
set
(value)Set the parameter to a specified value.
Attributes
Returns whether the parameter was explicitly set
Provides the path to the file.
Returns whether the default value is set
Indicates whether the parameter has been set to a non-
None
value.Provides a unique path to the interface.
Provides a serialized summary of the parameter
Provides the value of the parameter.
name
parent
datatype
doc
- build(name: str, parent: Component) _TInter #
Instantiate an interface from the description.
- Parameters:
name – Name of the interface, will typically be the attribute name of the parent object
parent – Parent component instance
- Returns:
Copy of the current instance, with references to the name and the parent
- Return type:
_TInter
- check(value: T) bool #
Checks if a value is valid using type annotations.
- Parameters:
value – Value to typecheck
- Returns:
True
if the value is valid,False
otherwise- Return type:
- property filepath: P#
Provides the path to the file.
- set(value: P) None [source]#
Set the parameter to a specified value.
- Parameters:
value – Value to set the parameter to
- Raises:
ValueError – If the datatype doesn’t match with the parameter type
Examples
>>> foo.val.set(42)
See also
graph.Graph.add
Allows setting parameters at the point of node addition
component.Component.update_parameters
Sets multiple parameters over a node, graph, or workflow at once
- property value: T#
Provides the value of the parameter.