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

@@ -2,7 +2,16 @@ import datetime
import json
import pickle # nosec:B403
from decimal import Decimal
from typing import Any, Callable, ClassVar, Dict, Optional, TypeVar, Union, overload
from typing import (
Any,
Callable,
ClassVar,
Dict,
Optional,
TypeVar,
Union,
overload,
)
import pendulum
from fastapi.encoders import jsonable_encoder