manifest: add __contains__ method
Since `__iter__` is return an iterator over the `Pipeline` objects, the `"name" in manifest` check would not work for name or ids. Thus provide an implemention of `__contains__` that does exactly that.
This commit is contained in:
parent
18671686ee
commit
91aa0c6e88
1 changed files with 3 additions and 0 deletions
|
|
@ -348,6 +348,9 @@ class Manifest:
|
|||
return pl
|
||||
return None
|
||||
|
||||
def __contains__(self, name_or_id: str) -> bool:
|
||||
return self.get(name_or_id) is not None
|
||||
|
||||
def __getitem__(self, name_or_id: str) -> Pipeline:
|
||||
pl = self.get(name_or_id)
|
||||
if pl:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue