mirror of https://github.com/tqdm/tqdm.git
tidy,flake8
This commit is contained in:
parent
47df7d6d1b
commit
34457bd2b0
|
@ -105,9 +105,9 @@ class tqdm_notebook(tqdm):
|
|||
# Only way to place text to the right of the bar is to use a container
|
||||
container = HBox(children=[pbar, ptext])
|
||||
# Prepare layout
|
||||
if ncols is not None: # if ncols is None, use default style of ipywidgets
|
||||
if ncols is not None: # use default style of ipywidgets
|
||||
# ncols could be 100, "100px", "100%"
|
||||
ncols = str(ncols) # ipywidgets only accepts string,
|
||||
ncols = str(ncols) # ipywidgets only accepts string
|
||||
if ncols[-1].isnumeric():
|
||||
# if last value is digit, assume the value is digit
|
||||
ncols += 'px'
|
||||
|
@ -185,12 +185,11 @@ class tqdm_notebook(tqdm):
|
|||
# self.sp('', close=True)
|
||||
|
||||
# Get bar width
|
||||
self.ncols = kwargs.get('ncols', None)
|
||||
if self.dynamic_ncols:
|
||||
self.ncols = '100%'
|
||||
self.ncols = '100%' if self.dynamic_ncols else kwargs.get("ncols", None)
|
||||
|
||||
# Replace with IPython progress bar display (with correct total)
|
||||
self.sp = self.status_printer(self.fp, self.total, self.desc, self.ncols)
|
||||
self.sp = self.status_printer(
|
||||
self.fp, self.total, self.desc, self.ncols)
|
||||
self.desc = None # trick to place description before the bar
|
||||
|
||||
# Print initial bar state
|
||||
|
@ -203,7 +202,7 @@ class tqdm_notebook(tqdm):
|
|||
# return super(tqdm...) will not catch exception
|
||||
yield obj
|
||||
# NB: except ... [ as ...] breaks IPython async KeyboardInterrupt
|
||||
except:
|
||||
except: # NOQA
|
||||
self.sp(bar_style='danger')
|
||||
raise
|
||||
|
||||
|
|
Loading…
Reference in New Issue