-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
"""Retry object, with __call__, no param""" | ||
|
||
from kaioretry import retry | ||
|
||
@retry(exceptions=Exception, tries=1) | ||
def func(param1: int) -> float: | ||
""" one of """ | ||
return 1 / param1 | ||
|
||
|
||
def func2(param2: int) -> float: | ||
"""Anything using the first func""" | ||
return 3 + func(param2) | ||
|
||
|
||
if __name__ == "__main__": | ||
assert func(1) == 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
"""Retry object, with __call__, no param""" | ||
|
||
import asyncio | ||
from kaioretry import aioretry | ||
|
||
@aioretry(exceptions=Exception, tries=1) | ||
async def func(param1: int) -> float: | ||
""" one of """ | ||
return 1 / param1 | ||
|
||
|
||
async def func2(param2: int) -> float: | ||
"""Anything using the first func""" | ||
return 3 + await func(param2) | ||
|
||
|
||
if __name__ == "__main__": | ||
assert asyncio.run(func(1)) == 1 |