Skip to content

Commit bf7dc20

Browse files
committed
formatting
1 parent ae19586 commit bf7dc20

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

stagehand/api.py

Whitespace-only changes.

stagehand/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def __init__(
6262
system_prompt: Optional[str] = None,
6363
use_rich_logging: bool = True,
6464
env: Literal["BROWSERBASE", "LOCAL"] = None,
65-
local_browser_launch_options: Optional[dict[str, Any]] = dict(),
65+
local_browser_launch_options: Optional[dict[str, Any]] = None,
6666
browserbase_session_create_params: Optional[BrowserbaseSessionCreateParams] = None,
6767
):
6868
"""
@@ -165,7 +165,7 @@ def __init__(
165165
self.local_browser_launch_options = (
166166
getattr(config, "local_browser_launch_options", {})
167167
if config
168-
else local_browser_launch_options
168+
else local_browser_launch_options if local_browser_launch_options else {}
169169
)
170170
self._local_user_data_dir_temp: Optional[Path] = (
171171
None # To store path if created temporarily

stagehand/utils.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import json
44
import logging
55
from datetime import datetime
6-
from typing import Any, Callable, List, Optional, Union, get_args, get_origin
6+
from typing import Any, Callable, Optional, Union, get_args, get_origin
77

88
from pydantic import AnyUrl, BaseModel, Field, HttpUrl, create_model
99
from pydantic.fields import FieldInfo
@@ -701,7 +701,7 @@ async def draw_observe_overlay(page, elements):
701701
702702
Args:
703703
page: Playwright page object
704-
elements: List of observation results with selectors
704+
elements: list of observation results with selectors
705705
"""
706706
if not elements:
707707
return
@@ -961,15 +961,15 @@ def transform_type(annotation, path):
961961
if annotation is None:
962962
return annotation, []
963963

964-
# Get the origin type for generic types (List, Optional, etc.)
964+
# Get the origin type for generic types (list, Optional, etc.)
965965
origin = get_origin(annotation)
966966

967967
# Case 1: It's a URL type (AnyUrl, HttpUrl)
968968
if is_url_type(annotation):
969969
return int, [{"segments": []}]
970970

971-
# Case 2: It's a List or other generic container
972-
if origin in (list, List):
971+
# Case 2: It's a list or other generic container
972+
if origin in (list, list):
973973
args = get_args(annotation)
974974
if not args:
975975
return annotation, []
@@ -980,11 +980,11 @@ def transform_type(annotation, path):
980980

981981
if new_elem_type != elem_type:
982982
# Transform the list type to use the new element type
983-
if len(args) > 1: # Handle List with multiple type args
983+
if len(args) > 1: # Handle list with multiple type args
984984
new_args = (new_elem_type,) + args[1:]
985985
new_type = origin[new_args]
986986
else:
987-
new_type = List[new_elem_type]
987+
new_type = list[new_elem_type]
988988

989989
# Update paths to include the array wildcard
990990
url_paths = []
@@ -1059,8 +1059,8 @@ def is_url_type(annotation):
10591059
# Check for URL in generic containers
10601060
origin = get_origin(annotation)
10611061

1062-
# Handle List[URL]
1063-
if origin in (list, List):
1062+
# Handle list[URL]
1063+
if origin in (list, list):
10641064
args = get_args(annotation)
10651065
if args:
10661066
return is_url_type(args[0])
@@ -1079,7 +1079,7 @@ def inject_urls(result, url_paths, id_to_url_mapping):
10791079
10801080
Args:
10811081
result: The result data structure
1082-
url_paths: List of paths to URL fields in the structure
1082+
url_paths: list of paths to URL fields in the structure
10831083
id_to_url_mapping: Dictionary mapping numeric IDs to URLs
10841084
10851085
Returns:

0 commit comments

Comments
 (0)