Commit 117a8a57 authored by Jason R. Coombs's avatar Jason R. Coombs

Construct the 'creds' dictionary directly rather than building imperatively.

parent 113f5557
......@@ -949,20 +949,19 @@ class PyPirc(ConfigParser.ConfigParser):
@property
def creds_by_repository(self):
creds = {}
sections_with_repositories = [
section for section in self.sections()
if self.get(section, 'repository').strip()
]
for section in sections_with_repositories:
cred = Credential(
self.get(section, 'username').strip(),
self.get(section, 'password').strip(),
)
repo = self.get(section, 'repository').strip()
creds[repo] = cred
return creds
return dict(map(self._get_repo_cred, sections_with_repositories))
def _get_repo_cred(self, section):
repo = self.get(section, 'repository').strip()
return repo, Credential(
self.get(section, 'username').strip(),
self.get(section, 'password').strip(),
)
def find_credential(self, url):
"""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment