提交 903e5be1 编写于 作者: B Bastian Blank 提交者: Joerg Jaspert

Fix E225: Missing whitespace around operator

上级 e7e0e754
...@@ -100,7 +100,7 @@ def main(): ...@@ -100,7 +100,7 @@ def main():
name = n.group(1) name = n.group(1)
# Look for all email addresses on the key. # Look for all email addresses on the key.
emails=[] emails = []
for line in output.split('\n'): for line in output.split('\n'):
e = re_user_mails.search(line) e = re_user_mails.search(line)
if not e: if not e:
...@@ -134,7 +134,7 @@ def main(): ...@@ -134,7 +134,7 @@ def main():
# Should we send mail to the newly added user? # Should we send mail to the newly added user?
if Cnf.find_b("Add-User::SendEmail"): if Cnf.find_b("Add-User::SendEmail"):
mail = name + "<" + emails[0] +">" mail = name + "<" + emails[0] + ">"
Subst = {} Subst = {}
Subst["__NEW_MAINTAINER__"] = mail Subst["__NEW_MAINTAINER__"] = mail
Subst["__UID__"] = uid Subst["__UID__"] = uid
......
...@@ -100,7 +100,7 @@ class BugClassifier(object): ...@@ -100,7 +100,7 @@ class BugClassifier(object):
tagged_bugs_ftp += tagged_bugs[tags] tagged_bugs_ftp += tagged_bugs[tags]
return [bug for bug in bts.get_status(bts.get_bugs("package", "ftp.debian.org")) \ return [bug for bug in bts.get_status(bts.get_bugs("package", "ftp.debian.org")) \
if bug.pending=='pending' and bug.bug_num not in tagged_bugs_ftp] if bug.pending == 'pending' and bug.bug_num not in tagged_bugs_ftp]
def classify_bug(self, bug): def classify_bug(self, bug):
""" """
...@@ -173,13 +173,13 @@ def main(): ...@@ -173,13 +173,13 @@ def main():
sys.exit(0) sys.exit(0)
if Options["Quiet"]: if Options["Quiet"]:
level=logging.ERROR level = logging.ERROR
elif Options["Verbose"]: elif Options["Verbose"]:
level=logging.DEBUG level = logging.DEBUG
else: else:
level=logging.INFO level = logging.INFO
logging.basicConfig(level=level, logging.basicConfig(level=level,
format='%(asctime)s %(levelname)s %(message)s', format='%(asctime)s %(levelname)s %(message)s',
......
...@@ -186,7 +186,7 @@ class Updates: ...@@ -186,7 +186,7 @@ class Updates:
x = read_hashs(2,2,f,self) x = read_hashs(2,2,f,self)
continue continue
if l[0] == "Canonical-Name:" or l[0]=="Canonical-Path:": if l[0] == "Canonical-Name:" or l[0] == "Canonical-Path:":
self.can_path = l[1] self.can_path = l[1]
if l[0] == "SHA1-Current:" and len(l) == 3: if l[0] == "SHA1-Current:" and len(l) == 3:
...@@ -318,7 +318,7 @@ def genchanges(Options, outdir, oldfile, origfile, maxdiffs=56): ...@@ -318,7 +318,7 @@ def genchanges(Options, outdir, oldfile, origfile, maxdiffs=56):
# print "info: old file " + oldfile + " changed! %s %s => %s %s" % (upd.filesizesha1 + oldsizesha1) # print "info: old file " + oldfile + " changed! %s %s => %s %s" % (upd.filesizesha1 + oldsizesha1)
if "CanonicalPath" in Options: if "CanonicalPath" in Options:
upd.can_path=Options["CanonicalPath"] upd.can_path = Options["CanonicalPath"]
if os.path.exists(newfile): if os.path.exists(newfile):
os.unlink(newfile) os.unlink(newfile)
...@@ -427,7 +427,7 @@ def main(): ...@@ -427,7 +427,7 @@ def main():
cwd = os.getcwd() cwd = os.getcwd()
for component in components: for component in components:
#print "DEBUG: Working on %s" % (component) #print "DEBUG: Working on %s" % (component)
workpath=os.path.join(tree, component, "i18n") workpath = os.path.join(tree, component, "i18n")
if os.path.isdir(workpath): if os.path.isdir(workpath):
os.chdir(workpath) os.chdir(workpath)
for dirpath, dirnames, filenames in os.walk(".", followlinks=True, topdown=True): for dirpath, dirnames, filenames in os.walk(".", followlinks=True, topdown=True):
...@@ -436,9 +436,9 @@ def main(): ...@@ -436,9 +436,9 @@ def main():
#print "EXCLUDING %s" % (entry) #print "EXCLUDING %s" % (entry)
continue continue
(fname, fext) = os.path.splitext(entry) (fname, fext) = os.path.splitext(entry)
processfile=os.path.join(workpath, fname) processfile = os.path.join(workpath, fname)
#print "Working: %s" % (processfile) #print "Working: %s" % (processfile)
storename="%s/%s_%s_%s" % (Options["TempDir"], suite, component, fname) storename = "%s/%s_%s_%s" % (Options["TempDir"], suite, component, fname)
#print "Storefile: %s" % (storename) #print "Storefile: %s" % (storename)
genchanges(Options, processfile + ".diff", storename, processfile, maxdiffs) genchanges(Options, processfile + ".diff", storename, processfile, maxdiffs)
os.chdir(cwd) os.chdir(cwd)
......
...@@ -322,7 +322,7 @@ class ReleaseWriter(object): ...@@ -322,7 +322,7 @@ class ReleaseWriter(object):
out.write("Date: %s\n" % (time.strftime("%a, %d %b %Y %H:%M:%S UTC", time.gmtime(time.time())))) out.write("Date: %s\n" % (time.strftime("%a, %d %b %Y %H:%M:%S UTC", time.gmtime(time.time()))))
if suite.validtime: if suite.validtime:
validtime=float(suite.validtime) validtime = float(suite.validtime)
out.write("Valid-Until: %s\n" % (time.strftime("%a, %d %b %Y %H:%M:%S UTC", time.gmtime(time.time()+validtime)))) out.write("Valid-Until: %s\n" % (time.strftime("%a, %d %b %Y %H:%M:%S UTC", time.gmtime(time.time()+validtime))))
for key, dbfield in boolattrs: for key, dbfield in boolattrs:
...@@ -493,7 +493,7 @@ def main(): ...@@ -493,7 +493,7 @@ def main():
query = query.join(Suite.archive).filter(Archive.archive_name.in_(archive_names)) query = query.join(Suite.archive).filter(Archive.archive_name.in_(archive_names))
suites = query.all() suites = query.all()
broken=[] broken = []
for s in suites: for s in suites:
# Setup a multiprocessing Pool. As many workers as we have CPU cores. # Setup a multiprocessing Pool. As many workers as we have CPU cores.
......
...@@ -145,11 +145,11 @@ def main(): ...@@ -145,11 +145,11 @@ def main():
if Options['Help']: if Options['Help']:
usage() usage()
changesfiles={} changesfiles = {}
for a in changes_files: for a in changes_files:
if not a.endswith(".changes"): if not a.endswith(".changes"):
utils.fubar("not a .changes file: %s" % (a)) utils.fubar("not a .changes file: %s" % (a))
changesfiles[a]=1 changesfiles[a] = 1
changes = changesfiles.keys() changes = changesfiles.keys()
username = utils.getusername() username = utils.getusername()
...@@ -176,16 +176,16 @@ def main(): ...@@ -176,16 +176,16 @@ def main():
# Yes, we could do this inside do_Approve too. But this way we see who exactly # Yes, we could do this inside do_Approve too. But this way we see who exactly
# called it (ownership of the file) # called it (ownership of the file)
acceptfiles={} acceptfiles = {}
for change in changes: for change in changes:
dbchange=get_dbchange(os.path.basename(change), session) dbchange = get_dbchange(os.path.basename(change), session)
# strip epoch from version # strip epoch from version
version=dbchange.version version = dbchange.version
version=version[(version.find(':')+1):] version = version[(version.find(':')+1):]
# strip possible version from source (binNMUs) # strip possible version from source (binNMUs)
source = dbchange.source.split(None, 1)[0] source = dbchange.source.split(None, 1)[0]
acceptfilename="%s/COMMENTS/ACCEPT.%s_%s" % (os.path.dirname(os.path.abspath(changes[0])), source, version) acceptfilename = "%s/COMMENTS/ACCEPT.%s_%s" % (os.path.dirname(os.path.abspath(changes[0])), source, version)
acceptfiles[acceptfilename]=1 acceptfiles[acceptfilename] = 1
print "Would create %s now and then go on to accept this package, if you allow me to." % (acceptfiles.keys()) print "Would create %s now and then go on to accept this package, if you allow me to." % (acceptfiles.keys())
if Options["No-Action"]: if Options["No-Action"]:
......
...@@ -342,7 +342,7 @@ def table_row(source, version, arch, last_mod, maint, distribution, closes, fing ...@@ -342,7 +342,7 @@ def table_row(source, version, arch, last_mod, maint, distribution, closes, fing
for close in closes: for close in closes:
print "<a href=\"https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=%s\">#%s</a><br/>" % (utils.html_escape(close), utils.html_escape(close)) print "<a href=\"https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=%s\">#%s</a><br/>" % (utils.html_escape(close), utils.html_escape(close))
print "</td></tr>" print "</td></tr>"
row_number+=1 row_number += 1
############################################################ ############################################################
...@@ -447,7 +447,7 @@ def process_queue(queue, log, rrd_dir): ...@@ -447,7 +447,7 @@ def process_queue(queue, log, rrd_dir):
fingerprint = "" fingerprint = ""
changeby = {} changeby = {}
changedby = "" changedby = ""
sponsor= "" sponsor = ""
filename = i[1]["list"][0].changes.changesname filename = i[1]["list"][0].changes.changesname
last_modified = time.time()-i[1]["oldest"] last_modified = time.time()-i[1]["oldest"]
source = i[1]["list"][0].changes.source source = i[1]["list"][0].changes.source
......
...@@ -114,7 +114,7 @@ def table_row(changesname, delay, changed_by, closes, fingerprint): ...@@ -114,7 +114,7 @@ def table_row(changesname, delay, changed_by, closes, fingerprint):
res += ('<td valign="top">%s</td>' % res += ('<td valign="top">%s</td>' %
''.join(map(lambda close: '<a href="https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=%s">#%s</a><br>' % (close, close),closes))) ''.join(map(lambda close: '<a href="https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=%s">#%s</a><br>' % (close, close),closes)))
res += '</tr>\n' res += '</tr>\n'
row_number+=1 row_number += 1
return res return res
...@@ -179,8 +179,8 @@ def get_upload_data(changesfn): ...@@ -179,8 +179,8 @@ def get_upload_data(changesfn):
m = re.match(r'([0-9]+)-day', delay) m = re.match(r'([0-9]+)-day', delay)
if m: if m:
delaydays = int(m.group(1)) delaydays = int(m.group(1))
remainingtime = (delaydays>0)*max(0,24*60*60+os.stat(changesfn).st_mtime-time.time()) remainingtime = (delaydays > 0)*max(0,24*60*60+os.stat(changesfn).st_mtime-time.time())
delay = "%d days %02d:%02d" %(max(delaydays-1,0), int(remainingtime/3600),int(remainingtime/60)%60) delay = "%d days %02d:%02d" % (max(delaydays-1,0), int(remainingtime/3600),int(remainingtime/60)%60)
else: else:
delaydays = 0 delaydays = 0
remainingtime = 0 remainingtime = 0
...@@ -297,7 +297,7 @@ def init(): ...@@ -297,7 +297,7 @@ def init():
def main(): def main():
args = init() args = init()
if len(args)!=0: if len(args) != 0:
usage(1) usage(1)
if "Show-Deferred::Options::Rrd" in Cnf: if "Show-Deferred::Options::Rrd" in Cnf:
......
...@@ -138,7 +138,7 @@ def html_header(name, missing): ...@@ -138,7 +138,7 @@ def html_header(name, missing):
def html_footer(): def html_footer():
result = """ <p class="validate">Timestamp: %s (UTC)</p> result = """ <p class="validate">Timestamp: %s (UTC)</p>
"""% (time.strftime("%d.%m.%Y / %H:%M:%S", time.gmtime())) """ % (time.strftime("%d.%m.%Y / %H:%M:%S", time.gmtime()))
result += "</body></html>" result += "</body></html>"
return result return result
......
...@@ -451,9 +451,9 @@ def check_transitions(transitions): ...@@ -451,9 +451,9 @@ def check_transitions(transitions):
answer = "" answer = ""
if Options["no-action"]: if Options["no-action"]:
answer="n" answer = "n"
elif Options["automatic"]: elif Options["automatic"]:
answer="y" answer = "y"
else: else:
answer = utils.our_raw_input(prompt).lower() answer = utils.our_raw_input(prompt).lower()
......
...@@ -130,7 +130,7 @@ Updates dak's database schema to the lastest version. You should disable crontab ...@@ -130,7 +130,7 @@ Updates dak's database schema to the lastest version. You should disable crontab
if "DB::Service" in cnf: if "DB::Service" in cnf:
connect_str = "service=%s" % cnf["DB::Service"] connect_str = "service=%s" % cnf["DB::Service"]
else: else:
connect_str = "dbname=%s"% (cnf["DB::Name"]) connect_str = "dbname=%s" % (cnf["DB::Name"])
if "DB::Host" in cnf and cnf["DB::Host"] != '': if "DB::Host" in cnf and cnf["DB::Host"] != '':
connect_str += " host=%s" % (cnf["DB::Host"]) connect_str += " host=%s" % (cnf["DB::Host"])
if "DB::Port" in cnf and cnf["DB::Port"] != '-1': if "DB::Port" in cnf and cnf["DB::Port"] != '-1':
......
...@@ -181,7 +181,7 @@ class Changes(object): ...@@ -181,7 +181,7 @@ class Changes(object):
"""add "missing" in fields which we will require for the known_changes table""" """add "missing" in fields which we will require for the known_changes table"""
for key in ['urgency', 'maintainer', 'fingerprint', 'changed-by']: for key in ['urgency', 'maintainer', 'fingerprint', 'changed-by']:
if (key not in self.changes) or (not self.changes[key]): if (key not in self.changes) or (not self.changes[key]):
self.changes[key]='missing' self.changes[key] = 'missing'
def __get_file_from_pool(self, filename, entry, session, logger): def __get_file_from_pool(self, filename, entry, session, logger):
cnf = Config() cnf = Config()
......
...@@ -328,7 +328,7 @@ class Architecture(ORMObject): ...@@ -328,7 +328,7 @@ class Architecture(ORMObject):
def __eq__(self, val): def __eq__(self, val):
if isinstance(val, str): if isinstance(val, str):
return (self.arch_string== val) return (self.arch_string == val)
# This signals to use the normal comparison operator # This signals to use the normal comparison operator
return NotImplemented return NotImplemented
...@@ -2349,7 +2349,7 @@ class DBConn(object): ...@@ -2349,7 +2349,7 @@ class DBConn(object):
mapper(BuildQueue, self.tbl_build_queue, mapper(BuildQueue, self.tbl_build_queue,
properties=dict(queue_id=self.tbl_build_queue.c.id, properties=dict(queue_id=self.tbl_build_queue.c.id,
suite=relation(Suite, primaryjoin=(self.tbl_build_queue.c.suite_id==self.tbl_suite.c.id)))) suite=relation(Suite, primaryjoin=(self.tbl_build_queue.c.suite_id == self.tbl_suite.c.id))))
mapper(DBBinary, self.tbl_binaries, mapper(DBBinary, self.tbl_binaries,
properties=dict(binary_id=self.tbl_binaries.c.id, properties=dict(binary_id=self.tbl_binaries.c.id,
...@@ -2432,9 +2432,9 @@ class DBConn(object): ...@@ -2432,9 +2432,9 @@ class DBConn(object):
mapper(Maintainer, self.tbl_maintainer, mapper(Maintainer, self.tbl_maintainer,
properties=dict(maintainer_id=self.tbl_maintainer.c.id, properties=dict(maintainer_id=self.tbl_maintainer.c.id,
maintains_sources=relation(DBSource, backref='maintainer', maintains_sources=relation(DBSource, backref='maintainer',
primaryjoin=(self.tbl_maintainer.c.id==self.tbl_source.c.maintainer)), primaryjoin=(self.tbl_maintainer.c.id == self.tbl_source.c.maintainer)),
changed_sources=relation(DBSource, backref='changedby', changed_sources=relation(DBSource, backref='changedby',
primaryjoin=(self.tbl_maintainer.c.id==self.tbl_source.c.changedby))), primaryjoin=(self.tbl_maintainer.c.id == self.tbl_source.c.changedby))),
) )
mapper(NewComment, self.tbl_new_comments, mapper(NewComment, self.tbl_new_comments,
...@@ -2501,7 +2501,7 @@ class DBConn(object): ...@@ -2501,7 +2501,7 @@ class DBConn(object):
fingerprint=relation(Fingerprint), fingerprint=relation(Fingerprint),
changedby_id=self.tbl_source.c.changedby, changedby_id=self.tbl_source.c.changedby,
srcfiles=relation(DSCFile, srcfiles=relation(DSCFile,
primaryjoin=(self.tbl_source.c.id==self.tbl_dsc_files.c.source)), primaryjoin=(self.tbl_source.c.id == self.tbl_dsc_files.c.source)),
suites=relation(Suite, secondary=self.tbl_src_associations, suites=relation(Suite, secondary=self.tbl_src_associations,
backref=backref('sources', lazy='dynamic')), backref=backref('sources', lazy='dynamic')),
uploaders=relation(Maintainer, uploaders=relation(Maintainer,
...@@ -2571,9 +2571,9 @@ class DBConn(object): ...@@ -2571,9 +2571,9 @@ class DBConn(object):
mapper(VersionCheck, self.tbl_version_check, mapper(VersionCheck, self.tbl_version_check,
properties=dict( properties=dict(
suite_id=self.tbl_version_check.c.suite, suite_id=self.tbl_version_check.c.suite,
suite=relation(Suite, primaryjoin=self.tbl_version_check.c.suite==self.tbl_suite.c.id), suite =relation(Suite, primaryjoin=self.tbl_version_check.c.suite == self.tbl_suite.c.id),
reference_id=self.tbl_version_check.c.reference, reference_id=self.tbl_version_check.c.reference,
reference=relation(Suite, primaryjoin=self.tbl_version_check.c.reference==self.tbl_suite.c.id, lazy='joined'))) reference=relation(Suite, primaryjoin=self.tbl_version_check.c.reference == self.tbl_suite.c.id, lazy='joined')))
## Connection functions ## Connection functions
def __createconn(self): def __createconn(self):
......
...@@ -98,7 +98,7 @@ def list_packages(packages, suites=None, components=None, architectures=None, bi ...@@ -98,7 +98,7 @@ def list_packages(packages, suites=None, components=None, architectures=None, bi
val = lambda: defaultdict(val) val = lambda: defaultdict(val)
ret = val() ret = val()
for row in result: for row in result:
ret[row[t.c.package]][row[t.c.display_suite]][row[t.c.version]]={'component': row[t.c.component], ret[row[t.c.package]][row[t.c.display_suite]][row[t.c.version]] = {'component': row[t.c.component],
'architectures': row[c_architectures].split(','), 'architectures': row[c_architectures].split(','),
'source': row[t.c.source], 'source': row[t.c.source],
'source_version': row[t.c.source_version] 'source_version': row[t.c.source_version]
......
...@@ -273,7 +273,7 @@ def parse_changes(filename, signing_rules=0, dsc_file=0, keyrings=None): ...@@ -273,7 +273,7 @@ def parse_changes(filename, signing_rules=0, dsc_file=0, keyrings=None):
must_keywords = ('Format', 'Date', 'Source', 'Binary', 'Architecture', 'Version', must_keywords = ('Format', 'Date', 'Source', 'Binary', 'Architecture', 'Version',
'Distribution', 'Maintainer', 'Description', 'Changes', 'Files') 'Distribution', 'Maintainer', 'Description', 'Changes', 'Files')
missingfields=[] missingfields = []
for keyword in must_keywords: for keyword in must_keywords:
if keyword.lower() not in changes: if keyword.lower() not in changes:
missingfields.append(keyword) missingfields.append(keyword)
......
...@@ -50,7 +50,7 @@ projectB = None ...@@ -50,7 +50,7 @@ projectB = None
projectBdb = None projectBdb = None
DBNAME = "uploads-queue.db" DBNAME = "uploads-queue.db"
sqliteConn = None sqliteConn = None
maintainer_id_cache={} maintainer_id_cache = {}
############################################################################### ###############################################################################
...@@ -109,7 +109,7 @@ def insert(): ...@@ -109,7 +109,7 @@ def insert():
res = __get_changedby__(row[1], row[2]) res = __get_changedby__(row[1], row[2])
except: except:
print 'FAILED SQLITE' print 'FAILED SQLITE'
res=None res = None
sqliteConn.text_factory = unicode sqliteConn.text_factory = unicode
if res: if res:
changedby_id = get_or_set_maintainer_id(res[0]) changedby_id = get_or_set_maintainer_id(res[0])
......
...@@ -14,7 +14,6 @@ ignore = ...@@ -14,7 +14,6 @@ ignore =
E127, E127,
E128, E128,
E129, E129,
E225,
E226, E226,
E227, E227,
E228, E228,
......
...@@ -26,10 +26,10 @@ from daklib.filewriter import (BinaryContentsFileWriter, ...@@ -26,10 +26,10 @@ from daklib.filewriter import (BinaryContentsFileWriter,
PackagesFileWriter, PackagesFileWriter,
TranslationFileWriter) TranslationFileWriter)
SUITE='unstable' SUITE = 'unstable'
COMPONENT='main' COMPONENT = 'main'
ARCH='amd64' ARCH = 'amd64'
LANG='en' LANG = 'en'
class FileWriterTest(DakTestCase): class FileWriterTest(DakTestCase):
......
...@@ -13,7 +13,7 @@ ITEMS_TO_KEEP = 20 ...@@ -13,7 +13,7 @@ ITEMS_TO_KEEP = 20
CACHE_FILE = '/srv/ftp-master.debian.org/misc/dinstall_time_cache' CACHE_FILE = '/srv/ftp-master.debian.org/misc/dinstall_time_cache'
GRAPH_DIR = '/srv/ftp.debian.org/web/stat' GRAPH_DIR = '/srv/ftp.debian.org/web/stat'
LINE = re.compile(r'(?:|.*/)dinstall_(\d{4})\.(\d{2})\.(\d{2})-(\d{2}):(\d{2}):(\d{2})\.log(?:\.bz2)?:'+ LINE = re.compile(r'(?:|.*/)dinstall_(\d{4})\.(\d{2})\.(\d{2})-(\d{2}):(\d{2}):(\d{2})\.log(?:\.bz2)?:' +
r'Archive maintenance timestamp \(([^\)]*)\): (\d{2}):(\d{2}):(\d{2})$') r'Archive maintenance timestamp \(([^\)]*)\): (\d{2}):(\d{2}):(\d{2})$')
UNSAFE = re.compile(r'[^a-zA-Z/\._:0-9\- ]') UNSAFE = re.compile(r'[^a-zA-Z/\._:0-9\- ]')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册