Skip to content

Commit

Permalink
fixes #101
Browse files Browse the repository at this point in the history
  • Loading branch information
jph00 committed May 20, 2022
1 parent c538ab8 commit d7a9b27
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 51 deletions.
8 changes: 5 additions & 3 deletions fastprogress/fastprogress.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,9 @@ def update_graph(self, graphs, x_bounds=None, y_bounds=None, figsize=(6,4)):

# Cell
def printing():
return False if NO_BAR else (hasattr(stdout, 'isatty') and stdout.isatty() or IN_NOTEBOOK)
"`True` if we want to print progress"
if NO_BAR: return False
return getattr(stdout, 'isatty', False) or IN_NOTEBOOK or 'PYCHARM_HOSTED' in os.environ

# Cell
class ConsoleProgressBar(ProgressBar):
Expand Down Expand Up @@ -284,7 +286,7 @@ def write(self, line, table=False):
print_and_maybe_save(text)
else: print_and_maybe_save(line)
if self.total_time:
total_time = format_time(time.time() - self.start_t)
total_time = format_time(time() - self.start_t)
print_and_maybe_save(f'Total time: {total_time}')

def show_imgs(*args, **kwargs): pass
Expand All @@ -305,4 +307,4 @@ def force_console_behavior():
# Cell
def workaround_empty_console_output():
"Change console output behaviour to correctly show progress in consoles not recognizing \r at the end of line"
ConsoleProgressBar.end = ''
ConsoleProgressBar.end = ''
Loading

0 comments on commit d7a9b27

Please # to comment.