Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
shu/autoupgrade pre commit (#1553)
Shuchang Zheng34c343488521
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yamlindex 59daaa314..237d82849 100644--- a/.pre-commit-config.yaml+++ b/.pre-commit-config.yaml@@ -15,7 +15,7 @@ repos:- id: detect-private-key- repo: https://github.com/astral-sh/ruff-pre-commit# Ruff version.- rev: v0.7.3+ rev: v0.9.1hooks:# Run the linter.- id: ruff@@ -37,7 +37,7 @@ repos:- id: python-use-type-annotations- repo: https://github.com/pre-commit/mirrors-mypy- rev: v1.13.0+ rev: v1.14.1hooks:- id: mypyargs: [--show-error-codes, --warn-unused-configs, --disallow-untyped-calls, --disallow-untyped-defs, --disallow-incomplete-defs, --check-untyped-defs, --python-version=3.11]diff --git a/skyvern/forge/sdk/routes/agent_protocol.py b/skyvern/forge/sdk/routes/agent_protocol.pyindex 2a09bbd37..b75e87a6b 100644--- a/skyvern/forge/sdk/routes/agent_protocol.py+++ b/skyvern/forge/sdk/routes/agent_protocol.py@@ -1080,7 +1080,7 @@ async def validate_file_size(file: UploadFile) -> UploadFile:if size > app.SETTINGS_MANAGER.MAX_UPLOAD_FILE_SIZE:raise HTTPException(status_code=413,- detail=f"File size exceeds the maximum allowed size ({app.SETTINGS_MANAGER.MAX_UPLOAD_FILE_SIZE/1024/1024} MB)",+ detail=f"File size exceeds the maximum allowed size ({app.SETTINGS_MANAGER.MAX_UPLOAD_FILE_SIZE / 1024 / 1024} MB)",)return filediff --git a/skyvern/forge/sdk/workflow/models/block.py b/skyvern/forge/sdk/workflow/models/block.pyindex 509d6bfc2..a6bc23b35 100644--- a/skyvern/forge/sdk/workflow/models/block.py+++ b/skyvern/forge/sdk/workflow/models/block.py@@ -789,7 +789,7 @@ class ForLoopBlock(Block):def get_loop_over_parameter_values(self, workflow_run_context: WorkflowRunContext) -> list[Any]:# parse the value from self.loop_variable_reference and then from self.loop_overif self.loop_variable_reference:- value_template = f'{{{{ {self.loop_variable_reference.strip(" {}")} | tojson }}}}'+ value_template = f"{{{{ {self.loop_variable_reference.strip(' {}')} | tojson }}}}"try:value_json = self.format_block_parameter_template_from_workflow_run_context(value_template, workflow_run_contextdiff --git a/skyvern/forge/sdk/workflow/service.py b/skyvern/forge/sdk/workflow/service.pyindex 5dea9d1e1..00a763ad4 100644--- a/skyvern/forge/sdk/workflow/service.py+++ b/skyvern/forge/sdk/workflow/service.py@@ -251,7 +251,7 @@ class WorkflowService:workflow_run_id, parameters, organization)LOG.info(- f"Executing root block {block.block_type} at index {block_idx}/{blocks_cnt -1} for workflow run {workflow_run_id}",+ f"Executing root block {block.block_type} at index {block_idx}/{blocks_cnt - 1} for workflow run {workflow_run_id}",block_type=block.block_type,workflow_run_id=workflow_run.workflow_run_id,block_idx=block_idx,@@ -265,7 +265,7 @@ class WorkflowService:)if block_result.status == BlockStatus.canceled:LOG.info(- f"Block with type {block.block_type} at index {block_idx}/{blocks_cnt -1} was canceled for workflow run {workflow_run_id}, cancelling workflow run",+ f"Block with type {block.block_type} at index {block_idx}/{blocks_cnt - 1} was canceled for workflow run {workflow_run_id}, cancelling workflow run",block_type=block.block_type,workflow_run_id=workflow_run.workflow_run_id,block_idx=block_idx,@@ -286,7 +286,7 @@ class WorkflowService:return workflow_runelif block_result.status == BlockStatus.failed:LOG.error(- f"Block with type {block.block_type} at index {block_idx}/{blocks_cnt -1} failed for workflow run {workflow_run_id}",+ f"Block with type {block.block_type} at index {block_idx}/{blocks_cnt - 1} failed for workflow run {workflow_run_id}",block_type=block.block_type,workflow_run_id=workflow_run.workflow_run_id,block_idx=block_idx,@@ -295,7 +295,7 @@ class WorkflowService:block_label=block.label,)if not block.continue_on_failure:- failure_reason = f"Block with type {block.block_type} at index {block_idx}/{blocks_cnt -1} failed. failure reason: {block_result.failure_reason}"+ failure_reason = f"Block with type {block.block_type} at index {block_idx}/{blocks_cnt - 1} failed. failure reason: {block_result.failure_reason}"await self.mark_workflow_run_as_failed(workflow_run_id=workflow_run.workflow_run_id, failure_reason=failure_reason)@@ -309,7 +309,7 @@ class WorkflowService:return workflow_runLOG.warning(- f"Block with type {block.block_type} at index {block_idx}/{blocks_cnt -1} failed but will continue executing the workflow run {workflow_run_id}",+ f"Block with type {block.block_type} at index {block_idx}/{blocks_cnt - 1} failed but will continue executing the workflow run {workflow_run_id}",block_type=block.block_type,workflow_run_id=workflow_run.workflow_run_id,block_idx=block_idx,@@ -321,7 +321,7 @@ class WorkflowService:elif block_result.status == BlockStatus.terminated:LOG.info(- f"Block with type {block.block_type} at index {block_idx}/{blocks_cnt -1} was terminated for workflow run {workflow_run_id}, marking workflow run as terminated",+ f"Block with type {block.block_type} at index {block_idx}/{blocks_cnt - 1} was terminated for workflow run {workflow_run_id}, marking workflow run as terminated",block_type=block.block_type,workflow_run_id=workflow_run.workflow_run_id,block_idx=block_idx,@@ -331,7 +331,7 @@ class WorkflowService:)if not block.continue_on_failure:- failure_reason = f"Block with type {block.block_type} at index {block_idx}/{blocks_cnt -1} terminated. Reason: {block_result.failure_reason}"+ failure_reason = f"Block with type {block.block_type} at index {block_idx}/{blocks_cnt - 1} terminated. Reason: {block_result.failure_reason}"await self.mark_workflow_run_as_terminated(workflow_run_id=workflow_run.workflow_run_id, failure_reason=failure_reason)@@ -345,7 +345,7 @@ class WorkflowService:return workflow_runLOG.warning(- f"Block with type {block.block_type} at index {block_idx}/{blocks_cnt -1} was terminated for workflow run {workflow_run_id}, but will continue executing the workflow run",+ f"Block with type {block.block_type} at index {block_idx}/{blocks_cnt - 1} was terminated for workflow run {workflow_run_id}, but will continue executing the workflow run",block_type=block.block_type,workflow_run_id=workflow_run.workflow_run_id,block_idx=block_idx,@@ -368,7 +368,7 @@ class WorkflowService:if isinstance(e, SkyvernException):exception_message = f"unexpected SkyvernException({e.__class__.__name__}): {str(e)}"- failure_reason = f"Block with type {block.block_type} at index {block_idx}/{blocks_cnt -1} failed. failure reason: {exception_message}"+ failure_reason = f"Block with type {block.block_type} at index {block_idx}/{blocks_cnt - 1} failed. failure reason: {exception_message}"await self.mark_workflow_run_as_failed(workflow_run_id=workflow_run.workflow_run_id, failure_reason=failure_reason)diff --git a/skyvern/webeye/scraper/scraper.py b/skyvern/webeye/scraper/scraper.pyindex 6c6fe72b6..43b7c0878 100644--- a/skyvern/webeye/scraper/scraper.py+++ b/skyvern/webeye/scraper/scraper.py@@ -150,9 +150,9 @@ def json_to_html(element: dict, need_skyvern_attrs: bool = True) -> str:and not before_pseudo_textand not after_pseudo_text):- return f'<{tag}{attributes_html if not attributes_html else " "+attributes_html}>'+ return f"<{tag}{attributes_html if not attributes_html else ' ' + attributes_html}>"else:- return f'<{tag}{attributes_html if not attributes_html else " "+attributes_html}>{before_pseudo_text}{text}{children_html+option_html}{after_pseudo_text}</{tag}>'+ return f"<{tag}{attributes_html if not attributes_html else ' ' + attributes_html}>{before_pseudo_text}{text}{children_html + option_html}{after_pseudo_text}</{tag}>"def clean_element_before_hashing(element: dict) -> dict: