chore: remove unreachable pre-3.5 recursive glob code#27
Merged
Conversation
search_glob() guarded its modern path with `if sys.version_info >= (3, 5)`, always true on this project (Python 3.10+). The else branch and the _pre_3_5_recursive_glob() helper it called (~65 lines) were therefore dead. Simplify search_glob() to call glob.glob() directly, drop the helper, and remove the now-unused `import sys`. No behaviour change — the kept path is the one that already ran; existing search_glob tests (non-recursive and recursive **) cover it. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Removes dead code in
src/utils/file_utils.py.search_glob()guarded its modern implementation withif sys.version_info >= (3, 5), which is always true on this project (Python 3.10+). Theelsebranch and the_pre_3_5_recursive_glob()helper it called (~65 lines) were unreachable.Changes
search_glob()to callglob.glob(path_pattern, recursive=recursive)directly._pre_3_5_recursive_glob()helper.import sys.Why
Pure dead-code removal — the kept path is exactly the one that already ran, so there is no behaviour change. Also trims ~65 lines from the coverage denominator.
Testing
pytest src/tests/— 1737 passed. Existingsearch_globtests infile_utils_extra_test.py(non-recursive*.txtand recursive**/*.txt) exercise the retained path._pre_3_5_recursive_globorsysin the file.🤖 Generated with Claude Code