Add pyupgrade pre-commit hook + modernize python code (#2611)

This commit is contained in:
Asher Foa
2025-06-10 14:52:38 -04:00
committed by GitHub
parent 272985f1bb
commit effd0c4911
18 changed files with 47 additions and 45 deletions

View File

@@ -144,7 +144,7 @@ def setup_claude_desktop_config(host_system: str, path_to_env: str) -> bool:
claude_config: dict = {"mcpServers": {}}
if os.path.exists(path_claude_config):
try:
with open(path_claude_config, "r") as f:
with open(path_claude_config) as f:
claude_config = json.load(f)
claude_config["mcpServers"].pop("Skyvern", None)
claude_config["mcpServers"]["Skyvern"] = {
@@ -196,7 +196,7 @@ def setup_cursor_config(host_system: str, path_to_env: str) -> bool:
cursor_config: dict = {"mcpServers": {}}
if os.path.exists(path_cursor_config):
try:
with open(path_cursor_config, "r") as f:
with open(path_cursor_config) as f:
cursor_config = json.load(f)
cursor_config["mcpServers"].pop("Skyvern", None)
cursor_config["mcpServers"]["Skyvern"] = {
@@ -245,7 +245,7 @@ def setup_windsurf_config(host_system: str, path_to_env: str) -> bool:
windsurf_config: dict = {"mcpServers": {}}
if os.path.exists(path_windsurf_config):
try:
with open(path_windsurf_config, "r") as f:
with open(path_windsurf_config) as f:
windsurf_config = json.load(f)
windsurf_config["mcpServers"].pop("Skyvern", None)
windsurf_config["mcpServers"]["Skyvern"] = {

View File

@@ -4,7 +4,6 @@ from __future__ import annotations
import json
import os
from typing import Optional
import typer
from dotenv import load_dotenv
@@ -21,7 +20,7 @@ tasks_app = typer.Typer(help="Manage Skyvern tasks and operations.")
@tasks_app.callback()
def tasks_callback(
ctx: typer.Context,
api_key: Optional[str] = typer.Option(
api_key: str | None = typer.Option(
None,
"--api-key",
help="Skyvern API key",
@@ -32,7 +31,7 @@ def tasks_callback(
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."""
load_dotenv()
load_dotenv(".env")

View File

@@ -4,7 +4,6 @@ from __future__ import annotations
import json
import os
from typing import Optional
import typer
from dotenv import load_dotenv
@@ -22,7 +21,7 @@ workflow_app = typer.Typer(help="Manage Skyvern workflows.")
@workflow_app.callback()
def workflow_callback(
ctx: typer.Context,
api_key: Optional[str] = typer.Option(
api_key: str | None = typer.Option(
None,
"--api-key",
help="Skyvern API key",
@@ -33,7 +32,7 @@ def workflow_callback(
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."""
load_dotenv()
load_dotenv(".env")
@@ -46,8 +45,8 @@ def start_workflow(
ctx: typer.Context,
workflow_id: str = typer.Argument(..., help="Workflow permanent ID"),
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"),
max_steps: Optional[int] = typer.Option(None, "--max-steps", help="Override the workflow max steps"),
title: str | None = typer.Option(None, "--title", help="Title for the workflow run"),
max_steps: int | None = typer.Option(None, "--max-steps", help="Override the workflow max steps"),
) -> None:
"""Dispatch a workflow run."""
try: