Add as_packages parameter to find_shortest_chain#187
Merged
seddonym merged 2 commits intopython-grimp:masterfrom Feb 11, 2025
Merged
Add as_packages parameter to find_shortest_chain#187seddonym merged 2 commits intopython-grimp:masterfrom
as_packages parameter to find_shortest_chain#187seddonym merged 2 commits intopython-grimp:masterfrom
Conversation
Peter554
commented
Feb 8, 2025
Comment on lines
-309
to
+310
| .find_shortest_chain(importer, imported, false)? | ||
| .find_shortest_chain(importer, imported, as_packages)? |
Collaborator
Author
There was a problem hiding this comment.
The implementation already supports it - we just need to pass the parameter through!
Peter554
commented
Feb 8, 2025
| @abc.abstractmethod | ||
| def find_shortest_chain(self, importer: str, imported: str) -> tuple[str, ...] | None: | ||
| def find_shortest_chain( | ||
| self, importer: str, imported: str, as_packages: bool = False |
Collaborator
Author
There was a problem hiding this comment.
Default to false ensures backwards compatibility.
CodSpeed Performance ReportMerging #187 will not alter performanceComparing Summary
|
seddonym
approved these changes
Feb 10, 2025
Collaborator
seddonym
left a comment
There was a problem hiding this comment.
👏🏻 Tiny tweak needed to docs but otherwise good to go.
| :param str importer: The module at the start of a potential chain of imports between ``importer`` and ``imported`` | ||
| (i.e. the module that potentially imports ``imported``, even indirectly). | ||
| :param str imported: The module at the end of the potential chain of imports. | ||
| :param bool as_packages: Whether to treat the supplied modules as individual modules, |
Collaborator
There was a problem hiding this comment.
We should add this to the signature on l. 219 too. (While we're at it, would you mind adding it to the signature of find_shortest_chains on l. 231, too? I missed that one.)
The implementation of the pathfinding already supports this, so let's add this to the public API.
ee16f7c to
633f81d
Compare
seddonym
approved these changes
Feb 11, 2025
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.
The implementation of the pathfinding already supports this, so let's add this to the public API!