Port

class fugu.scaffold.port.ChannelSpec(name: str, description: str = '', coding: list[str] = <factory>, shape: tuple[int] | None = None, required: bool = True)

Bases: object

Describes the characteristics of one group of neurons. These work together for a purpose designated by the brick. A Port can have several different Channels. Typically, these would include ‘data’ and a control signal such as ‘complete’ or ‘begin’.

name: str
description: str = ''
coding: list[str]
shape: tuple[int] = None
required: bool = True
class fugu.scaffold.port.PortSpec(name: str, description: str = '', index: int = 0, minimum: int = 1, maximum: int = 1, channels: dict[str, ~fugu.scaffold.port.ChannelSpec] = <factory>)

Bases: object

Describes the characteristics of one input or output connection of a brick. A brick may have several of each kind. Each port may have several channels in it, each conveying a different kind of information associated with the port.

In some cases, a brick may receive a variable number of inputs. To handle this, a brick may declare an “auto-port” by setting maximum to something other than 1.

name: str
description: str = ''
index: int = 0
minimum: int = 1
maximum: int = 1
channels: dict[str, ChannelSpec]
class fugu.scaffold.port.ChannelData(spec: ~fugu.scaffold.port.ChannelSpec, neurons: list[str] = <factory>)

Bases: object

A bundle of neuron instances that work together to convey a specific topic of information. These are used to make connections at construction time.

spec: ChannelSpec
neurons: list[str]
class fugu.scaffold.port.PortData(spec: ~fugu.scaffold.port.PortSpec, channels: dict[str, ~fugu.scaffold.port.ChannelData] = <factory>)

Bases: object

A collection of all the neuron instances associated with a given input or output of a brick. These are organized into topical groups called channels.

spec: PortSpec
channels: dict[str, ChannelData]
exception fugu.scaffold.port.PortError

Bases: Exception

class fugu.scaffold.port.PortUtil

Bases: object

classmethod autoport_match(port_name, query)

Determines if query is a legitimate auto-port name derived from port_name. Also returns true if query exactly matches port_name. In that case, it’s not actually an auto-port, just a regular port name. (We could add an option for strict, in which case this would only return true if the query has a numeric suffix.)

classmethod find_port_name(ports: dict[str, PortSpec], index: int)

Find the port name corresponding to the given position index. If no such port exists, the given index is returned as a string (assumes old-style bricks). This method assumes that the dictionary keys exactly match the PortSpec.name of their associated values.

classmethod find_port_index(ports: dict[str, PortSpec], name: str)

Find the position index of the port with the given name. If no such port exists, the given name is returned as an int (assumes old-style bricks). This method assumes that the dictionary keys exactly match the PortSpec.name of their associated values.

classmethod make_ports_from_specs(specs: dict[str, PortSpec]) dict[str, PortData]
classmethod get_autoports(ports: dict[str, PortData], autoport_name: str = 'input', count: int = 1)

Returns a tuple of ports matching given name. count (int): Size of the tuple to return. Passing zero for count cause the tuple to contain

all ports matching the name.