Skip to content

Commit 894b4c4

Browse files
chore(internal): bump pyright (#83)
1 parent cc67c77 commit 894b4c4

File tree

11 files changed

+22
-49
lines changed

11 files changed

+22
-49
lines changed

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ session = client.sessions.create(
4141
)
4242
print(session.id)
4343

44+
4445
def run(playwright: Playwright) -> None:
4546
# Connect to the remote session
4647
chromium = playwright.chromium
@@ -51,9 +52,7 @@ def run(playwright: Playwright) -> None:
5152
# Execute Playwright actions on the remote browser tab
5253
page.goto("https://news.ycombinator.com/")
5354
page_title = page.title()
54-
assert (
55-
page_title == "Hacker News"
56-
), f"Page title is not 'Hacker News', it is '{page_title}'"
55+
assert page_title == "Hacker News", f"Page title is not 'Hacker News', it is '{page_title}'"
5756
page.screenshot(path="screenshot.png")
5857

5958
page.close()

examples/e2e/test_playwright.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ def playwright() -> Generator[Playwright, None, None]:
2929
with sync_playwright() as p:
3030
yield p
3131

32+
3233
def test_playwright_basic(playwright: Playwright) -> None:
3334
playwright_basic.run(playwright)
3435

examples/playwright_basic.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ def run(playwright: Playwright) -> None:
1919
# Execute Playwright actions on the remote browser tab
2020
page.goto("https://news.ycombinator.com/")
2121
page_title = page.title()
22-
assert (
23-
page_title == "Hacker News"
24-
), f"Page title is not 'Hacker News', it is '{page_title}'"
22+
assert page_title == "Hacker News", f"Page title is not 'Hacker News', it is '{page_title}'"
2523
page.screenshot(path="screenshot.png")
2624

2725
page.close()

examples/playwright_captcha.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ def handle_console(msg: ConsoleMessage) -> None:
3434
page.on("console", handle_console)
3535

3636
page.goto(DEFAULT_CAPTCHA_URL, wait_until="networkidle")
37-
page.wait_for_function(
38-
"() => window.captchaSolvingFinished === true", timeout=OVERRIDE_TIMEOUT
39-
)
37+
page.wait_for_function("() => window.captchaSolvingFinished === true", timeout=OVERRIDE_TIMEOUT)
4038

4139
assert captcha_solving_started, "Captcha solving did not start"
4240
assert captcha_solving_finished, "Captcha solving did not finish"

examples/playwright_contexts.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,11 @@ def run(playwright: Playwright) -> None:
4141
# Step 2: Creates a session with the context
4242
session = bb.sessions.create(
4343
project_id=BROWSERBASE_PROJECT_ID,
44-
browser_settings=TypeAdapter(BrowserSettings).validate_python(
45-
{"context": {"id": context_id, "persist": True}}
46-
),
44+
browser_settings=TypeAdapter(BrowserSettings).validate_python({"context": {"id": context_id, "persist": True}}),
4745
)
4846
print(session)
4947

50-
assert (
51-
session.context_id == context_id
52-
), f"Session context_id is {session.context_id}, expected {context_id}"
48+
assert session.context_id == context_id, f"Session context_id is {session.context_id}, expected {context_id}"
5349
session_id = session.id
5450

5551
# Step 3: Populates and persists the context
@@ -90,13 +86,9 @@ def run(playwright: Playwright) -> None:
9086
# Step 4: Creates another session with the same context
9187
session = bb.sessions.create(
9288
project_id=BROWSERBASE_PROJECT_ID,
93-
browser_settings=BrowserSettings(
94-
context=BrowserSettingsContext(id=context_id, persist=True)
95-
),
89+
browser_settings=BrowserSettings(context=BrowserSettingsContext(id=context_id, persist=True)),
9690
)
97-
assert (
98-
session.context_id == context_id
99-
), f"Session context_id is {session.context_id}, expected {context_id}"
91+
assert session.context_id == context_id, f"Session context_id is {session.context_id}, expected {context_id}"
10092
session_id = session.id
10193

10294
# Step 5: Uses context to find previous state

examples/playwright_extensions.py

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@
1212
)
1313
from browserbase.types import Extension, SessionCreateResponse
1414

15-
PATH_TO_EXTENSION = (
16-
Path.cwd() / "examples" / "packages" / "extensions" / "browserbase-test"
17-
)
15+
PATH_TO_EXTENSION = Path.cwd() / "examples" / "packages" / "extensions" / "browserbase-test"
1816

1917

