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:
Christian Kellner 2021-01-21 18:35:17 +00:00
parent 18671686ee
commit 91aa0c6e88

View file

@ -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: