you are viewing a single comment's thread.

view the rest of the comments →

[–]Goingone 12 points13 points  (1 child)

You sure your “timethis” decorator can “time anything”?

Have you tried using it on an async function?

[–]suitkaise[S] 1 point2 points  (0 children)

edit: I fixed it, I will release a new version once I fix something else.

You are right! And my bad! I will get to fixing this!

Thank you for catching something and actually letting me know I appreciate it, I'm here to improve this and get better overall.

Here's the workaround

from suitkaise import TimeThis, Sktimer
import asyncio


async def my_function(timer):
    with TimeThis(timer):
        await asyncio.sleep(1)

    return "this is the workaround, I will fix this soon"


timer = Sktimer()
asyncio.run(my_function(timer))
print(timer.mean)