Skip to content

Commit 993d946

Browse files
committed
formatting
1 parent b93f7a5 commit 993d946

File tree

5 files changed

+23
-13
lines changed

5 files changed

+23
-13
lines changed

stagehand/client.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,23 +76,23 @@ def __init__(
7676
# Start with provided config or default config
7777
if config is None:
7878
config = default_config
79-
79+
8080
# Apply any overrides
8181
overrides = {}
8282
if api_url is not None:
8383
# api_url isn't in config, handle separately
8484
pass
8585
if model_api_key is not None:
86-
# model_api_key isn't in config, handle separately
86+
# model_api_key isn't in config, handle separately
8787
pass
8888
if session_id is not None:
89-
overrides['browserbase_session_id'] = session_id
89+
overrides["browserbase_session_id"] = session_id
9090
if env is not None:
91-
overrides['env'] = env
92-
91+
overrides["env"] = env
92+
9393
# Add any additional config overrides
9494
overrides.update(config_overrides)
95-
95+
9696
# Create final config with overrides
9797
if overrides:
9898
self.config = config.with_overrides(**overrides)
@@ -102,10 +102,14 @@ def __init__(
102102
# Handle non-config parameters
103103
self.api_url = api_url or os.getenv("STAGEHAND_API_URL")
104104
self.model_api_key = model_api_key or os.getenv("MODEL_API_KEY")
105-
105+
106106
# Extract frequently used values from config for convenience
107-
self.browserbase_api_key = self.config.api_key or os.getenv("BROWSERBASE_API_KEY")
108-
self.browserbase_project_id = self.config.project_id or os.getenv("BROWSERBASE_PROJECT_ID")
107+
self.browserbase_api_key = self.config.api_key or os.getenv(
108+
"BROWSERBASE_API_KEY"
109+
)
110+
self.browserbase_project_id = self.config.project_id or os.getenv(
111+
"BROWSERBASE_PROJECT_ID"
112+
)
109113
self.session_id = self.config.browserbase_session_id
110114
self.model_name = self.config.model_name
111115
self.dom_settle_timeout_ms = self.config.dom_settle_timeout_ms
@@ -114,7 +118,9 @@ def __init__(
114118
self.system_prompt = self.config.system_prompt
115119
self.verbose = self.config.verbose
116120
self.env = self.config.env.upper() if self.config.env else "BROWSERBASE"
117-
self.local_browser_launch_options = self.config.local_browser_launch_options or {}
121+
self.local_browser_launch_options = (
122+
self.config.local_browser_launch_options or {}
123+
)
118124

119125
# Handle model-related settings
120126
self.model_client_options = {}

stagehand/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ class StagehandConfig(BaseModel):
8888
def with_overrides(self, **overrides) -> "StagehandConfig":
8989
"""
9090
Create a new config instance with the specified overrides.
91-
91+
9292
Args:
9393
**overrides: Key-value pairs to override in the config
94-
94+
9595
Returns:
9696
StagehandConfig: New config instance with overrides applied
9797
"""

stagehand/context.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ async def wrapped_new_page(*args, **kwargs):
8787

8888
return wrapped_new_page
8989
elif name == "pages":
90+
9091
async def wrapped_pages():
9192
pw_pages = self._context.pages
9293
# Return StagehandPage objects

stagehand/handlers/act_handler_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ async def handle_possible_page_navigation(
444444
},
445445
)
446446

447-
if new_opened_tab and new_opened_tab.url != 'about:blank':
447+
if new_opened_tab and new_opened_tab.url != "about:blank":
448448
logger.info(
449449
message="new page detected (new tab) with URL",
450450
category="action",

stagehand/utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,7 @@ def convert_dict_keys_to_camel_case(data: dict[str, Any]) -> dict[str, Any]:
680680

681681
return result
682682

683+
683684
def format_simplified_tree(node: AccessibilityNode, level: int = 0) -> str:
684685
"""Formats a node and its children into a simplified string representation."""
685686
indent = " " * level
@@ -1134,6 +1135,8 @@ def inject_url_at_path(obj, segments, id_to_url_mapping):
11341135
else:
11351136
# Continue traversing the path
11361137
inject_url_at_path(obj[key], rest, id_to_url_mapping)
1138+
1139+
11371140
# Convert any non-serializable objects to plain Python objects
11381141
def make_serializable(obj):
11391142
"""Recursively convert non-JSON-serializable objects to serializable ones."""

0 commit comments

Comments
 (0)