From 34c3434885216f6ef4c15318eb26e49f859f174d Mon Sep 17 00:00:00 2001 From: Shuchang Zheng Date: Tue, 14 Jan 2025 14:06:43 -0800 Subject: [PATCH] shu/autoupgrade pre commit (#1553) --- .pre-commit-config.yaml | 4 ++-- skyvern/forge/sdk/routes/agent_protocol.py | 2 +- skyvern/forge/sdk/workflow/models/block.py | 2 +- skyvern/forge/sdk/workflow/service.py | 18 +++++++++--------- skyvern/webeye/scraper/scraper.py | 4 ++-- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 59daaa31..237d8284 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.1 hooks: # 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.1 hooks: - id: mypy args: [--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.py index 2a09bbd3..b75e87a6 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 file diff --git a/skyvern/forge/sdk/workflow/models/block.py b/skyvern/forge/sdk/workflow/models/block.py index 509d6bfc..a6bc23b3 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_over if 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_context diff --git a/skyvern/forge/sdk/workflow/service.py b/skyvern/forge/sdk/workflow/service.py index 5dea9d1e..00a763ad 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_run elif 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_run LOG.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_run LOG.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.py index 6c6fe72b..43b7c087 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_text and 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}' + return f"<{tag}{attributes_html if not attributes_html else ' ' + attributes_html}>{before_pseudo_text}{text}{children_html + option_html}{after_pseudo_text}" def clean_element_before_hashing(element: dict) -> dict: