bloomberg / memray

Memray is a memory profiler for Python
https://bloomberg.github.io/memray/
Apache License 2.0
13.17k stars 392 forks source link

Fix a bug causing empty `summary` reports #435

Closed godlygeek closed 1 year ago

godlygeek commented 1 year ago

Our TUI's update_snapshot method declares that it accepts any iterable, but it expects to be able to iterate over the snapshot repeatedly, which means that it does not accept generators or other iterators that can only be iterated once.

Update its type annotation to require a sequence instead of an iterable, and update the caller that was providing a generator to instead provide a sequence.

Closes #434

codecov-commenter commented 1 year ago

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.07% :tada:

Comparison is base (d853623) 91.64% compared to head (9b59af0) 91.72%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #435 +/- ## ========================================== + Coverage 91.64% 91.72% +0.07% ========================================== Files 90 90 Lines 10523 10524 +1 Branches 1446 1446 ========================================== + Hits 9644 9653 +9 + Misses 876 868 -8 Partials 3 3 ``` | Flag | Coverage Δ | | |---|---|---| | cpp | `85.20% <ø> (+0.21%)` | :arrow_up: | | python_and_cython | `95.18% <100.00%> (+<0.01%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bloomberg#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files Changed](https://app.codecov.io/gh/bloomberg/memray/pull/435?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bloomberg) | Coverage Δ | | |---|---|---| | [src/memray/\_version.py](https://app.codecov.io/gh/bloomberg/memray/pull/435?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bloomberg#diff-c3JjL21lbXJheS9fdmVyc2lvbi5weQ==) | `100.00% <100.00%> (ø)` | | | [src/memray/reporters/summary.py](https://app.codecov.io/gh/bloomberg/memray/pull/435?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bloomberg#diff-c3JjL21lbXJheS9yZXBvcnRlcnMvc3VtbWFyeS5weQ==) | `100.00% <100.00%> (ø)` | | | [src/memray/reporters/tui.py](https://app.codecov.io/gh/bloomberg/memray/pull/435?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bloomberg#diff-c3JjL21lbXJheS9yZXBvcnRlcnMvdHVpLnB5) | `98.85% <100.00%> (+<0.01%)` | :arrow_up: | ... and [3 files with indirect coverage changes](https://app.codecov.io/gh/bloomberg/memray/pull/435/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bloomberg)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.