Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/crawlee/crawlers/_adaptive_playwright/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def sklearn_model_validator(v: LogisticRegression | dict[str, Any]) -> LogisticR
def sklearn_model_serializer(model: LogisticRegression) -> dict[str, Any]:
if hasattr(model, 'coef_'):
return {
'coef': model.coef_.tolist(),
'coef': np.asarray(model.coef_).tolist(),
'intercept': model.intercept_.tolist(),
'classes': model.classes_.tolist(),
'n_iter': model.n_iter_.tolist() if hasattr(model, 'n_iter_') else [1000],
Expand Down
3 changes: 1 addition & 2 deletions src/crawlee/crawlers/_playwright/_playwright_crawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,8 +512,7 @@ async def _get_cookies(self, page: Page) -> list[PlaywrightCookieParam]:

async def _update_cookies(self, page: Page, cookies: list[PlaywrightCookieParam]) -> None:
"""Update the cookies in the page context."""
# False positive ty error, see https://github.com/astral-sh/ty/issues/1493.
await page.context.add_cookies([{**cookie} for cookie in cookies]) # ty: ignore[invalid-argument-type]
await page.context.add_cookies([{**cookie} for cookie in cookies])

async def _find_txt_file_for_url(self, url: str) -> RobotsTxtFile:
"""Find the robots.txt file for a given URL.
Expand Down
2 changes: 2 additions & 0 deletions src/crawlee/storage_clients/_redis/_key_value_store_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ async def iterate_keys(
# Yield metadata for each key
for key in keys:
record = items_data[key]
if not isinstance(record, (str, bytes)):
raise TypeError(f'Expected str or bytes, got {type(record)}')
yield KeyValueStoreRecordMetadata.model_validate_json(record)

async with self._get_pipeline() as pipe:
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/storage_clients/_redis/test_redis_rq_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ async def test_request_records_persistence(rq_client: RedisRequestQueueClient) -
assert request_queue_response is not None
assert isinstance(request_queue_response, list)
request_keys = request_queue_response[1]

assert isinstance(request_keys, list)
assert len(request_keys) == 3

# Verify actual request file content
Expand All @@ -90,7 +90,7 @@ async def test_request_records_persistence(rq_client: RedisRequestQueueClient) -
assert isinstance(requests_records_data, dict)

for key in request_keys:
request_data = json.loads(requests_records_data[key])
request_data = json.loads(requests_records_data[key]) # ty: ignore[invalid-argument-type]
assert 'url' in request_data
assert request_data['url'].startswith('https://example.com/')

Expand Down
40 changes: 20 additions & 20 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading