-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
Description
What was wrong?
When calling contract.events.Event()
, mypy warns that ContractEvent
is not callable.
How can it be fixed?
After digging a little deeper, it seems that these three annotations should probably be Type[ContractEvent]
instead:
Lines 246 to 263 in 92cf641
def __getattr__(self, event_name: str) -> "ContractEvent": | |
if '_events' not in self.__dict__: | |
raise NoABIEventsFound( | |
"The abi for this contract contains no event definitions. ", | |
"Are you sure you provided the correct contract abi?" | |
) | |
elif event_name not in self.__dict__['_events']: | |
raise ABIEventFunctionNotFound( | |
"The event '{}' was not found in this contract's abi. ".format(event_name), | |
"Are you sure you provided the correct contract abi?" | |
) | |
else: | |
return super().__getattribute__(event_name) | |
def __getitem__(self, event_name: str) -> "ContractEvent": | |
return getattr(self, event_name) | |
def __iter__(self) -> Iterable["ContractEvent"]: |