Skip to content

Commit 6ab27de

Browse files
chore: lock file maintenance and fix new ty errors (#1115)
Co-authored-by: Vlada Dusek <v.dusek96@gmail.com>
1 parent bdc6769 commit 6ab27de

8 files changed

Lines changed: 1676 additions & 1628 deletions

File tree

‎src/apify_client/_resource_clients/dataset.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from apify_client._utils.http import response_to_dict, response_to_list
1313

1414
if TYPE_CHECKING:
15-
from collections.abc import AsyncIterator, Iterator
15+
from collections.abc import AsyncGenerator, AsyncIterator, Generator, Iterator
1616
from datetime import timedelta
1717

1818
from apify_client._literals import GeneralAccess
@@ -405,7 +405,7 @@ def stream_items(
405405
flatten: list[str] | None = None,
406406
signature: str | None = None,
407407
timeout: Timeout = 'long',
408-
) -> Iterator[HttpResponse]:
408+
) -> Generator[HttpResponse]:
409409
"""Retrieve the items in the dataset as a stream.
410410
411411
https://docs.apify.com/api/v2#/reference/datasets/item-collection/get-items
@@ -970,7 +970,7 @@ async def stream_items(
970970
flatten: list[str] | None = None,
971971
signature: str | None = None,
972972
timeout: Timeout = 'long',
973-
) -> AsyncIterator[HttpResponse]:
973+
) -> AsyncGenerator[HttpResponse]:
974974
"""Retrieve the items in the dataset as a stream.
975975
976976
https://docs.apify.com/api/v2#/reference/datasets/item-collection/get-items

‎src/apify_client/_resource_clients/key_value_store.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from apify_client.errors import ApifyApiError, InvalidResponseBodyError
2323

2424
if TYPE_CHECKING:
25-
from collections.abc import AsyncIterator, Iterator
25+
from collections.abc import AsyncGenerator, AsyncIterator, Generator, Iterator
2626
from datetime import timedelta
2727

2828
from apify_client._literals import GeneralAccess
@@ -318,7 +318,7 @@ def get_record_as_bytes(self, key: str, *, signature: str | None = None, timeout
318318
@contextmanager
319319
def stream_record(
320320
self, key: str, *, signature: str | None = None, timeout: Timeout = 'long'
321-
) -> Iterator[dict | None]:
321+
) -> Generator[dict | None]:
322322
"""Retrieve the given record from the key-value store, as a stream.
323323
324324
https://docs.apify.com/api/v2#/reference/key-value-stores/record/get-record
@@ -756,7 +756,7 @@ async def get_record_as_bytes(
756756
@asynccontextmanager
757757
async def stream_record(
758758
self, key: str, *, signature: str | None = None, timeout: Timeout = 'long'
759-
) -> AsyncIterator[dict | None]:
759+
) -> AsyncGenerator[dict | None]:
760760
"""Retrieve the given record from the key-value store, as a stream.
761761
762762
https://docs.apify.com/api/v2#/reference/key-value-stores/record/get-record

‎src/apify_client/_resource_clients/log.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from apify_client.errors import ApifyApiError
1010

1111
if TYPE_CHECKING:
12-
from collections.abc import AsyncIterator, Iterator
12+
from collections.abc import AsyncGenerator, Generator
1313

1414
from apify_client.http_clients import HttpResponse
1515
from apify_client.types import Timeout
@@ -96,7 +96,7 @@ def get_as_bytes(self, *, raw: bool = False, timeout: Timeout = 'long') -> bytes
9696
return None
9797

9898
@contextmanager
99-
def stream(self, *, raw: bool = False, timeout: Timeout = 'long') -> Iterator[HttpResponse | None]:
99+
def stream(self, *, raw: bool = False, timeout: Timeout = 'long') -> Generator[HttpResponse | None]:
100100
"""Retrieve the log as a stream.
101101
102102
https://docs.apify.com/api/v2#/reference/logs/log/get-log
@@ -211,7 +211,7 @@ async def get_as_bytes(self, *, raw: bool = False, timeout: Timeout = 'long') ->
211211
return None
212212

213213
@asynccontextmanager
214-
async def stream(self, *, raw: bool = False, timeout: Timeout = 'long') -> AsyncIterator[HttpResponse | None]:
214+
async def stream(self, *, raw: bool = False, timeout: Timeout = 'long') -> AsyncGenerator[HttpResponse | None]:
215215
"""Retrieve the log as a stream.
216216
217217
https://docs.apify.com/api/v2#/reference/logs/log/get-log

‎src/apify_client/_utils/try_import.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from typing import TYPE_CHECKING
88

99
if TYPE_CHECKING:
10-
from collections.abc import Iterator
10+
from collections.abc import Generator
1111
from typing import Any
1212

1313

@@ -19,7 +19,7 @@ class ImportState:
1919

2020

2121
@contextmanager
22-
def try_import(module_name: str, *symbol_names: str, dependency_name: str, extra_name: str) -> Iterator[ImportState]:
22+
def try_import(module_name: str, *symbol_names: str, dependency_name: str, extra_name: str) -> Generator[ImportState]:
2323
"""Context manager to attempt importing symbols into a module.
2424
2525
If the named optional dependency is missing, the symbols are replaced with `FailedImport` objects whose message

‎tests/unit/test_http_compressors.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from apify_client.http_compressors._resolve import resolve_compressor
1919

2020
if TYPE_CHECKING:
21-
from collections.abc import Callable, Iterator
21+
from collections.abc import Callable, Generator
2222

2323
from pytest_httpserver import HTTPServer
2424

@@ -29,7 +29,7 @@
2929

3030

3131
@contextmanager
32-
def _brotli_unavailable() -> Iterator[None]:
32+
def _brotli_unavailable() -> Generator[None]:
3333
"""Reimport the `http_compressors` package with the `brotli` import forced to fail.
3434
3535
Simulates an environment where the optional `brotli` extra is not installed, and restores the

‎tests/unit/test_logging.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from apify_client._streamed_log import StreamedLog, StreamedLogAsync, StreamedLogBase
2323

2424
if TYPE_CHECKING:
25-
from collections.abc import AsyncIterator, Callable, Iterator
25+
from collections.abc import AsyncGenerator, AsyncIterator, Callable, Iterator
2626

2727
from _pytest.logging import LogCaptureFixture
2828
from pytest_httpserver import HTTPServer
@@ -1557,7 +1557,7 @@ async def test_streamed_log_async_stop_reads_log_when_it_lands_while_stream_reop
15571557
reopening = asyncio.Event()
15581558

15591559
@asynccontextmanager
1560-
async def never_opening_stream() -> AsyncIterator[None]:
1560+
async def never_opening_stream() -> AsyncGenerator[None]:
15611561
reopening.set()
15621562
await asyncio.Event().wait()
15631563
yield

0 commit comments

Comments
 (0)