|
6 | 6 | import json |
7 | 7 | from abc import abstractmethod |
8 | 8 | from time import time |
9 | | -from typing import Callable, Iterable, Optional, Protocol, Tuple |
| 9 | +from typing import Callable, Generator, Iterable, Optional, Protocol, Tuple |
10 | 10 | from urllib import parse |
11 | 11 |
|
12 | 12 | from ld_eventsource import SSEClient as SSEClientImpl |
13 | 13 | from ld_eventsource.actions import Action, Event, Fault |
14 | | -from ld_eventsource.config import ( |
15 | | - ConnectStrategy, |
16 | | - ErrorStrategy, |
17 | | - RetryDelayStrategy |
18 | | -) |
| 14 | +from ld_eventsource.config import ConnectStrategy, ErrorStrategy, RetryDelayStrategy |
19 | 15 | from ld_eventsource.errors import HTTPStatusError |
20 | 16 |
|
21 | 17 | from ldclient.config import Config |
|
29 | 25 | IntentCode, |
30 | 26 | PutObject, |
31 | 27 | Selector, |
32 | | - ServerIntent |
| 28 | + ServerIntent, |
33 | 29 | ) |
34 | 30 | from ldclient.impl.http import HTTPFactory, _http_factory |
35 | | -from ldclient.impl.util import ( |
36 | | - http_error_message, |
37 | | - is_http_error_recoverable, |
38 | | - log |
39 | | -) |
| 31 | +from ldclient.impl.util import http_error_message, is_http_error_recoverable, log |
40 | 32 | from ldclient.interfaces import ( |
41 | 33 | DataSourceErrorInfo, |
42 | 34 | DataSourceErrorKind, |
43 | | - DataSourceState |
| 35 | + DataSourceState, |
44 | 36 | ) |
45 | 37 |
|
46 | 38 | # allows for up to 5 minutes to elapse without any data sent across the stream. |
@@ -129,7 +121,7 @@ def __init__( |
129 | 121 | self._config = config |
130 | 122 | self._sse: Optional[SSEClient] = None |
131 | 123 |
|
132 | | - def sync(self) -> Iterable[Update]: |
| 124 | + def sync(self) -> Generator[Update, None, None]: |
133 | 125 | """ |
134 | 126 | sync should begin the synchronization process for the data source, yielding |
135 | 127 | Update objects until the connection is closed or an unrecoverable error |
|
0 commit comments