Interface#

class maize.core.interface.Interface(*args: Any, **kwargs: Any)[source]#

Bases: Generic[T]

Interface parent class, handles behaviour common to ports and parameters.

name#

Unique interface name

Type:

str

parent#

Parent node instance this interface is part of

Type:

Component

datatype#

The datatype of the associated value. This may be a type from the typing library and thus not always usable for checks with isinstance()

Type:

Any

__init__()#

Methods

__init__()

build(name, parent)

Instantiate an interface from the description.

check(value)

Checks if a value is valid using type annotations.

Attributes

path

Provides a unique path to the interface.

serialized

Provides a serialized summary of the parameter

name

parent

datatype

doc

build(name: str, parent: Component) _TInter[source]#

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[source]#

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:

bool

property path: tuple[str, ...]#

Provides a unique path to the interface.

property serialized: dict[str, Any]#

Provides a serialized summary of the parameter