Skip to content

Commit

Permalink
move gui deprecation warning to display()
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl committed Dec 20, 2020
1 parent 5b9961f commit 9882f7f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ classifiers =
Topic :: System :: Shells
Topic :: Terminals
Topic :: Utilities

[options]
setup_requires = setuptools>=42; setuptools_scm[toml]>=3.4
python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*
Expand Down
18 changes: 6 additions & 12 deletions tqdm/std.py
Original file line number Diff line number Diff line change
Expand Up @@ -1145,12 +1145,6 @@ def __iter__(self):
avg_time = self.avg_time
time = self._time

if getattr(self, 'sp', None) is None:
raise TqdmDeprecationWarning(
"Please use `tqdm.gui.tqdm(...)` instead of"
" `tqdm(..., gui=True)`\n",
fp_write=getattr(self.fp, 'write', sys.stderr.write))

try:
for obj in iterable:
yield obj
Expand Down Expand Up @@ -1253,12 +1247,6 @@ def update(self, n=1):
rate = delta_t / delta_it
self.avg_time = self.ema(rate, self.avg_time, self.smoothing)

if not hasattr(self, "sp"):
raise TqdmDeprecationWarning(
"Please use `tqdm.gui.tqdm(...)`"
" instead of `tqdm(..., gui=True)`\n",
fp_write=getattr(self.fp, 'write', sys.stderr.write))

self.refresh(lock_args=self.lock_args)

# If no `miniters` was specified, adjust automatically to the
Expand Down Expand Up @@ -1495,6 +1483,12 @@ def display(self, msg=None, pos=None):
if msg or msg is None: # override at `nrows - 1`
msg = " ... (more hidden) ..."

if not hasattr(self, "sp"):
raise TqdmDeprecationWarning(
"Please use `tqdm.gui.tqdm(...)`"
" instead of `tqdm(..., gui=True)`\n",
fp_write=getattr(self.fp, 'write', sys.stderr.write))

if pos:
self.moveto(pos)
self.sp(self.__repr__() if msg is None else msg)
Expand Down

0 comments on commit 9882f7f

Please sign in to comment.