Skip to content

Ports

Foundational port definition for the ForgingBlocks.

ports

Foundational port definition for the ForgingBlocks.

Port

Bases: Protocol[InputType, OutputType]

Base protocol for defining interface contracts.

Port is a generic Protocol that serves as the foundation for interface
declarations. It provides type parameters (InputType, OutputType) and
defines no methods — it's a marker protocol that you extend to create
your own specific interfaces.

TYPE PARAMETERS:
- InputType: The type of data accepted by operations on this interface.
- OutputType: The type of data returned by operations on this interface.

Source code in src/forging_blocks/foundation/ports.py
class Port(Protocol[InputType, OutputType]):  # type: ignore[reportInvalidTypeVarUse]
    """Base protocol for defining interface contracts.

    Port is a generic Protocol that serves as the foundation for interface
    declarations. It provides type parameters (InputType, OutputType) and
    defines no methods — it's a marker protocol that you extend to create
    your own specific interfaces.

    TYPE PARAMETERS:
    - `InputType`: The type of data accepted by operations on this interface.
    - `OutputType`: The type of data returned by operations on this interface.
    """

InboundPort

Bases: Port[InputType, OutputType], Protocol

Alias for Port used as an inbound marker.

Source code in src/forging_blocks/foundation/ports.py
class InboundPort(Port[InputType, OutputType], Protocol):  # type: ignore[reportInvalidTypeVarUse]
    """Alias for Port used as an inbound marker."""

OutboundPort

Bases: Port[InputType, OutputType], Protocol

Alias for Port used as an outbound marker.

Source code in src/forging_blocks/foundation/ports.py
class OutboundPort(Port[InputType, OutputType], Protocol):  # type: ignore[reportInvalidTypeVarUse]
    """Alias for Port used as an outbound marker."""

InputPort

Bases: InboundPort[InputType, OutputType], Protocol

Alias for InboundPort.

Source code in src/forging_blocks/foundation/ports.py
class InputPort(InboundPort[InputType, OutputType], Protocol):  # type: ignore[reportInvalidTypeVarUse]
    """Alias for InboundPort."""

OutputPort

Bases: OutboundPort[InputType, OutputType], Protocol

Alias for OutboundPort.

Source code in src/forging_blocks/foundation/ports.py
class OutputPort(OutboundPort[InputType, OutputType], Protocol):  # type: ignore[reportInvalidTypeVarUse]
    """Alias for OutboundPort."""