Skip to content

Commit afdccb1

Browse files
committed
fix: resolve all ruff linting errors and add Python 3.9 compatibility
1 parent 101262f commit afdccb1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+226
-303
lines changed

src/brightdata/api/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def _execute_sync(self, *args: Any, **kwargs: Any) -> Any:
4040
Wraps async method using asyncio.run() for sync compatibility.
4141
"""
4242
try:
43-
loop = asyncio.get_running_loop()
43+
asyncio.get_running_loop()
4444
raise RuntimeError(
4545
"Cannot call sync method from async context. Use async method instead."
4646
)

src/brightdata/api/search_service.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@
1212

1313
if TYPE_CHECKING:
1414
from ..client import BrightDataClient
15+
from .serp.google import GoogleSERPService
16+
from .serp.bing import BingSERPService
17+
from .serp.yandex import YandexSERPService
18+
from ..scrapers.amazon.search import AmazonSearchScraper
19+
from ..scrapers.linkedin.search import LinkedInSearchScraper
20+
from ..scrapers.chatgpt.search import ChatGPTSearchService
21+
from ..scrapers.instagram.search import InstagramSearchScraper
1522

1623

1724
class SearchService:

src/brightdata/api/serp/base.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,15 @@
33
import asyncio
44
import aiohttp
55
import json
6-
from typing import Union, List, Optional, Dict, Any
6+
from typing import Union, List, Optional
77
from datetime import datetime, timezone
88

99
from .url_builder import BaseURLBuilder
1010
from .data_normalizer import BaseDataNormalizer
1111
from ...core.engine import AsyncEngine
1212
from ...models import SearchResult
13-
from ...types import NormalizedSERPData
1413
from ...constants import HTTP_OK
15-
from ...exceptions import ValidationError, APIError
14+
from ...exceptions import ValidationError
1615
from ...utils.validation import validate_zone_name
1716
from ...utils.retry import retry_with_backoff
1817
from ...utils.function_detection import get_caller_function_name

src/brightdata/api/serp/data_normalizer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import warnings
44
from abc import ABC, abstractmethod
5-
from typing import Any, Dict, List
5+
from typing import Any
66
from ...types import NormalizedSERPData
77

88

src/brightdata/api/serp/url_builder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""URL builder for SERP search engines."""
22

33
from abc import ABC, abstractmethod
4-
from typing import Optional, Dict, Any
4+
from typing import Optional
55
from urllib.parse import quote_plus
66
from ...utils.location import LocationService, LocationFormat
77

src/brightdata/cli/banner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def _supports_color() -> bool:
2222
# Enable ANSI escape sequences on Windows
2323
kernel32.SetConsoleMode(kernel32.GetStdHandle(-11), 7)
2424
return True
25-
except:
25+
except Exception:
2626
return False
2727

2828
# Check for common environment variables

src/brightdata/cli/commands/scrape.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"""
44

55
import click
6-
from typing import Optional, List
6+
from typing import Optional
77

88
from ..utils import create_client, output_result, handle_error
99

src/brightdata/cli/commands/search.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"""
44

55
import click
6-
from typing import Optional, List
6+
from typing import Optional
77

88
from ..utils import create_client, output_result, handle_error
99

src/brightdata/cli/main.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
import click
88
import sys
9-
import io
109

1110
from .commands import scrape_group, search_group
1211
from .banner import print_banner

src/brightdata/cli/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import json
66
import sys
7-
from typing import Optional, Any, Dict
7+
from typing import Optional, Any
88
import click
99

1010
from ..client import BrightDataClient

0 commit comments

Comments
 (0)