Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

task._progress change default_factory to create deque(maxlen=1000), t… #1926

Conversation

ptmcg
Copy link
Contributor

@ptmcg ptmcg commented Feb 6, 2022

…o avoid run-time while loop to trim to length 1000

Type of changes

  • Bug fix
  • New feature
  • Documentation / docstrings
  • Tests
  • Other - Performance

Checklist

  • I've run the latest black with default args on new code.
  • I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate.
  • I've added tests for new code.
  • I accept that @willmcgugan may be pedantic in the code review.

Description

Please describe your changes here. If this fixes a bug, please link to the issue, if possible.

Instead of explicitly looping over task._progress to trim down to 1000 items, declare _progress with a factory method lambda: deque(maxlen=1000) so that deque will do this work for you (presumably at C speed)

No change needed for CONTRIBUTORS.md. No change to CHANGELOG.md since this change is not externally visible.

…o avoid run-time while loop to trim to length 1000
@codecov-commenter
Copy link

codecov-commenter commented Feb 6, 2022

Codecov Report

Merging #1926 (e1c595c) into master (e839bfb) will decrease coverage by 0.01%.
The diff coverage is 99.01%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1926      +/-   ##
==========================================
- Coverage   99.82%   99.81%   -0.02%     
==========================================
  Files          71       71              
  Lines        6943     7033      +90     
==========================================
+ Hits         6931     7020      +89     
- Misses         12       13       +1     
Flag Coverage Δ
unittests 99.81% <99.01%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
rich/default_styles.py 100.00% <ø> (ø)
rich/markdown.py 100.00% <ø> (ø)
rich/syntax.py 99.27% <97.72%> (-0.34%) ⬇️
rich/pretty.py 99.71% <98.88%> (-0.29%) ⬇️
rich/__main__.py 100.00% <100.00%> (ø)
rich/_inspect.py 100.00% <100.00%> (ø)
rich/color.py 100.00% <100.00%> (ø)
rich/console.py 100.00% <100.00%> (ø)
rich/progress.py 98.35% <100.00%> (+0.23%) ⬆️
rich/segment.py 99.34% <100.00%> (+0.05%) ⬆️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 880693d...e1c595c. Read the comment docs.

@willmcgugan
Copy link
Collaborator

Thanks!

@willmcgugan willmcgugan merged commit 9dd56e0 into Textualize:master Feb 7, 2022
@ptmcg ptmcg deleted the ptmcg_task_progress_use_deque_with_maxlen branch February 7, 2022 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants