-
-
Notifications
You must be signed in to change notification settings - Fork 421
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
Extract the logic of finding interpreters to a method #326
Conversation
@@ -515,3 +516,25 @@ def make_candidate_info_cache(self) -> CandidateInfoCache: | |||
|
|||
def make_hash_cache(self) -> HashCache: | |||
return HashCache(directory=self.cache("hashes").as_posix()) | |||
|
|||
def find_interpreters(self, python_spec: str) -> Iterable[str]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why return a str
here instead of a Path
?
@@ -417,7 +417,7 @@ def do_use(project: Project, python: str, first: bool = False) -> None: | |||
The python can be a version string or interpreter path. | |||
""" | |||
python = python.strip() | |||
found_interpreters = list(project.find_interpreters(python)) | |||
found_interpreters = list(dict.fromkeys(project.find_interpreters(python))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
found_interpreters = set(project.find_interpreters(python))
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, the difference is dict.fromkeys()
preserves the order while set
doesn't.
Pull Request Check List
news/
describing what is new.Describe what you have changed in this PR.
As title