Skip to content

Commit

Permalink
feat: use ParamSpec for wrap args
Browse files Browse the repository at this point in the history
  • Loading branch information
BobTheBuidler authored Apr 3, 2023
1 parent 2be6122 commit 1b2b82a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions eth_retry/eth_retry.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from json import JSONDecodeError
from random import randrange
from time import sleep
from typing import Any, Awaitable, Callable, TypeVar, Union, overload
from typing import Awaitable, Callable, TypeVar, Union, overload

import requests

Expand Down Expand Up @@ -58,7 +58,7 @@ def auto_retry(func: Function[P, T]) -> Function[P, T]:
'''

@functools.wraps(func)
def auto_retry_wrap(*args: Any, **kwargs: Any) -> T:
def auto_retry_wrap(*args: P.args, **kwargs: P.kwargs) -> T:
sleep_time = randrange(MIN_SLEEP_TIME,MAX_SLEEP_TIME)
failures = 0
while True:
Expand All @@ -75,7 +75,7 @@ def auto_retry_wrap(*args: Any, **kwargs: Any) -> T:
sleep(failures * sleep_time)

@functools.wraps(func)
async def auto_retry_wrap_async(*args: Any, **kwargs: Any) -> T:
async def auto_retry_wrap_async(*args: P.args, **kwargs: P.kwargs) -> T:
sleep_time = randrange(MIN_SLEEP_TIME,MAX_SLEEP_TIME)
failures = 0
while True:
Expand Down

0 comments on commit 1b2b82a

Please sign in to comment.