Skip to content

Commit

Permalink
Fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
GigantPro committed Aug 30, 2023
1 parent 8bea55a commit 0e3cdfa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 4 additions & 4 deletions frozenclass/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ def cache(*, ttl: Optional[time] = time(minute=10),
:param ttl: Time-To-Live of cached valume, defaults to time(minute=10)
:type ttl: time | None, optional
:param is_async: Set True if decorated func is async, defaults to False
:type is_async: bool, optional
:return: Decorated func
:rtype: Callable
"""
Expand All @@ -37,7 +39,7 @@ def cached_func_without_time(*args, **kwargs) -> Any:
result = target_func(*args, **kwargs)
__cached_vals[(*args, *kwargs)] = result
return result


async def async_cached_func_with_time(*args, **kwargs) -> Any:
cached_ = __cached_vals.get((*args, *kwargs), None)
Expand All @@ -63,8 +65,6 @@ async def async_cached_func_without_time(*args, **kwargs) -> Any:

if not is_async:
return cached_func_with_time if ttl else cached_func_without_time

else:
return async_cached_func_with_time if ttl else async_cached_func_without_time
return async_cached_func_with_time if ttl else async_cached_func_without_time

return wrapper_func
4 changes: 1 addition & 3 deletions tests/test_async_cache.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import sqlite3
from datetime import time
from time import sleep, time as t_time
from timeit import timeit
from time import sleep
import pytest

from frozenclass import CacheController
Expand Down

0 comments on commit 0e3cdfa

Please sign in to comment.