add has_ports()
This commit is contained in:
parent
ece7b36801
commit
a8686a6748
@ -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