-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
TMonitor warnings #523
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TMonitor warnings #523
Conversation
tqdm/_tqdm.py
Outdated
from warnings import warn | ||
warn("tqdm:disabling monitor support" | ||
" (monitor_interval = 0) due to:\n" + str(e), | ||
RuntimeWarning) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kalefranz you OK with this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd make a custom warning, so that it can be specifically disabled without disabling all RuntimeWarning
s.
class TqdmDisabledMonitorWarning(RuntimeWarning):
"""Warned when the tqdm update interval monitor is disabled because of system limitations."""
And then, in application code, I'd just import the warning, and add
warnings.simplefilter('ignore', TqdmDisabledMonitorWarning)
The alternative is forcing applications to disable all RuntimeWarning
which I don't think is what you want as a library author. By inheriting from RuntimeWarning
instead of just Warning
though, you allow users that flexibility if they want it.
Codecov Report
@@ Coverage Diff @@
## master #523 +/- ##
==========================================
+ Coverage 99.24% 99.24% +<.01%
==========================================
Files 7 8 +1
Lines 659 665 +6
Branches 117 117
==========================================
+ Hits 654 660 +6
Misses 3 3
Partials 2 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
TqdmMonitorWarning
and continue uponTMonitor
creation errors