Skip to content

Commit 4ff2412

Browse files
Mantisusvdusek
authored andcommitted
chore: Use typing instead of typing_extensions for types added in Python 3.11 (#2316)
### Description - Use `typing` instead of `typing_extensions` for types added in Python 3.11. ### Issues - Follow-up: #2295
1 parent ac1a3c9 commit 4ff2412

22 files changed

Lines changed: 28 additions & 51 deletions

‎docs/guides/code_examples/http_crawlers/selectolax_crawler.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111

1212
if TYPE_CHECKING:
1313
from collections.abc import AsyncGenerator
14-
15-
from typing_extensions import Unpack
14+
from typing import Unpack
1615

1716
from crawlee.crawlers._abstract_http import ParsedHttpCrawlingContext
1817

‎src/crawlee/_types.py‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515
import re
1616
from collections.abc import Awaitable, Coroutine, MutableMapping, Sequence
1717
from datetime import timedelta
18-
from typing import NotRequired, Required, Self
19-
20-
from typing_extensions import Unpack
18+
from typing import NotRequired, Required, Self, Unpack
2119

2220
from crawlee import Glob, Request
2321
from crawlee._request import RequestOptions

‎src/crawlee/_utils/file.py‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@
1212

1313
if TYPE_CHECKING:
1414
from collections.abc import AsyncIterator, Mapping
15-
from typing import Any, TextIO
16-
17-
from typing_extensions import Unpack
15+
from typing import Any, TextIO, Unpack
1816

1917
from crawlee._types import ExportDataCsvKwargs, ExportDataJsonKwargs, JsonSerializable
2018

‎src/crawlee/_utils/html.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@
1717

1818
if TYPE_CHECKING:
1919
from collections.abc import Mapping, Sequence
20-
from typing import NotRequired
20+
from typing import NotRequired, Unpack
2121

2222
from lxml.html import HtmlElement
23-
from typing_extensions import Unpack
2423

2524
from crawlee._types import JsonSerializable
2625

‎src/crawlee/browsers/_stagehand_types.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
from crawlee._utils.docs import docs_group
99

1010
if TYPE_CHECKING:
11+
from typing import Unpack
12+
1113
from stagehand import AsyncSession
1214
from stagehand.types.session_act_params import SessionActParamsNonStreaming
1315
from stagehand.types.session_act_response import SessionActResponse
@@ -17,7 +19,6 @@
1719
from stagehand.types.session_extract_response import SessionExtractResponse
1820
from stagehand.types.session_observe_params import SessionObserveParamsNonStreaming
1921
from stagehand.types.session_observe_response import SessionObserveResponse
20-
from typing_extensions import Unpack
2122

2223

2324
@dataclass

‎src/crawlee/crawlers/_abstract_http/_abstract_http_crawler.py‎

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

2323
if TYPE_CHECKING:
2424
from collections.abc import AsyncGenerator, Awaitable, Callable, Iterator, Mapping
25-
26-
from typing_extensions import Unpack
25+
from typing import Unpack
2726

2827
from crawlee import RequestTransformAction
2928
from crawlee._types import BasicCrawlingContext, EnqueueLinksKwargs, ExtractLinksFunction, JsonSerializable

‎src/crawlee/crawlers/_abstract_http/_http_crawling_context.py‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
from __future__ import annotations
22

33
from dataclasses import dataclass, fields
4-
from typing import Generic, Self
5-
6-
from typing_extensions import TypeVar
4+
from typing import Generic, Self, TypeVar
75

86
from crawlee._types import BasicCrawlingContext, EnqueueLinksFunction, ExtractLinksFunction, PageSnapshot
97
from crawlee._utils.docs import docs_group

‎src/crawlee/crawlers/_adaptive_playwright/_adaptive_playwright_crawler.py‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
from dataclasses import dataclass
77
from logging import getLogger
88
from random import random
9-
from typing import TYPE_CHECKING, Any, Generic, Self, get_args
9+
from typing import TYPE_CHECKING, Any, Generic, Self, TypeVar, get_args
1010

1111
from bs4 import BeautifulSoup, Tag
1212
from parsel import Selector
13-
from typing_extensions import TypeVar, override
13+
from typing_extensions import override
1414

1515
from crawlee._types import BasicCrawlingContext, ConcurrencySettings, JsonSerializable, RequestHandlerRunResult
1616
from crawlee._utils.docs import docs_group
@@ -45,8 +45,7 @@
4545
if TYPE_CHECKING:
4646
from collections.abc import MutableMapping
4747
from types import TracebackType
48-
49-
from typing_extensions import Unpack
48+
from typing import Unpack
5049

5150
from crawlee.crawlers._basic._basic_crawler import _BasicCrawlerOptions
5251

‎src/crawlee/crawlers/_basic/_basic_crawler.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
from http import HTTPStatus
1818
from io import StringIO
1919
from pathlib import Path
20-
from typing import TYPE_CHECKING, Any, Generic, Literal, NotRequired, ParamSpec, cast
20+
from typing import TYPE_CHECKING, Any, Generic, Literal, NotRequired, ParamSpec, TypedDict, Unpack, cast
2121
from weakref import WeakKeyDictionary
2222

2323
from cachetools import LRUCache
24-
from typing_extensions import TypedDict, TypeVar, Unpack
24+
from typing_extensions import TypeVar
2525
from yarl import URL
2626

2727
from crawlee import Glob, RequestTransformAction, service_locator

‎src/crawlee/crawlers/_beautifulsoup/_beautifulsoup_crawler.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212

1313
if TYPE_CHECKING:
1414
from collections.abc import AsyncGenerator
15-
16-
from typing_extensions import Unpack
15+
from typing import Unpack
1716

1817
from crawlee.crawlers._abstract_http import ParsedHttpCrawlingContext
1918

0 commit comments

Comments
 (0)