bells.py 763 B

12345678910111213141516171819202122232425
  1. """
  2. Even more features than `tqdm.auto` (all the bells & whistles):
  3. - `tqdm.auto`
  4. - `tqdm.tqdm.pandas`
  5. - `tqdm.contrib.telegram`
  6. + uses `${TQDM_TELEGRAM_TOKEN}` and `${TQDM_TELEGRAM_CHAT_ID}`
  7. - `tqdm.contrib.discord`
  8. + uses `${TQDM_DISCORD_TOKEN}` and `${TQDM_DISCORD_CHANNEL_ID}`
  9. """
  10. __all__ = ['tqdm', 'trange']
  11. from os import getenv
  12. import warnings
  13. if getenv("TQDM_TELEGRAM_TOKEN") and getenv("TQDM_TELEGRAM_CHAT_ID"):
  14. from tqdm.contrib.telegram import tqdm, trange
  15. elif getenv("TQDM_DISCORD_TOKEN") and getenv("TQDM_DISCORD_CHANNEL_ID"):
  16. from tqdm.contrib.discord import tqdm, trange
  17. else:
  18. from tqdm.auto import tqdm, trange
  19. with warnings.catch_warnings():
  20. warnings.simplefilter("ignore", category=FutureWarning)
  21. tqdm.pandas()