Skip to content

Commit

Permalink
chore: remove unnecessary 'type-extensions' requirement (#2302)
Browse files Browse the repository at this point in the history
  • Loading branch information
danphenderson authored Feb 16, 2024
1 parent 5b4f8c7 commit 3da0d2b
Show file tree
Hide file tree
Showing 15 changed files with 14 additions and 82 deletions.
1 change: 0 additions & 1 deletion meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ requirements:
- python
- greenlet ==3.0.3
- pyee ==11.0.1
- typing_extensions # [py<39]
test:
requires:
- pip
Expand Down
8 changes: 1 addition & 7 deletions playwright/_impl/_api_structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import sys
from typing import Any, Dict, List, Optional, Sequence, Union

if sys.version_info >= (3, 8): # pragma: no cover
from typing import Literal, TypedDict
else: # pragma: no cover
from typing_extensions import Literal, TypedDict
from typing import Any, Dict, List, Literal, Optional, Sequence, TypedDict, Union

# These are the structures that we like keeping in a JSON form for their potential
# reuse between SDKs / services. They are public and are a part of the
Expand Down
7 changes: 1 addition & 6 deletions playwright/_impl/_browser_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

import asyncio
import json
import sys
from pathlib import Path
from types import SimpleNamespace
from typing import (
Expand All @@ -23,6 +22,7 @@
Callable,
Dict,
List,
Literal,
Optional,
Pattern,
Sequence,
Expand Down Expand Up @@ -77,11 +77,6 @@
if TYPE_CHECKING: # pragma: no cover
from playwright._impl._browser import Browser

if sys.version_info >= (3, 8): # pragma: no cover
from typing import Literal
else: # pragma: no cover
from typing_extensions import Literal


class BrowserContext(ChannelOwner):
Events = SimpleNamespace(
Expand Down
7 changes: 1 addition & 6 deletions playwright/_impl/_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
List,
Mapping,
Optional,
TypedDict,
Union,
cast,
)
Expand All @@ -46,12 +47,6 @@
from playwright._impl._playwright import Playwright


if sys.version_info >= (3, 8): # pragma: no cover
from typing import TypedDict
else: # pragma: no cover
from typing_extensions import TypedDict


class Channel(AsyncIOEventEmitter):
def __init__(self, connection: "Connection", object: "ChannelOwner") -> None:
super().__init__()
Expand Down
7 changes: 1 addition & 6 deletions playwright/_impl/_element_handle.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
# limitations under the License.

import base64
import sys
from pathlib import Path
from typing import (
TYPE_CHECKING,
Any,
Callable,
Dict,
List,
Literal,
Optional,
Sequence,
Union,
Expand All @@ -45,11 +45,6 @@
)
from playwright._impl._set_input_files_helpers import convert_input_files

if sys.version_info >= (3, 8): # pragma: no cover
from typing import Literal
else: # pragma: no cover
from typing_extensions import Literal

if TYPE_CHECKING: # pragma: no cover
from playwright._impl._frame import Frame
from playwright._impl._locator import Locator
Expand Down
7 changes: 1 addition & 6 deletions playwright/_impl/_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.

import asyncio
import sys
from pathlib import Path
from typing import (
TYPE_CHECKING,
Expand Down Expand Up @@ -43,6 +42,7 @@
DocumentLoadState,
FrameNavigatedEvent,
KeyboardModifier,
Literal,
MouseButton,
URLMatch,
URLMatcher,
Expand Down Expand Up @@ -72,11 +72,6 @@
from playwright._impl._set_input_files_helpers import convert_input_files
from playwright._impl._waiter import Waiter

if sys.version_info >= (3, 8): # pragma: no cover
from typing import Literal
else: # pragma: no cover
from typing_extensions import Literal

if TYPE_CHECKING: # pragma: no cover
from playwright._impl._page import Page

Expand Down
9 changes: 2 additions & 7 deletions playwright/_impl/_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import math
import os
import re
import sys
import time
import traceback
from pathlib import Path
Expand All @@ -26,9 +25,11 @@
Callable,
Dict,
List,
Literal,
Optional,
Pattern,
Set,
TypedDict,
TypeVar,
Union,
cast,
Expand All @@ -42,12 +43,6 @@
from playwright._impl._glob import glob_to_regex
from playwright._impl._str_utils import escape_regex_flags

if sys.version_info >= (3, 8): # pragma: no cover
from typing import Literal, TypedDict
else: # pragma: no cover
from typing_extensions import Literal, TypedDict


if TYPE_CHECKING: # pragma: no cover
from playwright._impl._api_structures import HeadersArray
from playwright._impl._network import Request, Response, Route
Expand Down
7 changes: 1 addition & 6 deletions playwright/_impl/_locator.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@

import json
import pathlib
import sys
from typing import (
TYPE_CHECKING,
Any,
Awaitable,
Callable,
Dict,
List,
Literal,
Optional,
Pattern,
Sequence,
Expand Down Expand Up @@ -53,11 +53,6 @@
escape_for_text_selector,
)

if sys.version_info >= (3, 8): # pragma: no cover
from typing import Literal
else: # pragma: no cover
from typing_extensions import Literal

if TYPE_CHECKING: # pragma: no cover
from playwright._impl._frame import Frame
from playwright._impl._js_handle import JSHandle
Expand Down
8 changes: 1 addition & 7 deletions playwright/_impl/_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import json
import json as json_utils
import mimetypes
import sys
from collections import defaultdict
from pathlib import Path
from types import SimpleNamespace
Expand All @@ -30,15 +29,10 @@
Dict,
List,
Optional,
TypedDict,
Union,
cast,
)

if sys.version_info >= (3, 8): # pragma: no cover
from typing import TypedDict
else: # pragma: no cover
from typing_extensions import TypedDict

from urllib import parse

from playwright._impl._api_structures import (
Expand Down
6 changes: 1 addition & 5 deletions playwright/_impl/_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
Callable,
Dict,
List,
Literal,
Optional,
Pattern,
Sequence,
Expand Down Expand Up @@ -88,11 +89,6 @@
from playwright._impl._video import Video
from playwright._impl._waiter import Waiter

if sys.version_info >= (3, 8): # pragma: no cover
from typing import Literal
else: # pragma: no cover
from typing_extensions import Literal

if TYPE_CHECKING: # pragma: no cover
from playwright._impl._browser_context import BrowserContext
from playwright._impl._fetch import APIRequestContext
Expand Down
8 changes: 1 addition & 7 deletions playwright/_impl/_set_input_files_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,8 @@
import base64
import collections.abc
import os
import sys
from pathlib import Path
from typing import TYPE_CHECKING, Dict, List, Optional, Sequence, Union, cast

if sys.version_info >= (3, 8): # pragma: no cover
from typing import TypedDict
else: # pragma: no cover
from typing_extensions import TypedDict
from typing import TYPE_CHECKING, Dict, List, Optional, Sequence, TypedDict, Union, cast

from playwright._impl._connection import Channel, from_channel
from playwright._impl._helper import Error
Expand Down
7 changes: 1 addition & 6 deletions playwright/async_api/_generated.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,8 @@


import pathlib
import sys
import typing

if sys.version_info >= (3, 8): # pragma: no cover
from typing import Literal
else: # pragma: no cover
from typing_extensions import Literal
from typing import Literal

from playwright._impl._accessibility import Accessibility as AccessibilityImpl
from playwright._impl._api_structures import (
Expand Down
7 changes: 1 addition & 6 deletions playwright/sync_api/_generated.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,8 @@


import pathlib
import sys
import typing

if sys.version_info >= (3, 8): # pragma: no cover
from typing import Literal
else: # pragma: no cover
from typing_extensions import Literal
from typing import Literal

from playwright._impl._accessibility import Accessibility as AccessibilityImpl
from playwright._impl._api_structures import (
Expand Down
6 changes: 1 addition & 5 deletions scripts/generate_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,9 @@ def return_value(value: Any) -> List[str]:
import typing
import sys
import pathlib
if sys.version_info >= (3, 8): # pragma: no cover
from typing import Literal
else: # pragma: no cover
from typing_extensions import Literal
from typing import Literal
from playwright._impl._accessibility import Accessibility as AccessibilityImpl
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ def _download_and_extract_local_driver(
install_requires=[
"greenlet==3.0.3",
"pyee==11.0.1",
"typing-extensions;python_version<='3.8'",
],
# TODO: Can be removed once we migrate to pypa/build or pypa/installer.
setup_requires=["setuptools-scm==8.0.4", "wheel==0.41.2"],
Expand Down

0 comments on commit 3da0d2b

Please sign in to comment.