From af4890e6a7b41dd37603419a00fa8698f83ba754 Mon Sep 17 00:00:00 2001 From: Mike O'Connor Date: Fri, 17 Jan 2025 19:28:07 +0000 Subject: [PATCH] run pre-commit all --- examples/cached_decorator.py | 4 ++-- examples/frameworks/aiohttp_example.py | 1 + examples/frameworks/sanic_example.py | 2 +- examples/frameworks/tornado_example.py | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/cached_decorator.py b/examples/cached_decorator.py index 39e2759c..f5b9f02f 100644 --- a/examples/cached_decorator.py +++ b/examples/cached_decorator.py @@ -11,8 +11,8 @@ cache = RedisCache(namespace="main", client=redis.Redis(), serializer=PickleSerializer()) -@cached( - cache, ttl=10, key_builder=lambda *args, **kw: "key") + +@cached(cache, ttl=10, key_builder=lambda *args, **kw: "key") async def cached_call(): return Result("content", 200) diff --git a/examples/frameworks/aiohttp_example.py b/examples/frameworks/aiohttp_example.py index 029d30e9..45cb4cee 100644 --- a/examples/frameworks/aiohttp_example.py +++ b/examples/frameworks/aiohttp_example.py @@ -7,6 +7,7 @@ cache = SimpleMemoryCache(serializer=JsonSerializer()) + @cached(cache=cache, key_builder=lambda x: "time") async def time(): return {"time": datetime.now().isoformat()} diff --git a/examples/frameworks/sanic_example.py b/examples/frameworks/sanic_example.py index 61b297a1..2fec3a38 100644 --- a/examples/frameworks/sanic_example.py +++ b/examples/frameworks/sanic_example.py @@ -16,7 +16,7 @@ app = Sanic(__name__) -@cached(SimpleMemoryCache(), key_builder = lambda x :"my_custom_key") +@cached(SimpleMemoryCache(), key_builder=lambda x: "my_custom_key") async def expensive_call(): logger.info("Expensive has been called") await asyncio.sleep(3) diff --git a/examples/frameworks/tornado_example.py b/examples/frameworks/tornado_example.py index 47f8e2d8..e7127c29 100644 --- a/examples/frameworks/tornado_example.py +++ b/examples/frameworks/tornado_example.py @@ -9,7 +9,7 @@ class MainHandler(tornado.web.RequestHandler): # Due some incompatibilities between tornado and asyncio, caches can't use the "ttl" feature # in order to make it work, you will have to specify it always to 0 - @cached(SimpleMemoryCache(serializer=JsonSerializer, timeout=0), key_builder= lambda x : "my_custom_key") + @cached(SimpleMemoryCache(serializer=JsonSerializer, timeout=0), key_builder=lambda x: "my_custom_key") async def time(self): return {"time": datetime.now().isoformat()}