Tweak ruff config and update pre-commit hooks

This commit is contained in:
Stéphane Bidoul 2023-02-22 22:55:30 +01:00
parent 479607e34c
commit 3c54a393ba
5 changed files with 20 additions and 19 deletions

View file

@ -2,7 +2,7 @@ default_language_version:
python: python3
repos:
- repo: https://github.com/psf/black
rev: 22.10.0
rev: 23.1.0
hooks:
- id: black
- repo: https://github.com/pre-commit/pre-commit-hooks
@ -13,6 +13,6 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.149
rev: v0.0.252
hooks:
- id: ruff

View file

@ -39,17 +39,18 @@ mypy = [
Home = "https://github.com/sbidoul/runboat"
[tool.ruff]
fix = false
fix = true
target-version = "py310"
select = [
"E", "F", "U", "N", "S", "C", "B", "A", "I", "T", "Q", "YTT", "BLE", "C", "RUF", "M"
]
ignore = [
"B008",
"BLE001",
"N805",
"N818",
"S101",
"U007",
"F", # pyflakes
"E", # pycodestyle
"W", # pycodestyle
"C90", # mccabe
"I", # isort
"UP", # pyupgrade
"T10", # flake8-debugger
"PLE", # pylint errors
"RUF",
]
[tool.ruff.mccabe]

View file

@ -1,7 +1,7 @@
import asyncio
import logging
from collections.abc import Awaitable
from typing import Any, Callable
from collections.abc import Awaitable, Callable
from typing import Any
from . import k8s
from .db import BuildsDb

View file

@ -4,12 +4,12 @@ import os
import shutil
import subprocess
import tempfile
from collections.abc import Generator
from collections.abc import Callable, Generator
from contextlib import contextmanager
from enum import Enum
from importlib import resources
from pathlib import Path
from typing import Any, Callable, TypedDict, cast
from typing import Any, TypedDict, cast
import urllib3
from jinja2 import Template
@ -212,7 +212,7 @@ async def _kubectl(args: list[str]) -> None:
)
return_code = await proc.wait()
if return_code != 0:
raise subprocess.CalledProcessError(return_code, ["kubectl"] + args)
raise subprocess.CalledProcessError(return_code, ["kubectl", *args])
async def deploy(kubefiles_path: Path | None, deployment_vars: DeploymentVars) -> None:

View file

@ -1,10 +1,10 @@
import asyncio
import functools
import re
from collections.abc import AsyncGenerator, Awaitable, Generator, Iterator
from collections.abc import AsyncGenerator, Awaitable, Callable, Generator, Iterator
from concurrent.futures.thread import ThreadPoolExecutor
from functools import wraps
from typing import Any, Callable, ParamSpec, TypeVar
from typing import Any, ParamSpec, TypeVar
_pool = ThreadPoolExecutor(max_workers=20, thread_name_prefix="sync_to_async")