Cereja is a bundle of useful functions we don't want to rewrite and .. just pure fun!
See the progress of an iteration in a simple way
import cereja as cj
import time
my_iterable = ['Cereja', 'is', 'very', 'easy']
for i in cj.Progress.prog(my_iterable):
print(f"current: {i}")
time.sleep(2)
# Output on terminal ...
# 🍒 Sys[out] » current: Cereja
# 🍒 Sys[out] » current: is
# 🍒 Cereja Progress » [▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▱▱▱▱▱▱▱▱▱▱▱▱▱▱] - 50.00% - 🕢 00:00:02 estimated
import cereja as cj
import time
progress = cj.Progress("My Progress")
print(progress)
print(progress[0])
print(progress[1])
print(progress[2])
class MyCustomState(cj.display.State):
def display(self, current_value, max_value, *args, **kwargs):
return f'{current_value} -> {max_value}'
def done(self, *args, **kwargs):
return f'FINISHED'
progress[0] = MyCustomState
for i in progress(range(1, 500)):
time.sleep(1 / i)
import cereja as cj
import time
with cj.Progress("My Progress") as prog:
time.sleep(5)
for i in prog(range(1, 500)):
time.sleep(1 / i)
for i in prog(range(1, 500)):
time.sleep(1 / i)