2018
def zip_extension(path: Path = PATH_TO_EXTENSION, save_local: bool = False) -> BytesIO:
@@ -23,9 +21,7 @@ def zip_extension(path: Path = PATH_TO_EXTENSION, save_local: bool = False) -> B
2321
Mark save_local=True to save the zip file to a local file.
2422
"""
2523
# Ensure we're looking at an extension
26-
assert "manifest.json" in os.listdir(
27-
path
28-
), "No manifest.json found in the extension folder."
24+
assert "manifest.json" in os.listdir(path), "No manifest.json found in the extension folder."
2925

3026
# Create a BytesIO object to hold the zip file in memory
3127
memory_zip = BytesIO()
@@ -51,9 +47,7 @@ def zip_extension(path: Path = PATH_TO_EXTENSION, save_local: bool = False) -> B
5147

5248
def create_extension() -> str:
5349
zip_data = zip_extension(save_local=True)
54-
extension: Extension = bb.extensions.create(
55-
file=("extension.zip", zip_data.getvalue())
56-
)
50+
extension: Extension = bb.extensions.create(file=("extension.zip", zip_data.getvalue()))
5751
return extension.id
5852

5953

@@ -75,9 +69,7 @@ def check_for_message(page: Page, message: str) -> None:
7569
while time.time() - start < 10:
7670
if message in console_messages:
7771
break
78-
assert (
79-
message in console_messages
80-
), f"Expected message not found in console logs. Messages: {console_messages}"
72+
assert message in console_messages, f"Expected message not found in console logs. Messages: {console_messages}"
8173

8274

8375
def run(playwright: Playwright) -> None:
@@ -141,9 +133,7 @@ def run(playwright: Playwright) -> None:
141133
project_id=BROWSERBASE_PROJECT_ID,
142134
extension_id=extension_id,
143135
)
144-
raise AssertionError(
145-
"Expected to fail when creating session with deleted extension"
146-
)
136+
raise AssertionError("Expected to fail when creating session with deleted extension")
147137
except Exception as e:
148138
print(f"Failed to create session with deleted extension as expected: {str(e)}")
149139

examples/playwright_proxy.py

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

1212

1313
def check_proxy_bytes(session_id: str) -> None:
14-
bb.sessions.update(
15-
id=session_id, project_id=BROWSERBASE_PROJECT_ID, status="REQUEST_RELEASE"
16-
)
14+
bb.sessions.update(id=session_id, project_id=BROWSERBASE_PROJECT_ID, status="REQUEST_RELEASE")
1715
time.sleep(GRACEFUL_SHUTDOWN_TIMEOUT / 1000)
1816
updated_session = bb.sessions.retrieve(id=session_id)
1917
assert (

examples/playwright_upload.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,8 @@ def run(playwright: Playwright) -> None:
3333
file_size = int(file_size_span.inner_text())
3434

3535
# Assert the file name and size
36-
assert (
37-
file_name == "logo.png"
38-
), f"Expected file name to be 'logo.png', but got '{file_name}'"
39-
assert (
40-
file_size > 0
41-
), f"Expected file size to be greater than 0, but got {file_size}"
36+
assert file_name == "logo.png", f"Expected file name to be 'logo.png', but got '{file_name}'"
37+
assert file_size > 0, f"Expected file size to be greater than 0, but got {file_size}"
4238

4339
print("File upload test passed successfully!")
4440

examples/selenium_basic.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ def run() -> None:
3434
session = bb.sessions.create(project_id=BROWSERBASE_PROJECT_ID)
3535
connection = BrowserbaseConnection(session.id, session.selenium_remote_url)
3636
driver = webdriver.Remote(
37-
command_executor=connection, options=webdriver.ChromeOptions() # type: ignore
37+
command_executor=connection,
38+
options=webdriver.ChromeOptions(), # type: ignore
3839
)
3940

4041
# Print a bit of info about the browser we've connected to

requirements-dev.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# last locked with the following flags:
55
# pre: false
66
# features: []
7-
# all-features: false
7+
# all-features: true
88
# with-sources: false
99
# generate-hashes: false
1010
# universal: false
@@ -89,7 +89,7 @@ pyee==12.0.0
8989
# via playwright
9090
pygments==2.18.0
9191
# via rich
92-
pyright==1.1.386
92+
pyright==1.1.390
9393
pysocks==1.7.1
9494
# via urllib3
9595
pytest==8.3.3

src/browserbase/resources/sessions/sessions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -715,4 +715,4 @@ def recording(self) -> AsyncRecordingResourceWithStreamingResponse:
715715

716716
@cached_property
717717
def uploads(self) -> AsyncUploadsResourceWithStreamingResponse:
718-
return AsyncUploadsResourceWithStreamingResponse(self._sessions.uploads)
718+
return AsyncUploadsResourceWithStreamingResponse(self._sessions.uploads)

0 commit comments

Comments
 (0)