bells.py 837 B

1234567891011121314151617181920212223242526
  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. import warnings
  12. from os import getenv
  13. if getenv("TQDM_SLACK_TOKEN") and getenv("TQDM_SLACK_CHANNEL"):
  14. from .slack import tqdm, trange
  15. elif getenv("TQDM_TELEGRAM_TOKEN") and getenv("TQDM_TELEGRAM_CHAT_ID"):
  16. from .telegram import tqdm, trange
  17. elif getenv("TQDM_DISCORD_TOKEN") and getenv("TQDM_DISCORD_CHANNEL_ID"):
  18. from .discord import tqdm, trange
  19. else:
  20. from ..auto import tqdm, trange
  21. with warnings.catch_warnings():
  22. warnings.simplefilter("ignore", category=FutureWarning)
  23. tqdm.pandas()