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

Add equality operator to EnvironCredential #549

Merged
merged 4 commits into from Nov 28, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions keyring/credentials.py
Expand Up @@ -39,6 +39,15 @@ def __init__(self, user_env_var, pwd_env_var):
self.user_env_var = user_env_var
self.pwd_env_var = pwd_env_var

def __eq__(self, other: object) -> bool:
if not isinstance(other, EnvironCredential):
return NotImplemented

return (
self.user_env_var == other.user_env_var
and self.pwd_env_var == other.pwd_env_var
)
jaraco marked this conversation as resolved.
Show resolved Hide resolved

def _get_env(self, env_var):
"""Helper to read an environment variable"""
value = os.environ.get(env_var)
Expand Down