Repository navigation
Look up each module name without a package version only once - #767
Conversation
| def import_list(imported_packages): | ||
| for package in imported_packages: | ||
| if PackagesStore.get_package(package["name"]): | ||
| if package["name"] in packages_store: |
There was a problem hiding this comment.
The direct packages_store check in import_list is an unrelated rewrite of the existing get_package lookup and is not needed for miss caching.
Details
✨ AI Reasoning
The intended behavioral change is to remember names whose version lookup fails. The direct dictionary membership check in import_list does not implement that behavior; it replaces an existing lookup with equivalent internal access. That separate rewrite can be omitted while preserving the new miss-cache behavior.
🔧 How do I fix it?
Limit the change to what's needed to achieve its intent. Avoid bundling unrelated reformatting or refactoring, and don't rewrite code that didn't need to change.
Reply on this comment to give feedback or ignore the issue.
More info
There was a problem hiding this comment.
Intentional, for consistency: add_installed_package now checks packages_store directly, so import_list does the same. Behaviour is unchanged.
There was a problem hiding this comment.
⛔ You don't have permission to ignore issues.
Zen looks up the version of each imported package, but for names with no installed package (re, json, yaml) it found nothing and searched all of sys.path again on every import, about 50–70 µs each time. This remembers those names so each one is searched only once per process.