Skip to content

Commit 8d8d750

Browse files
Fix code style issues
Co-Authored-By: Sean Yang <[email protected]>
1 parent 7413732 commit 8d8d750

File tree

6 files changed

+489
-511
lines changed

6 files changed

+489
-511
lines changed

browser_use/agent/service.py

+22-22
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ def __init__(
300300

301301
# Telemetry
302302
self.telemetry = ProductTelemetry()
303-
303+
304304
self.action_log = []
305305
self.script_format = None # 'browserql' or 'baas_v2'
306306

@@ -993,24 +993,24 @@ async def multi_act(
993993
if not result.error:
994994
action_type = action.get_action_type()
995995
action_data = {
996-
"action_type": action_type,
997-
"params": action.model_dump(exclude_unset=True),
998-
"selector": None,
999-
"timestamp": time.time()
996+
'action_type': action_type,
997+
'params': action.model_dump(exclude_unset=True),
998+
'selector': None,
999+
'timestamp': time.time(),
10001000
}
1001-
1001+
10021002
if action.get_index() is not None:
10031003
element = cached_selector_map.get(action.get_index())
10041004
if element:
1005-
action_data["selector"] = {
1006-
"xpath": element.xpath,
1007-
"tag_name": element.tag_name,
1008-
"attributes": element.attributes,
1009-
"index": action.get_index(),
1010-
"is_visible": element.is_visible,
1011-
"is_interactive": element.is_interactive
1005+
action_data['selector'] = {
1006+
'xpath': element.xpath,
1007+
'tag_name': element.tag_name,
1008+
'attributes': element.attributes,
1009+
'index': action.get_index(),
1010+
'is_visible': element.is_visible,
1011+
'is_interactive': element.is_interactive,
10121012
}
1013-
1013+
10141014
self.action_log.append(action_data)
10151015
logger.debug(f'Logged action {action_type} for script generation')
10161016

@@ -1419,37 +1419,37 @@ async def _update_action_models_for_page(self, page) -> None:
14191419
# Update done action model too
14201420
self.DoneActionModel = self.controller.registry.create_action_model(include_actions=['done'], page=page)
14211421
self.DoneAgentOutput = AgentOutput.type_with_custom_actions(self.DoneActionModel)
1422-
1422+
14231423
def get_action_log(self) -> List[Dict]:
14241424
"""
14251425
Get the current action log.
1426-
1426+
14271427
Returns:
14281428
List[Dict]: List of logged actions
14291429
"""
14301430
return self.action_log
1431-
1431+
14321432
def clear_action_log(self) -> None:
14331433
"""Clear the action log."""
14341434
self.action_log = []
1435-
1435+
14361436
def set_script_format(self, format_type: str) -> None:
14371437
"""
14381438
Set the preferred script format.
1439-
1439+
14401440
Args:
14411441
format_type: Script format type ('browserql' or 'baas_v2')
14421442
"""
14431443
self.script_format = format_type
1444-
1444+
14451445
def get_script(self, format_type: Optional[str] = None, **kwargs) -> str:
14461446
"""
14471447
Generate a script from the action log.
1448-
1448+
14491449
Args:
14501450
format_type: Script format type ('browserql' or 'baas_v2')
14511451
**kwargs: Additional arguments for the converter
1452-
1452+
14531453
Returns:
14541454
str: Generated script
14551455
"""
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
from browser_use.script_generation.service import ScriptGenerator
22

3-
__all__ = ["ScriptGenerator"]
3+
__all__ = ['ScriptGenerator']

0 commit comments

Comments
 (0)