Add NoReturn __contains__ with a more descriptive error message
This commit is contained in:
parent
f2e2de1d2e
commit
2d88c00cd7
@ -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…
Reference in New Issue
Block a user