Add NoReturn __contains__ with a more descriptive error message

master
jan 7 months ago
parent c02c2f90ef
commit 3245de99b3

@ -1,4 +1,4 @@
from typing import Iterable, KeysView, ValuesView, overload, Self, Mapping
from typing import Iterable, KeysView, ValuesView, overload, Self, Mapping, NoReturn
import warnings
import traceback
import logging
@ -138,6 +138,9 @@ class PortList(metaclass=ABCMeta):
else:
return {k: self.ports[k] for k in key}
def __contains__(self, key: str) -> NoReturn:
raise NotImplementedError('PortsList.__contains__ is left unimplemented. Use `key in container.ports` instead.')
# NOTE: Didn't add keys(), items(), values(), __contains__(), etc.
# because it's weird on stuff like Pattern that contains other lists
# and because you can just grab .ports and use that instead

Loading…
Cancel
Save