import warnings
import threading
from types import TracebackType
-from typing import Any, Callable, cast, Dict, Generic, Iterator, List
-from typing import NamedTuple, Optional, Type, TypeVar, Union
+from typing import Any, Callable, cast, Dict, Generator, Generic, Iterator
+from typing import List, NamedTuple, Optional, Type, TypeVar, Union
from typing import overload, TYPE_CHECKING
from weakref import ref, ReferenceType
from functools import partial
with Transaction(self, savepoint_name, force_rollback) as tx:
yield tx
- def notifies(self) -> Iterator[Notify]:
+ def notifies(self) -> Generator[Notify, None, None]:
"""
Yield `Notify` objects as soon as they are received from the database.
"""
import asyncio
import logging
from types import TracebackType
-from typing import Any, AsyncIterator, Dict, Optional, Type, Union
-from typing import cast, overload, TYPE_CHECKING
+from typing import Any, AsyncGenerator, AsyncIterator, Dict, Optional
+from typing import Type, Union, cast, overload, TYPE_CHECKING
from . import errors as e
from . import waiting
async with tx:
yield tx
- async def notifies(self) -> AsyncIterator[Notify]:
+ async def notifies(self) -> AsyncGenerator[Notify, None]:
while 1:
async with self.lock:
ns = await self.wait(notifies(self.pgconn))