diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2013-11-14 09:35:20 -0500 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2013-11-14 09:35:20 -0500 |
commit | 3822e3e7ad8cda5012b602f7e8f52cdd44665dd3 (patch) | |
tree | 6e1c1aa615c5596c7d29e8d8de7a284e8aa42f67 /setuptools/package_index.py | |
parent | 2e0ef2a83c7e662b1bd48926c1dc82bc44aa5efd (diff) | |
download | external_python_setuptools-3822e3e7ad8cda5012b602f7e8f52cdd44665dd3.tar.gz external_python_setuptools-3822e3e7ad8cda5012b602f7e8f52cdd44665dd3.tar.bz2 external_python_setuptools-3822e3e7ad8cda5012b602f7e8f52cdd44665dd3.zip |
Delint syntax
--HG--
extra : amend_source : 0f58aa917ebc71efd2904638fac3838fd0b0e4dd
Diffstat (limited to 'setuptools/package_index.py')
-rwxr-xr-x | setuptools/package_index.py | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/setuptools/package_index.py b/setuptools/package_index.py index ca228997..a0bb936d 100755 --- a/setuptools/package_index.py +++ b/setuptools/package_index.py @@ -920,29 +920,29 @@ def _encode_auth(auth): # strip the trailing carriage return return encoded.rstrip() -class PyPirc: +class PyPirc(object): def __init__(self): """ - Extract pypirc authentication information from home directory + Extract pypirc authentication information from home directory """ self.dict_ = {} - if os.environ.has_key('HOME'): + if 'HOME' in os.environ: rc = os.path.join(os.environ['HOME'], '.pypirc') if os.path.exists(rc): config = ConfigParser.ConfigParser({ - 'username' : '', - 'password' : '', - 'repository' : ''}) + 'username': '', + 'password': '', + 'repository': ''}) config.read(rc) for section in config.sections(): if config.get(section, 'repository').strip(): - value = '%s:%s'%(config.get(section, 'username').strip(), + value = '%s:%s' % (config.get(section, 'username').strip(), config.get(section, 'password').strip()) self.dict_[config.get(section, 'repository').strip()] = value - + def __call__(self, url): """ """ for base_url, auth in self.dict_.items(): @@ -950,7 +950,6 @@ class PyPirc: return auth - def open_with_auth(url, opener=urllib2.urlopen): """Open a urllib2 request, handling HTTP authentication""" @@ -968,7 +967,7 @@ def open_with_auth(url, opener=urllib2.urlopen): if not auth: auth = PyPirc()(url) - log.info('Authentication found for URL: %s'%url) + log.info('Authentication found for URL: %s' % url) if auth: auth = "Basic " + _encode_auth(auth) |