Skip to content

Commit 44a29e8

Browse files
committed
quality: Fix lint with new ruff version
1 parent 2824e85 commit 44a29e8

File tree

5 files changed

+10
-8
lines changed

5 files changed

+10
-8
lines changed

src/scrape_it_now/helpers/resources.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from pathlib import Path
99

1010
import click
11-
from aiofiles import open
11+
from aiofiles import open # noqa: A004
1212
from aiofiles.os import makedirs, path, remove
1313

1414

src/scrape_it_now/helpers/trie.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def add(self, word: str) -> None:
2323
"""
2424
ref = self.data
2525
for char in word:
26-
ref[char] = char in ref and ref[char] or {}
26+
ref[char] = (char in ref and ref[char]) or {}
2727
ref = ref[char]
2828
ref[""] = 1
2929

src/scrape_it_now/persistence/local_disk.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from uuid import uuid4
1212

1313
import aiosqlite
14-
from aiofiles import open
14+
from aiofiles import open # noqa: A004
1515
from aiofiles.os import makedirs, path, remove, rmdir
1616
from pydantic import BaseModel, Field
1717

src/scrape_it_now/scrape.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
Error as PlaywrightError,
1818
Locator,
1919
Route,
20-
TimeoutError,
20+
TimeoutError as PlaywrightTimeoutError,
2121
ViewportSize,
2222
async_playwright,
2323
)
@@ -879,7 +879,9 @@ def _network_used_callback(size_bytes: int) -> None:
879879
)
880880
# Wait for 5 secs, to make sure the page is fully loaded
881881
await page.wait_for_timeout(5000)
882-
except TimeoutError: # TODO: Retry maybe a few times for timeout errors?
882+
except (
883+
PlaywrightTimeoutError
884+
): # TODO: Retry maybe a few times for timeout errors?
883885
return _generic_error(
884886
etag=previous_etag,
885887
message="Timeout while loading",
@@ -1062,7 +1064,7 @@ async def _extract_link(selector: Locator) -> str | None:
10621064
timeout=BROWSER_TIMEOUT_MS,
10631065
)
10641066
except (
1065-
TimeoutError
1067+
PlaywrightTimeoutError
10661068
): # TODO: Is those timeouts normal? They happen quite often
10671069
logger.debug("Timeout for selecting href attribute", exc_info=True)
10681070
return
@@ -1106,7 +1108,7 @@ async def _extract_meta(
11061108
element.get_attribute("name"),
11071109
element.get_attribute("content"),
11081110
)
1109-
except TimeoutError:
1111+
except PlaywrightTimeoutError:
11101112
logger.debug("Timeout for selecting meta tag attributes", exc_info=True)
11111113
return
11121114
if not name:

tests/scrape.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from zipfile import ZipFile
99

1010
import pytest
11-
from aiofiles import open
11+
from aiofiles import open # noqa: A004
1212
from aiofiles.os import remove, rmdir
1313
from isodate import UTC
1414
from playwright.async_api import Browser, ViewportSize

0 commit comments

Comments
 (0)