I have a long-standing library function I cannot edit that runs a while loop and returns a value. In essence, something like this:
import time
def myfunc():
i = 0
while i < 5 * 1000:
i += 1
time.sleep(0.001)
return i
Is there a way I can wrap this function, perhaps in a decorator, in such a way that it can be passed to tqdm and spit out a progress bar? I'm not quite sure how I would achieve this since I cannot edit the code inside myfunc.
My goal is to make a progress bar for myfunc without touching it. Does anyone have any suggestsions?