Skip to content

Commit 3da0d2b

Browse files
chore: remove unnecessary 'type-extensions' requirement (microsoft#2302)
1 parent 5b4f8c7 commit 3da0d2b

15 files changed

+14
-82
lines changed

meta.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ requirements:
2525
- python
2626
- greenlet ==3.0.3
2727
- pyee ==11.0.1
28-
- typing_extensions # [py<39]
2928
test:
3029
requires:
3130
- pip

playwright/_impl/_api_structures.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
import sys
16-
from typing import Any, Dict, List, Optional, Sequence, Union
17-
18-
if sys.version_info >= (3, 8): # pragma: no cover
19-
from typing import Literal, TypedDict
20-
else: # pragma: no cover
21-
from typing_extensions import Literal, TypedDict
15+
from typing import Any, Dict, List, Literal, Optional, Sequence, TypedDict, Union
2216

2317
# These are the structures that we like keeping in a JSON form for their potential
2418
# reuse between SDKs / services. They are public and are a part of the

playwright/_impl/_browser_context.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
import asyncio
1616
import json
17-
import sys
1817
from pathlib import Path
1918
from types import SimpleNamespace
2019
from typing import (
@@ -23,6 +22,7 @@
2322
Callable,
2423
Dict,
2524
List,
25+
Literal,
2626
Optional,
2727
Pattern,
2828
Sequence,
@@ -77,11 +77,6 @@
7777
if TYPE_CHECKING: # pragma: no cover
7878
from playwright._impl._browser import Browser
7979

80-
if sys.version_info >= (3, 8): # pragma: no cover
81-
from typing import Literal
82-
else: # pragma: no cover
83-
from typing_extensions import Literal
84-
8580

8681
class BrowserContext(ChannelOwner):
8782
Events = SimpleNamespace(

playwright/_impl/_connection.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
List,
2929
Mapping,
3030
Optional,
31+
TypedDict,
3132
Union,
3233
cast,
3334
)
@@ -46,12 +47,6 @@
4647
from playwright._impl._playwright import Playwright
4748

4849

49-
if sys.version_info >= (3, 8): # pragma: no cover
50-
from typing import TypedDict
51-
else: # pragma: no cover
52-
from typing_extensions import TypedDict
53-
54-
5550
class Channel(AsyncIOEventEmitter):
5651
def __init__(self, connection: "Connection", object: "ChannelOwner") -> None:
5752
super().__init__()

playwright/_impl/_element_handle.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
# limitations under the License.
1414

1515
import base64
16-
import sys
1716
from pathlib import Path
1817
from typing import (
1918
TYPE_CHECKING,
2019
Any,
2120
Callable,
2221
Dict,
2322
List,
23+
Literal,
2424
Optional,
2525
Sequence,
2626
Union,
@@ -45,11 +45,6 @@
4545
)
4646
from playwright._impl._set_input_files_helpers import convert_input_files
4747

48-
if sys.version_info >= (3, 8): # pragma: no cover
49-
from typing import Literal
50-
else: # pragma: no cover
51-
from typing_extensions import Literal
52-
5348
if TYPE_CHECKING: # pragma: no cover
5449
from playwright._impl._frame import Frame
5550
from playwright._impl._locator import Locator

playwright/_impl/_frame.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
# limitations under the License.
1414

1515
import asyncio
16-
import sys
1716
from pathlib import Path
1817
from typing import (
1918
TYPE_CHECKING,
@@ -43,6 +42,7 @@
4342
DocumentLoadState,
4443
FrameNavigatedEvent,
4544
KeyboardModifier,
45+
Literal,
4646
MouseButton,
4747
URLMatch,
4848
URLMatcher,
@@ -72,11 +72,6 @@
7272
from playwright._impl._set_input_files_helpers import convert_input_files
7373
from playwright._impl._waiter import Waiter
7474

75-
if sys.version_info >= (3, 8): # pragma: no cover
76-
from typing import Literal
77-
else: # pragma: no cover
78-
from typing_extensions import Literal
79-
8075
if TYPE_CHECKING: # pragma: no cover
8176
from playwright._impl._page import Page
8277

playwright/_impl/_helper.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import math
1616
import os
1717
import re
18-
import sys
1918
import time
2019
import traceback
2120
from pathlib import Path
@@ -26,9 +25,11 @@
2625
Callable,
2726
Dict,
2827
List,
28+
Literal,
2929
Optional,
3030
Pattern,
3131
Set,
32+
TypedDict,
3233
TypeVar,
3334
Union,
3435
cast,
@@ -42,12 +43,6 @@
4243
from playwright._impl._glob import glob_to_regex
4344
from playwright._impl._str_utils import escape_regex_flags
4445

45-
if sys.version_info >= (3, 8): # pragma: no cover
46-
from typing import Literal, TypedDict
47-
else: # pragma: no cover
48-
from typing_extensions import Literal, TypedDict
49-
50-
5146
if TYPE_CHECKING: # pragma: no cover
5247
from playwright._impl._api_structures import HeadersArray
5348
from playwright._impl._network import Request, Response, Route

playwright/_impl/_locator.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414

1515
import json
1616
import pathlib
17-
import sys
1817
from typing import (
1918
TYPE_CHECKING,
2019
Any,
2120
Awaitable,
2221
Callable,
2322
Dict,
2423
List,
24+
Literal,
2525
Optional,
2626
Pattern,
2727
Sequence,
@@ -53,11 +53,6 @@
5353
escape_for_text_selector,
5454
)
5555

56-
if sys.version_info >= (3, 8): # pragma: no cover
57-
from typing import Literal
58-
else: # pragma: no cover
59-
from typing_extensions import Literal
60-
6156
if TYPE_CHECKING: # pragma: no cover
6257
from playwright._impl._frame import Frame
6358
from playwright._impl._js_handle import JSHandle

playwright/_impl/_network.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import json
1919
import json as json_utils
2020
import mimetypes
21-
import sys
2221
from collections import defaultdict
2322
from pathlib import Path
2423
from types import SimpleNamespace
@@ -30,15 +29,10 @@
3029
Dict,
3130
List,
3231
Optional,
32+
TypedDict,
3333
Union,
3434
cast,
3535
)
36-
37-
if sys.version_info >= (3, 8): # pragma: no cover
38-
from typing import TypedDict
39-
else: # pragma: no cover
40-
from typing_extensions import TypedDict
41-
4236
from urllib import parse
4337

4438
from playwright._impl._api_structures import (

playwright/_impl/_page.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
Callable,
2626
Dict,
2727
List,
28+
Literal,
2829
Optional,
2930
Pattern,
3031
Sequence,
@@ -88,11 +89,6 @@
8889
from playwright._impl._video import Video
8990
from playwright._impl._waiter import Waiter
9091

91-
if sys.version_info >= (3, 8): # pragma: no cover
92-
from typing import Literal
93-
else: # pragma: no cover
94-
from typing_extensions import Literal
95-
9692
if TYPE_CHECKING: # pragma: no cover
9793
from playwright._impl._browser_context import BrowserContext
9894
from playwright._impl._fetch import APIRequestContext

0 commit comments

Comments
 (0)