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

Improve extract performance via ignoring directories early during os.walk #968

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

akx
Copy link
Member

@akx akx commented Feb 7, 2023

Closes #694 (rebases and reimplements it)

@codecov
Copy link

codecov bot commented Feb 7, 2023

Codecov Report

Attention: Patch coverage is 92.85714% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 90.87%. Comparing base (e0d1018) to head (fc8fca4).
Report is 1 commits behind head on master.

❗ Current head fc8fca4 differs from pull request most recent head b5c2f1c. Consider uploading reports for the commit b5c2f1c to get more accurate results

Files Patch % Lines
babel/messages/extract.py 92.85% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #968      +/-   ##
==========================================
- Coverage   90.99%   90.87%   -0.13%     
==========================================
  Files          26       25       -1     
  Lines        4444     4341     -103     
==========================================
- Hits         4044     3945      -99     
+ Misses        400      396       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@akx akx marked this pull request as ready for review February 16, 2023 19:10
@akx
Copy link
Member Author

akx commented Feb 20, 2023

@DenverCoder1 If you have a moment, could you review this? :)

@DenverCoder1
Copy link
Contributor

Looks good to me (I haven't tested)

I noticed a similar method in frontend.py -

def _make_directory_filter(ignore_patterns):
"""
Build a directory_filter function based on a list of ignore patterns.
"""
def cli_directory_filter(dirname):
basename = os.path.basename(dirname)
return not any(
fnmatch.fnmatch(basename, ignore_pattern)
for ignore_pattern
in ignore_patterns
)
return cli_directory_filter
- it seems to not need to create relative paths there, but maybe it's different. Possibly some logic could be combined or renamed to be consistent, but besides that, it seems like this should work.

@akx akx marked this pull request as draft February 28, 2023 06:59
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.

2 participants