Switch to ruff to handle linting and formatting

Ruff handles black, flake8 and isort in one package, and is way faster.
The isort rules had not been enforced, so this commit includes a lot
of import resorting changes.

I switched to flake8-bugbear and the standard black-compatible line
length of 80 + 10% (so max 88 characters), so some line reflowing is
included too.

Finally, because bugbear rightly points out that `setattr()` is less
performant, I've switched the `__signature__` assigment back to using
a direct assignment with type ignore comment.
This commit is contained in:
Martijn Pieters
2023-05-16 12:09:50 +01:00
parent 707b4aec95
commit 1d9e126037
12 changed files with 89 additions and 165 deletions

View File

@@ -4,13 +4,13 @@ from typing import Dict, Optional
import pendulum
import uvicorn
from fastapi import FastAPI
from pydantic import BaseModel
from starlette.requests import Request
from starlette.responses import JSONResponse, Response
from fastapi_cache import FastAPICache
from fastapi_cache.backends.inmemory import InMemoryBackend
from fastapi_cache.decorator import cache
from pydantic import BaseModel
app = FastAPI()