Skip to content

Commit 87fd4b5

Browse files
authored
chore: rename private modules to _ (#366)
1 parent a95c871 commit 87fd4b5

Some content is hidden

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

49 files changed

+304
-282
lines changed

playwright/__init__.py

Lines changed: 50 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,27 @@
1919
and for the async API [here](async_api.html).
2020
"""
2121

22-
import playwright.types as types
23-
from playwright.main import AsyncPlaywrightContextManager, SyncPlaywrightContextManager
22+
import playwright._types as types
23+
from playwright._main import AsyncPlaywrightContextManager, SyncPlaywrightContextManager
2424

25+
ConsoleMessageLocation = types.ConsoleMessageLocation
26+
Cookie = types.Cookie
27+
Credentials = types.Credentials
28+
DeviceDescriptor = types.DeviceDescriptor
2529
Error = types.Error
30+
FilePayload = types.FilePayload
31+
FloatRect = types.FloatRect
32+
Geolocation = types.Geolocation
33+
IntSize = types.IntSize
34+
MousePosition = types.MousePosition
35+
PdfMargins = types.PdfMargins
36+
ProxyServer = types.ProxyServer
37+
RecordHarOptions = types.RecordHarOptions
38+
RecordVideoOptions = types.RecordVideoOptions
39+
RequestFailure = types.RequestFailure
40+
ResourceTiming = types.ResourceTiming
41+
SelectOption = types.SelectOption
42+
StorageState = types.StorageState
2643
TimeoutError = types.TimeoutError
2744

2845

@@ -42,35 +59,35 @@ def sync_playwright() -> SyncPlaywrightContextManager:
4259
]
4360

4461
__pdoc__ = {
45-
"accessibility": False,
46-
"async_base": False,
47-
"browser": False,
48-
"browser_context": False,
49-
"browser_type": False,
50-
"cdp_session": False,
51-
"chromium_browser_context": False,
52-
"connection": False,
53-
"console_message": False,
54-
"dialog": False,
55-
"download": False,
56-
"element_handle": False,
57-
"event_context_manager": False,
58-
"file_chooser": False,
59-
"frame": False,
60-
"helper": False,
61-
"impl_to_api_mapping": False,
62-
"input": False,
63-
"js_handle": False,
64-
"main": False,
65-
"network": False,
66-
"object_factory": False,
67-
"page": False,
68-
"path_utils": False,
69-
"playwright": False,
70-
"selectors": False,
71-
"sync_base": False,
72-
"transport": False,
73-
"wait_helper": False,
74-
"async_playwright": False,
75-
"sync_playwright": False,
62+
"_accessibility": False,
63+
"_async_base": False,
64+
"_browser": False,
65+
"_browser_context": False,
66+
"_browser_type": False,
67+
"_cdp_session": False,
68+
"_chromium_browser_context": False,
69+
"_connection": False,
70+
"_console_message": False,
71+
"_dialog": False,
72+
"_download": False,
73+
"_element_handle": False,
74+
"_event_context_manager": False,
75+
"_file_chooser": False,
76+
"_frame": False,
77+
"_helper": False,
78+
"_impl_to_api_mapping": False,
79+
"_input": False,
80+
"_js_handle": False,
81+
"_main": False,
82+
"_network": False,
83+
"_object_factory": False,
84+
"_page": False,
85+
"_path_utils": False,
86+
"_playwright": False,
87+
"_selectors": False,
88+
"_sync_base": False,
89+
"_transport": False,
90+
"_wait_helper": False,
91+
"_async_playwright": False,
92+
"_sync_playwright": False,
7693
}

playwright/__main__.py

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

15-
from playwright.main import main
15+
from playwright._main import main
1616

1717
main()

playwright/accessibility.py renamed to playwright/_accessibility.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414

1515
from typing import Dict, Optional
1616

17-
from playwright.connection import Channel
18-
from playwright.element_handle import ElementHandle
19-
from playwright.helper import locals_to_params
17+
from playwright._connection import Channel
18+
from playwright._element_handle import ElementHandle
19+
from playwright._helper import locals_to_params
2020

2121

2222
def _ax_node_from_protocol(axNode: Dict) -> Dict:

playwright/async_base.py renamed to playwright/_async_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import asyncio
1616
from typing import Any, Callable, Coroutine, Generic, Optional, TypeVar, cast
1717

18-
from playwright.impl_to_api_mapping import ImplToApiMapping, ImplWrapper
18+
from playwright._impl_to_api_mapping import ImplToApiMapping, ImplWrapper
1919

2020
mapping = ImplToApiMapping()
2121

playwright/browser.py renamed to playwright/_browser.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
from types import SimpleNamespace
1717
from typing import TYPE_CHECKING, Dict, List, Union
1818

19-
from playwright.browser_context import BrowserContext
20-
from playwright.connection import ChannelOwner, from_channel
21-
from playwright.helper import ColorScheme, is_safe_close_error, locals_to_params
22-
from playwright.network import serialize_headers
23-
from playwright.page import Page
24-
from playwright.types import (
19+
from playwright._browser_context import BrowserContext
20+
from playwright._connection import ChannelOwner, from_channel
21+
from playwright._helper import ColorScheme, is_safe_close_error, locals_to_params
22+
from playwright._network import serialize_headers
23+
from playwright._page import Page
24+
from playwright._types import (
2525
Credentials,
2626
Geolocation,
2727
IntSize,
@@ -37,7 +37,7 @@
3737
from typing_extensions import Literal
3838

3939
if TYPE_CHECKING: # pragma: no cover
40-
from playwright.browser_type import BrowserType
40+
from playwright._browser_type import BrowserType
4141

4242

4343
class Browser(ChannelOwner):

playwright/browser_context.py renamed to playwright/_browser_context.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
from types import SimpleNamespace
1818
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Union
1919

20-
from playwright.connection import ChannelOwner, from_channel
21-
from playwright.event_context_manager import EventContextManagerImpl
22-
from playwright.helper import (
20+
from playwright._connection import ChannelOwner, from_channel
21+
from playwright._event_context_manager import EventContextManagerImpl
22+
from playwright._helper import (
2323
PendingWaitEvent,
2424
RouteHandler,
2525
RouteHandlerEntry,
@@ -29,13 +29,13 @@
2929
is_safe_close_error,
3030
locals_to_params,
3131
)
32-
from playwright.network import Request, Route, serialize_headers
33-
from playwright.page import BindingCall, Page
34-
from playwright.types import Cookie, Error, Geolocation, StorageState
35-
from playwright.wait_helper import WaitHelper
32+
from playwright._network import Request, Route, serialize_headers
33+
from playwright._page import BindingCall, Page
34+
from playwright._types import Cookie, Error, Geolocation, StorageState
35+
from playwright._wait_helper import WaitHelper
3636

3737
if TYPE_CHECKING: # pragma: no cover
38-
from playwright.browser import Browser
38+
from playwright._browser import Browser
3939

4040

4141
class BrowserContext(ChannelOwner):

playwright/browser_type.py renamed to playwright/_browser_type.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
from pathlib import Path
1717
from typing import Dict, List, Union
1818

19-
from playwright.browser import Browser
20-
from playwright.browser_context import BrowserContext
21-
from playwright.connection import ChannelOwner, from_channel
22-
from playwright.helper import ColorScheme, Env, locals_to_params, not_installed_error
23-
from playwright.network import serialize_headers
24-
from playwright.types import (
19+
from playwright._browser import Browser
20+
from playwright._browser_context import BrowserContext
21+
from playwright._connection import ChannelOwner, from_channel
22+
from playwright._helper import ColorScheme, Env, locals_to_params, not_installed_error
23+
from playwright._network import serialize_headers
24+
from playwright._types import (
2525
Credentials,
2626
Geolocation,
2727
IntSize,

playwright/cdp_session.py renamed to playwright/_cdp_session.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414

1515
from typing import Any, Dict
1616

17-
from playwright.connection import ChannelOwner
18-
from playwright.helper import locals_to_params
19-
from playwright.js_handle import parse_result
17+
from playwright._connection import ChannelOwner
18+
from playwright._helper import locals_to_params
19+
from playwright._js_handle import parse_result
2020

2121

2222
class CDPSession(ChannelOwner):

playwright/chromium_browser_context.py renamed to playwright/_chromium_browser_context.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
from types import SimpleNamespace
1616
from typing import Dict, List, Set
1717

18-
from playwright.browser_context import BrowserContext
19-
from playwright.cdp_session import CDPSession
20-
from playwright.connection import ChannelOwner, from_channel
21-
from playwright.page import Page, Worker
18+
from playwright._browser_context import BrowserContext
19+
from playwright._cdp_session import CDPSession
20+
from playwright._connection import ChannelOwner, from_channel
21+
from playwright._page import Page, Worker
2222

2323

2424
class ChromiumBrowserContext(BrowserContext):

playwright/connection.py renamed to playwright/_connection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
from greenlet import greenlet
2222
from pyee import AsyncIOEventEmitter
2323

24-
from playwright.helper import ParsedMessagePayload, parse_error
25-
from playwright.transport import Transport
24+
from playwright._helper import ParsedMessagePayload, parse_error
25+
from playwright._transport import Transport
2626

2727

2828
class Channel(AsyncIOEventEmitter):

0 commit comments

Comments
 (0)