jquast / blessed

Blessed is an easy, practical library for making python terminal apps
http://pypi.python.org/pypi/blessed
MIT License
1.18k stars 71 forks source link

call length less in _wrap_chunks #274

Closed grayjk closed 2 months ago

grayjk commented 2 months ago

call Sequence.length/iter_parse fewer times

before:

         3117 function calls in 0.005 seconds

   Ordered by: cumulative time
   List reduced from 39 to 20 due to restriction <20>

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
        1    0.000    0.000    0.005    0.005 terminal.py:1215(wrap)
        1    0.000    0.000    0.005    0.005 textwrap.py:342(wrap)
        1    0.000    0.000    0.005    0.005 sequences.py:155(_wrap_chunks)
      777    0.004    0.000    0.004    0.000 sequences.py:431(iter_parse)

after

         2301 function calls in 0.004 seconds

   Ordered by: cumulative time
   List reduced from 39 to 20 due to restriction <20>

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
        1    0.000    0.000    0.004    0.004 terminal.py:1215(wrap)
        1    0.000    0.000    0.004    0.004 textwrap.py:342(wrap)
        1    0.000    0.000    0.004    0.004 sequences.py:155(_wrap_chunks)
      585    0.003    0.000    0.003    0.000 sequences.py:431(iter_parse)
codecov[bot] commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 95.12%. Comparing base (167c34e) to head (b718b68).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #274 +/- ## ========================================== - Coverage 95.31% 95.12% -0.20% ========================================== Files 9 9 Lines 1025 1025 Branches 216 216 ========================================== - Hits 977 975 -2 - Misses 44 46 +2 Partials 4 4 ```

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

avylove commented 2 months ago

Not sure what's up with codecov. It says rate limiting and the token size is 0. Is CODECOV_TOKEN still populated in secrets?

jquast commented 2 months ago

Yes I saw that... when I re-executed an individual test it was fine, but when I re-executed all it hit the rate limit again. CODECOV_TOKEN is in secrets, its three years old.

avylove commented 2 months ago

Could be because this repo is a fork, https://github.com/codecov/feedback/issues/358 Not sure if this fix will make it to v3 or but supposedly they changed v4 to use the token even on forks. Only issue with v4 is it won't work with 2.7. We could add a workaround in the CI config to use v3 for 2.7 and v4 for everything else. I'm getting tired of all these CI workarounds, but 2.7 still had 27k downloads in the last month. That's about 1% of the total downloads.

jquast commented 2 months ago

This change is incorporated and credited in #275, thanks @grayjk