Files
Martijn Pieters 1d9e126037 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.
2023-05-16 12:18:24 +01:00

29 lines
625 B
Python

from fastapi_cache.backends import inmemory
from fastapi_cache.types import Backend
__all__ = ["Backend", "inmemory"]
# import each backend in turn and add to __all__. This syntax
# is explicitly supported by type checkers, while more dynamic
# syntax would not be recognised.
try:
from fastapi_cache.backends import dynamodb
except ImportError:
pass
else:
__all__ += ["dynamodb"]
try:
from fastapi_cache.backends import memcached
except ImportError:
pass
else:
__all__ += ["memcached"]
try:
from fastapi_cache.backends import redis
except ImportError:
pass
else:
__all__ += ["redis"]