diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2013-11-14 10:28:27 -0500 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2013-11-14 10:28:27 -0500 |
commit | 117a8a57a9a06521f028eb4e1afc1f6fd4dd8dc8 (patch) | |
tree | a6e0695a6535d15ad882a7c5383dfb407f44b842 /setuptools/package_index.py | |
parent | 113f55577768c9434b33b799521e4f70fdecd8de (diff) | |
download | external_python_setuptools-117a8a57a9a06521f028eb4e1afc1f6fd4dd8dc8.tar.gz external_python_setuptools-117a8a57a9a06521f028eb4e1afc1f6fd4dd8dc8.tar.bz2 external_python_setuptools-117a8a57a9a06521f028eb4e1afc1f6fd4dd8dc8.zip |
Construct the 'creds' dictionary directly rather than building imperatively.
Diffstat (limited to 'setuptools/package_index.py')
-rwxr-xr-x | setuptools/package_index.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/setuptools/package_index.py b/setuptools/package_index.py index 482ba38b..0a409604 100755 --- a/setuptools/package_index.py +++ b/setuptools/package_index.py @@ -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): """ |