mirror of
https://github.com/long2ice/fastapi-cache.git
synced 2026-03-25 04:57:54 +00:00
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.
29 lines
625 B
Python
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"]
|