Skip to content

Commit

Permalink
Rename inner functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Galtozzy committed Aug 24, 2024
1 parent 0ac0138 commit 97cf47a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions py_cachify/backend/cached.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@

def cached(key: str, ttl: Union[int, None] = None, enc_dec: Union[Tuple[Encoder, Decoder], None] = None) -> SyncOrAsync:
@overload
def _decorator(
def _cached_inner(
_func: Callable[P, Awaitable[R]],
) -> Callable[P, Awaitable[R]]: ...

@overload
def _decorator(
def _cached_inner(
_func: Callable[P, R],
) -> Callable[P, R]: ...

def _decorator( # type: ignore[misc]
def _cached_inner( # type: ignore[misc]
_func: Union[Callable[P, R], Callable[P, Awaitable[R]]],
) -> Union[Callable[P, R], Callable[P, Awaitable[R]]]:
signature = inspect.signature(_func)
Expand Down Expand Up @@ -63,7 +63,7 @@ def _sync_wrapper(*args: P.args, **kwargs: P.kwargs) -> R:

return _sync_wrapper

return _decorator
return _cached_inner


@deprecated('sync_cached is deprecated, use cached instead. Scheduled for removal in 1.3.0')
Expand Down
8 changes: 4 additions & 4 deletions py_cachify/backend/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,16 @@ def lock(key: str) -> Generator[None, None, None]:

def once(key: str, raise_on_locked: bool = False, return_on_locked: Any = None) -> SyncOrAsync:
@overload
def _decorator(
def _once_inner(
_func: Callable[P, Awaitable[R]],
) -> Callable[P, Awaitable[R]]: ...

@overload
def _decorator(
def _once_inner(
_func: Callable[P, R],
) -> Callable[P, R]: ...

def _decorator( # type: ignore[misc]
def _once_inner( # type: ignore[misc]
_func: Union[Callable[P, R], Callable[P, Awaitable[R]]],
) -> Union[Callable[P, R], Callable[P, Awaitable[R]]]:
signature = inspect.signature(_func)
Expand Down Expand Up @@ -103,7 +103,7 @@ def _sync_wrapper(*args: P.args, **kwargs: P.kwargs) -> Any:

return _sync_wrapper

return _decorator
return _once_inner


@deprecated('sync_once is deprecated, use once instead. Scheduled for removal in 1.3.0')
Expand Down

0 comments on commit 97cf47a

Please sign in to comment.