Repository navigation
refactor(pathfinder): look up site-packages sub-directories with a plain join - #3631
Conversation
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. Next included review available in 26 minutes. View limit details
No actionable comments were generated in the recent review. Summary
Change: Refactor Merge Risk:
|
|
…ain join `find_sub_dirs` walked each path part with a stack so that a `*` part could match any directory. None of the 259 site-packages directories in the five catalogs has a `*` part, so the walk only ever joined the parts and checked that the result is a directory. It now does exactly that. `find_sub_dirs_no_cache` is folded into `find_sub_dirs_cached`; the cache and the other two function names are unchanged. The private helper no longer treats `*` as a wildcard. The two wildcard tests are replaced by one that pins the new rule: every part is a literal name. No behavior change for any catalog entry. Old and new lookups agree on 9,840 lookups over 120 random directory trees (plain directories, files in the way, symlinks, dangling symlinks, missing parents). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Rob Parolin <rparolin@nvidia.com>
Signed-off-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
71f7017 to
0b2fb2b
Compare
— codex on behalf of Ralf —
Description
Part 22 of 23 of a readability stack for
cuda.pathfinder(stack: #3623 → #3602 → #3603 → #3604 → #3605 → #3606 → #3607 → #3608 → #3609 → #3610 → #3611 → #3613 → #3618 → #3619 → #3620 → #3621 → #3622 → #3627 → #3628 → #3629 → #3630 → #3631 → #3632). No behavior change.find_sub_dirswalked each path part with a stack so that a*part could match any directory. None of the 259 site-packages directories in the five catalogs has a*part, so the walk only ever joined the parts and checked that the result is a directory. It now does exactly that (61 -> 35 lines).find_sub_dirs_no_cacheis folded intofind_sub_dirs_cached. The cache and the other two function names are unchanged, so the tests that patchfind_sub_dirs_all_sitepackagesare untouched.One capability of this private helper goes away:
*is no longer a wildcard. The two wildcard tests are replaced by one that pins the new rule: every part is a literal name.No behavior change for any catalog entry. Checked beyond the test suite: the old and new lookups agree on 9,840 lookups over 120 random directory trees (plain directories, files in the way, symlinks, dangling symlinks, missing parents).
Testing
cuda_pathfindertest suite at this commit: 1298 passed, 6 skipped (Linux, Python 3.14).mypy-pathfinder. mypy also passes with--platform win32.mainare still byte-identical (Linux, simulated Windows x64 and arm64), and all 526 public-API scenarios give the same result as fix(pathfinder): check for an already-loaded library before searching the disk #3623.PLC Local Security Evidence (Advisory)
Local advisory checks only, run over the whole stack. Not release-gate results.
subprocess.runcall in the canary probe, now incanary_probe.pyChecklist
🤖 Generated with Claude Code