Skip to content

Commit

Permalink
Respect stripzeros in summary report
Browse files Browse the repository at this point in the history
  • Loading branch information
Erotemic committed Apr 28, 2024
1 parent 9db4f5a commit f5f3c0e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Changes

4.1.3
~~~~~
* FIX: duration summary now respects the stripzeros argument.

4.1.2
~~~~~
Expand All @@ -15,7 +16,7 @@ Changes
* FIX: ``get_stats`` is no longer slowed down when profiling many code sections #236

4.1.0
~~~~
~~~~~
* FIX: skipzeros now checks for zero hits instead of zero time
* FIX: Fixed errors in Python 3.11 with duplicate functions.
* FIX: ``show_text`` now increases column sizes or switches to scientific notation to maintain alignment
Expand Down
5 changes: 3 additions & 2 deletions line_profiler/line_profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,8 +467,9 @@ def show_text(stats, unit, output_unit=None, stream=None, stripzeros=False,
# Summarize the total time for each function
for (fn, lineno, name), timings in stats_order:
total_time = sum(t[2] for t in timings) * unit
line = '%6.2f seconds - %s:%s - %s\n' % (total_time, fn, lineno, name)
stream.write(line)
if not stripzeros or total_time:
line = '%6.2f seconds - %s:%s - %s\n' % (total_time, fn, lineno, name)
stream.write(line)


def load_stats(filename):
Expand Down

0 comments on commit f5f3c0e

Please sign in to comment.