PEP-8 compliance
- fix all PEP-8 warnings - bump copyright years
This commit is contained in:
parent
e643987d3d
commit
6224abdf63
16 changed files with 164 additions and 128 deletions
|
@ -2,7 +2,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# DDPortfolio service form handling model
|
||||
# Copyright © 2009, 2010 Jan Dittberner <jan@dittberner.info>
|
||||
# Copyright © 2009, 2010, 2011, 2012 Jan Dittberner <jan@dittberner.info>
|
||||
#
|
||||
# This file is part of DDPortfolio service.
|
||||
#
|
||||
|
@ -22,6 +22,7 @@
|
|||
#
|
||||
import formencode
|
||||
|
||||
|
||||
class DeveloperData(formencode.Schema):
|
||||
"""Validation schema for DeveloperData."""
|
||||
allow_extra_fields = True
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# DDPortfolio service key finder module
|
||||
# Copyright (c) 2009 Jan Dittberner <jan@dittberner.info>
|
||||
# Copyright (c) 2009, 2010, 2011, 2012 Jan Dittberner <jan@dittberner.info>
|
||||
#
|
||||
# This file is part of DDPortfolio service.
|
||||
#
|
||||
|
@ -30,6 +30,7 @@ import time
|
|||
db = None
|
||||
cachetimestamp = 0
|
||||
|
||||
|
||||
def _get_keyring_cache():
|
||||
global db, cachetimestamp
|
||||
if db is None or (time.time() - cachetimestamp) > 86300:
|
||||
|
@ -44,6 +45,7 @@ def _get_keyring_cache():
|
|||
cachetimestamp = time.time()
|
||||
return db
|
||||
|
||||
|
||||
def _get_cached(cachekey):
|
||||
cache = _get_keyring_cache()
|
||||
logging.debug('cache lookup for %s', cachekey)
|
||||
|
@ -52,25 +54,33 @@ def _get_cached(cachekey):
|
|||
return cache[cachekey]
|
||||
return None
|
||||
|
||||
|
||||
def getFingerprintByEmail(email):
|
||||
"""Gets the fingerprints associated with the given email address
|
||||
if available."""
|
||||
"""
|
||||
Gets the fingerprints associated with the given email address if
|
||||
available.
|
||||
"""
|
||||
return _get_cached('fpr:email:%s' % email)
|
||||
|
||||
|
||||
def getRealnameByEmail(email):
|
||||
"""Gets the real names associated with the given email address if
|
||||
available."""
|
||||
"""
|
||||
Gets the real names associated with the given email address if
|
||||
available.
|
||||
"""
|
||||
return _get_cached('name:email:%s' % email)
|
||||
|
||||
|
||||
def getLoginByEmail(email):
|
||||
"""Gets the logins associated with the given email address if
|
||||
available."""
|
||||
"""
|
||||
Gets the logins associated with the given email address if
|
||||
available.
|
||||
"""
|
||||
return _get_cached('login:email:%s' % email)
|
||||
|
||||
|
||||
def getLoginByFingerprint(fpr):
|
||||
"""Gets the login associated with the given fingerprint if
|
||||
available."""
|
||||
"""
|
||||
Gets the login associated with the given fingerprint if available.
|
||||
"""
|
||||
return _get_cached('login:fpr:%s' % fpr)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# DDPortfolio service application key ring analyzer tool
|
||||
# Copyright © 2009, 2010 Jan Dittberner <jan@dittberner.info>
|
||||
# Copyright © 2009, 2010, 2011, 2012 Jan Dittberner <jan@dittberner.info>
|
||||
#
|
||||
# This file is part of DDPortfolio service.
|
||||
#
|
||||
|
@ -38,10 +38,13 @@ import sys
|
|||
|
||||
|
||||
def _get_keyrings():
|
||||
"""Gets the available keyring files from the keyring directory
|
||||
configured in ddportfolio.ini."""
|
||||
"""
|
||||
Gets the available keyring files from the keyring directory
|
||||
configured in ddportfolio.ini.
|
||||
"""
|
||||
my_config = ConfigParser.ConfigParser()
|
||||
my_config.readfp(pkg_resources.resource_stream(__name__, 'ddportfolio.ini'))
|
||||
my_config.readfp(pkg_resources.resource_stream(
|
||||
__name__, 'ddportfolio.ini'))
|
||||
keyringdir = os.path.expanduser(my_config.get('DEFAULT', 'keyring.dir'))
|
||||
logging.debug("keyring dir is %s", keyringdir)
|
||||
keyrings = glob.glob(os.path.join(keyringdir, '*.gpg'))
|
||||
|
@ -51,20 +54,22 @@ def _get_keyrings():
|
|||
|
||||
|
||||
def _parse_uid(uid):
|
||||
"""Parse a uid of the form 'Real Name <email@example.com>' into
|
||||
email and realname parts."""
|
||||
"""
|
||||
Parse a uid of the form 'Real Name <email@example.com>' into email
|
||||
and realname parts.
|
||||
"""
|
||||
uid = uid.strip()
|
||||
# First, strip comment
|
||||
# First, strip comment
|
||||
s = uid.find('(')
|
||||
e = uid.find(')')
|
||||
if s >= 0 and e >= 0:
|
||||
uid = uid[:s] + uid[e+1:]
|
||||
uid = uid[:s] + uid[e + 1:]
|
||||
s = uid.find('<')
|
||||
e = uid.find('>')
|
||||
email = None
|
||||
if s >= 0 and e >= 0:
|
||||
email = uid[s+1:e]
|
||||
uid = uid[:s] + uid[e+1:]
|
||||
email = uid[s + 1:e]
|
||||
uid = uid[:s] + uid[e + 1:]
|
||||
uid = uid.strip()
|
||||
if not email and uid.find('@') >= 0:
|
||||
email, uid = uid, email
|
||||
|
@ -72,6 +77,7 @@ def _parse_uid(uid):
|
|||
|
||||
resultdict = {}
|
||||
|
||||
|
||||
def _get_canonical(key):
|
||||
if not key in resultdict:
|
||||
resultdict[key] = []
|
||||
|
@ -96,7 +102,7 @@ def process_keyrings():
|
|||
stdout=subprocess.PIPE)
|
||||
fpr = None
|
||||
entry = None
|
||||
lastpub = None
|
||||
lastpub = None
|
||||
for line in proc.stdout.readlines():
|
||||
items = line.split(':')
|
||||
uid = None
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# -*- coding: utf8 -*-
|
||||
#
|
||||
# DDPortfolio service url builder
|
||||
# Copyright © 2009, 2010, 2012 Jan Dittberner <jan@dittberner.info>
|
||||
# Copyright © 2009, 2010, 2011, 2012 Jan Dittberner <jan@dittberner.info>
|
||||
#
|
||||
# This file is part of DDPortfolio service.
|
||||
#
|
||||
|
@ -37,12 +37,12 @@ my_config = ConfigParser()
|
|||
my_config.readfp(pkg_resources.resource_stream(__name__, 'ddportfolio.ini'))
|
||||
|
||||
_FIELDNAMES_MAP = {
|
||||
'email' : N_('Email address'),
|
||||
'name' : N_('Name'),
|
||||
'gpgfp' : N_('GPG fingerprint'),
|
||||
'username' : N_('Debian user name'),
|
||||
'nonddemail' : N_('Non Debian email address'),
|
||||
'aliothusername' : N_('Alioth user name'),
|
||||
'email': N_('Email address'),
|
||||
'name': N_('Name'),
|
||||
'gpgfp': N_('GPG fingerprint'),
|
||||
'username': N_('Debian user name'),
|
||||
'nonddemail': N_('Non Debian email address'),
|
||||
'aliothusername': N_('Alioth user name'),
|
||||
}
|
||||
|
||||
|
||||
|
@ -82,8 +82,9 @@ def build_urls(fields):
|
|||
'urlbuilder.sections').split(',')]:
|
||||
data.append(['section', section])
|
||||
if my_config.has_option(section, 'urls'):
|
||||
for entry in ([DDPortfolioEntry(my_config, section, url) for url in \
|
||||
my_config.get(section, 'urls').split(',')]):
|
||||
for entry in ([
|
||||
DDPortfolioEntry(my_config, section, url) for url in \
|
||||
my_config.get(section, 'urls').split(',')]):
|
||||
try:
|
||||
data.append(
|
||||
['url', section, entry,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue