Skip to content
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

fix: correct the way to decide if keyring is available #11774

Merged
merged 3 commits into from
Feb 3, 2023

Conversation

frostming
Copy link
Contributor

@frostming frostming commented Feb 3, 2023

get_keyring_provider() will never return None, correct it to use the right check. This also goes along with:

        assert not isinstance(
            keyring, KeyRingNullProvider
        ), "should never reach here without keyring"

Comment on lines 361 to 364
def _should_save_password_to_keyring(self) -> bool:
if get_keyring_provider() is None:
if isinstance(get_keyring_provider(), KeyRingNullProvider):
return False
return ask("Save credentials to keyring [y/N]: ", ["y", "n"]) == "y"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should refactor this whole thing into the provider classes. Checking isinstance here feels like an anti-pattern.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated, but may need to suggest a better name

@pradyunsg pradyunsg merged commit 6a416d2 into pypa:main Feb 3, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 19, 2023
@frostming frostming deleted the fix/keyring branch March 4, 2023 08:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants