Enable pyupgrade on skyvern/cli (#2806)

This commit is contained in:
Asher Foa
2025-06-27 21:22:34 -04:00
committed by GitHub
parent b280308b15
commit 8cad3aae18
3 changed files with 10 additions and 13 deletions

View File

@@ -23,7 +23,7 @@ repos:
always_run: true always_run: true
- repo: https://github.com/astral-sh/ruff-pre-commit - repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version. # Ruff version.
rev: v0.11.13 rev: v0.12.1
hooks: hooks:
# Run the linter. # Run the linter.
- id: ruff - id: ruff
@@ -57,11 +57,10 @@ repos:
- id: pyupgrade - id: pyupgrade
exclude: | exclude: |
(?x)( (?x)(
^skyvern/client/.*| ^skyvern/client/.*
^skyvern/cli/.*
) )
- repo: https://github.com/pre-commit/mirrors-mypy - repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.16.0 rev: v1.16.1
hooks: hooks:
- id: mypy - id: mypy
args: [--show-error-codes, --warn-unused-configs, --disallow-untyped-calls, --disallow-untyped-defs, --disallow-incomplete-defs, --check-untyped-defs] args: [--show-error-codes, --warn-unused-configs, --disallow-untyped-calls, --disallow-untyped-defs, --disallow-incomplete-defs, --check-untyped-defs]
@@ -116,6 +115,6 @@ repos:
hooks: hooks:
- id: shellcheck - id: shellcheck
- repo: https://github.com/google/yamlfmt - repo: https://github.com/google/yamlfmt
rev: v0.17.0 rev: v0.17.2
hooks: hooks:
- id: yamlfmt - id: yamlfmt

View File

@@ -4,7 +4,6 @@ from __future__ import annotations
import json import json
import os import os
from typing import Optional
import typer import typer
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -21,7 +20,7 @@ tasks_app = typer.Typer(help="Manage Skyvern tasks and operations.")
@tasks_app.callback() @tasks_app.callback()
def tasks_callback( def tasks_callback(
ctx: typer.Context, ctx: typer.Context,
api_key: Optional[str] = typer.Option( api_key: str | None = typer.Option(
None, None,
"--api-key", "--api-key",
help="Skyvern API key", help="Skyvern API key",
@@ -32,7 +31,7 @@ def tasks_callback(
ctx.obj = {"api_key": api_key} ctx.obj = {"api_key": api_key}
def _get_client(api_key: Optional[str] = None) -> Skyvern: def _get_client(api_key: str | None = None) -> Skyvern:
"""Instantiate a Skyvern SDK client using environment variables.""" """Instantiate a Skyvern SDK client using environment variables."""
load_dotenv() load_dotenv()
load_dotenv(".env") load_dotenv(".env")

View File

@@ -4,7 +4,6 @@ from __future__ import annotations
import json import json
import os import os
from typing import Optional
import typer import typer
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -22,7 +21,7 @@ workflow_app = typer.Typer(help="Manage Skyvern workflows.")
@workflow_app.callback() @workflow_app.callback()
def workflow_callback( def workflow_callback(
ctx: typer.Context, ctx: typer.Context,
api_key: Optional[str] = typer.Option( api_key: str | None = typer.Option(
None, None,
"--api-key", "--api-key",
help="Skyvern API key", help="Skyvern API key",
@@ -33,7 +32,7 @@ def workflow_callback(
ctx.obj = {"api_key": api_key} ctx.obj = {"api_key": api_key}
def _get_client(api_key: Optional[str] = None) -> Skyvern: def _get_client(api_key: str | None = None) -> Skyvern:
"""Instantiate a Skyvern SDK client using environment variables.""" """Instantiate a Skyvern SDK client using environment variables."""
load_dotenv() load_dotenv()
load_dotenv(".env") load_dotenv(".env")
@@ -46,8 +45,8 @@ def run_workflow(
ctx: typer.Context, ctx: typer.Context,
workflow_id: str = typer.Argument(..., help="Workflow permanent ID"), workflow_id: str = typer.Argument(..., help="Workflow permanent ID"),
parameters: str = typer.Option("{}", "--parameters", "-p", help="JSON parameters for the workflow"), parameters: str = typer.Option("{}", "--parameters", "-p", help="JSON parameters for the workflow"),
title: Optional[str] = typer.Option(None, "--title", help="Title for the workflow run"), title: str | None = typer.Option(None, "--title", help="Title for the workflow run"),
max_steps: Optional[int] = typer.Option(None, "--max-steps", help="Override the workflow max steps"), max_steps: int | None = typer.Option(None, "--max-steps", help="Override the workflow max steps"),
) -> None: ) -> None:
"""Run a workflow.""" """Run a workflow."""
try: try: