FABulous.fabric_generator.parser.parse_switchmatrix =================================================== .. py:module:: FABulous.fabric_generator.parser.parse_switchmatrix .. autoapi-nested-parse:: Parser functions for switch matrix and list file configurations. This module provides utilities for parsing switch matrix CSV files and list files used in fabric definition. It handles expansion of port definitions, connection mappings, and validation of port configurations. Classes ------- Functions --------- .. py:function:: expandListPorts(port, PortList) Expand the .list file entry into a list of tuples. :param port: The port entry to expand. If it contains "[", it's split into multiple entries based on "|". :type port: str :param PortList: The list where expanded port entries are appended. :type PortList: list :raises ValueError: If the port entry contains "[" or "{" without matching closing bracket "]"/"}". .. py:function:: parseList(filePath: pathlib.Path, collect: Literal['pair'] = 'pair') Parse a list file and expand the list file information into a list of tuples. :param fileName: "" :type fileName: Path :param collect: Collect value by source, sink or just as pair. Defaults to "pair". :type collect: (Literal["", "source", "sink"], optional) :raises ValueError: The file does not exist. :raises ValueError: Invalid format in the list file. :returns: **Union** -- Return either a list of connection pairs or a dictionary of lists which is collected by the specified option, source or sink. :rtype: [list[tuple[str, str]], dict[str, list[str]]] .. py:function:: parseMatrix(fileName, tileName) Parse the matrix CSV into a dictionary from destination to source. :param fileName: Directory of the matrix CSV file. :type fileName: Path :param tileName: Name of the tile needed to be parsed. :type tileName: str :raises ValueError: Non matching matrix file content and tile name :returns: **dict** -- Dictionary from destination to a list of sources. :rtype: [str, list[str]] .. py:function:: parsePortLine(line) Parse a single line of the port configuration from the CSV file. :param line: CSV line containing port configuration data. :type line: str :returns: A tuple containing a list of parsed ports and an optional common wire pair. :rtype: tuple[list[Port], tuple[str, str] | None] Module Attributes ----------------- .. py:data:: oppositeDic :no-index: