add has_ports()
This commit is contained in:
parent
d4bb466ad9
commit
468322ceb9
@ -593,7 +593,6 @@ class Pattern(PortList, AnnotatableImpl, Mirrorable):
|
||||
|
||||
def is_empty(self) -> bool:
|
||||
"""
|
||||
# TODO is_empty doesn't include ports... maybe there should be an equivalent?
|
||||
Returns:
|
||||
True if the pattern is contains no shapes, labels, or refs.
|
||||
"""
|
||||
@ -620,6 +619,13 @@ class Pattern(PortList, AnnotatableImpl, Mirrorable):
|
||||
"""
|
||||
return any(True for _ in chain.from_iterable(self.labels.values()))
|
||||
|
||||
def has_ports(self) -> bool:
|
||||
"""
|
||||
Returns:
|
||||
True if the pattern contains any ports.
|
||||
"""
|
||||
return bool(self.ports)
|
||||
|
||||
def ref(self, target: str | None, *args: Any, **kwargs: Any) -> Self:
|
||||
"""
|
||||
Convenience function which constructs a `Ref` object and adds it
|
||||
|
Loading…
Reference in New Issue
Block a user