fixup! add ok_connections arg to allow plugging mismatched ports without warnings

This commit is contained in:
Jan Petykiewicz 2024-10-05 15:50:35 -07:00
parent ed649dbd1a
commit bbdf6b877d
2 changed files with 2 additions and 2 deletions

View File

@ -2,7 +2,7 @@
Simplified Pattern assembly (`Builder`) Simplified Pattern assembly (`Builder`)
""" """
from typing import Self from typing import Self
from collections.abc import Sequence, Mapping from collections.abc import Iterable, Sequence, Mapping
import copy import copy
import logging import logging
from functools import wraps from functools import wraps

View File

@ -515,7 +515,7 @@ class PortList(metaclass=ABCMeta):
o_offsets[:, 1] *= -1 o_offsets[:, 1] *= -1
o_rotations *= -1 o_rotations *= -1
ok_pairs = {tuple(sorted(pair)) for pair in ok_connections if pair[0] != pair[1])} ok_pairs = {tuple(sorted(pair)) for pair in ok_connections if pair[0] != pair[1]}
type_conflicts = numpy.array([(st != ot) and ('unk' not in (st, ot)) and (tuple(sorted((st, ot))) not in ok_pairs) type_conflicts = numpy.array([(st != ot) and ('unk' not in (st, ot)) and (tuple(sorted((st, ot))) not in ok_pairs)
for st, ot in zip(s_types, o_types, strict=True)]) for st, ot in zip(s_types, o_types, strict=True)])
if type_conflicts.any(): if type_conflicts.any():