Skip to content

Commit 97b88d9

Browse files
committed
lint fix
1 parent ad77fe6 commit 97b88d9

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

examples/full_example.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def main() -> None:
7676
# Pass the action to Act
7777
act_response = client.sessions.act(
7878
id=session_id,
79-
input=result,
79+
input=result, # type: ignore[arg-type]
8080
x_language="typescript",
8181
x_sdk_version=SDK_VERSION,
8282
)
@@ -110,13 +110,13 @@ def main() -> None:
110110
print(f"Extracted data: {extracted_result}")
111111

112112
# Get the author from the extracted data
113-
author = extracted_result.get("author", "unknown") if isinstance(extracted_result, dict) else "unknown"
113+
author: str = extracted_result.get("author", "unknown") if isinstance(extracted_result, dict) else "unknown" # type: ignore[union-attr]
114114
print(f"Looking up profile for author: {author}")
115115

116116
# Use the Agent to find the author's profile
117117
# Execute runs an autonomous agent that can navigate and interact with pages
118118
# Use a longer timeout (5 minutes) since agent execution can take a while
119-
execute_response = client.sessions.execute(
119+
execute_response = client.sessions.execute( # pyright: ignore[reportArgumentType]
120120
id=session_id,
121121
execute_options={
122122
"instruction": (

pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@ exclude = [
140140
".nox",
141141
".git",
142142
"hatch_build.py",
143+
"examples",
144+
"scripts",
145+
"test_local_mode.py",
143146
]
144147

145148
reportImplicitOverride = true
@@ -158,7 +161,7 @@ show_error_codes = true
158161
#
159162
# We also exclude our `tests` as mypy doesn't always infer
160163
# types correctly and Pyright will still catch any type errors.
161-
exclude = ['src/stagehand/_files.py', '_dev/.*.py', 'tests/.*', 'hatch_build.py']
164+
exclude = ['src/stagehand/_files.py', '_dev/.*.py', 'tests/.*', 'hatch_build.py', 'examples/.*', 'scripts/.*', 'test_local_mode.py']
162165

163166
strict_equality = true
164167
implicit_reexport = true

scripts/download-binary.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import sys
1818
import argparse
1919
import platform
20+
import urllib.error
2021
import urllib.request
2122
from pathlib import Path
2223

@@ -79,15 +80,15 @@ def download_binary(version: str) -> None:
7980

8081
try:
8182
# Download with progress
82-
def reporthook(block_num, block_size, total_size):
83+
def reporthook(block_num: int, block_size: int, total_size: int) -> None:
8384
downloaded = block_num * block_size
8485
if total_size > 0:
8586
percent = min(downloaded * 100 / total_size, 100)
8687
mb_downloaded = downloaded / (1024 * 1024)
8788
mb_total = total_size / (1024 * 1024)
8889
print(f"\r Progress: {percent:.1f}% ({mb_downloaded:.1f}/{mb_total:.1f} MB)", end="")
8990

90-
urllib.request.urlretrieve(url, dest_path, reporthook)
91+
urllib.request.urlretrieve(url, dest_path, reporthook) # type: ignore[arg-type]
9192
print() # New line after progress
9293

9394
# Make executable on Unix
@@ -99,8 +100,8 @@ def reporthook(block_num, block_size, total_size):
99100
print(f"✅ Downloaded successfully: {dest_path} ({size_mb:.1f} MB)")
100101
print(f"\n💡 You can now run: uv run python test_local_mode.py")
101102

102-
except urllib.error.HTTPError as e:
103-
print(f"\n❌ Error: Failed to download binary (HTTP {e.code})")
103+
except urllib.error.HTTPError as e: # type: ignore[misc]
104+
print(f"\n❌ Error: Failed to download binary (HTTP {e.code})") # type: ignore[union-attr]
104105
print(f" URL: {url}")
105106
print(f"\n Available releases at: https://github.com/{repo}/releases")
106107
sys.exit(1)

test_local_mode.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
print("🔧 Starting session (this will start the local server)...") # noqa: T201
3434
session = client.sessions.start(
3535
model_name="openai/gpt-5-nano",
36-
browser={
36+
browser={ # type: ignore[arg-type]
3737
"type": "local",
3838
"launchOptions": {}, # Launch local Playwright browser with defaults
3939
},

0 commit comments

Comments
 (0)