From 903e5be19830c735d05e3d749b9e079ee4d7a00a Mon Sep 17 00:00:00 2001 From: Bastian Blank Date: Mon, 21 May 2018 18:13:46 +0200 Subject: [PATCH] Fix E225: Missing whitespace around operator --- dak/add_user.py | 4 ++-- dak/bts_categorize.py | 8 ++++---- dak/generate_index_diffs.py | 10 +++++----- dak/generate_releases.py | 4 ++-- dak/new_security_install.py | 16 ++++++++-------- dak/queue_report.py | 4 ++-- dak/show_deferred.py | 8 ++++---- dak/show_new.py | 2 +- dak/transitions.py | 4 ++-- dak/update_db.py | 2 +- daklib/changes.py | 2 +- daklib/dbconn.py | 14 +++++++------- daklib/ls.py | 2 +- daklib/utils.py | 2 +- scripts/debian/insert_missing_changedby.py | 4 ++-- setup.cfg | 1 - tests/test_filewriter.py | 8 ++++---- tools/logs.py | 2 +- 18 files changed, 48 insertions(+), 49 deletions(-) diff --git a/dak/add_user.py b/dak/add_user.py index c3dfc27d..bd02f220 100755 --- a/dak/add_user.py +++ b/dak/add_user.py @@ -100,7 +100,7 @@ def main(): name = n.group(1) # Look for all email addresses on the key. - emails=[] + emails = [] for line in output.split('\n'): e = re_user_mails.search(line) if not e: @@ -134,7 +134,7 @@ def main(): # Should we send mail to the newly added user? if Cnf.find_b("Add-User::SendEmail"): - mail = name + "<" + emails[0] +">" + mail = name + "<" + emails[0] + ">" Subst = {} Subst["__NEW_MAINTAINER__"] = mail Subst["__UID__"] = uid diff --git a/dak/bts_categorize.py b/dak/bts_categorize.py index 96ab402b..5b7bf013 100755 --- a/dak/bts_categorize.py +++ b/dak/bts_categorize.py @@ -100,7 +100,7 @@ class BugClassifier(object): tagged_bugs_ftp += tagged_bugs[tags] 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): """ @@ -173,13 +173,13 @@ def main(): sys.exit(0) if Options["Quiet"]: - level=logging.ERROR + level = logging.ERROR elif Options["Verbose"]: - level=logging.DEBUG + level = logging.DEBUG else: - level=logging.INFO + level = logging.INFO logging.basicConfig(level=level, format='%(asctime)s %(levelname)s %(message)s', diff --git a/dak/generate_index_diffs.py b/dak/generate_index_diffs.py index 8257e2a1..e84a3d5b 100755 --- a/dak/generate_index_diffs.py +++ b/dak/generate_index_diffs.py @@ -186,7 +186,7 @@ class Updates: x = read_hashs(2,2,f,self) 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] if l[0] == "SHA1-Current:" and len(l) == 3: @@ -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) if "CanonicalPath" in Options: - upd.can_path=Options["CanonicalPath"] + upd.can_path = Options["CanonicalPath"] if os.path.exists(newfile): os.unlink(newfile) @@ -427,7 +427,7 @@ def main(): cwd = os.getcwd() for component in components: #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): os.chdir(workpath) for dirpath, dirnames, filenames in os.walk(".", followlinks=True, topdown=True): @@ -436,9 +436,9 @@ def main(): #print "EXCLUDING %s" % (entry) continue (fname, fext) = os.path.splitext(entry) - processfile=os.path.join(workpath, fname) + processfile = os.path.join(workpath, fname) #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) genchanges(Options, processfile + ".diff", storename, processfile, maxdiffs) os.chdir(cwd) diff --git a/dak/generate_releases.py b/dak/generate_releases.py index f977fe38..9c8c78af 100755 --- a/dak/generate_releases.py +++ b/dak/generate_releases.py @@ -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())))) 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)))) for key, dbfield in boolattrs: @@ -493,7 +493,7 @@ def main(): query = query.join(Suite.archive).filter(Archive.archive_name.in_(archive_names)) suites = query.all() - broken=[] + broken = [] for s in suites: # Setup a multiprocessing Pool. As many workers as we have CPU cores. diff --git a/dak/new_security_install.py b/dak/new_security_install.py index be3984b1..483fb20d 100755 --- a/dak/new_security_install.py +++ b/dak/new_security_install.py @@ -145,11 +145,11 @@ def main(): if Options['Help']: usage() - changesfiles={} + changesfiles = {} for a in changes_files: if not a.endswith(".changes"): utils.fubar("not a .changes file: %s" % (a)) - changesfiles[a]=1 + changesfiles[a] = 1 changes = changesfiles.keys() username = utils.getusername() @@ -176,16 +176,16 @@ def main(): # Yes, we could do this inside do_Approve too. But this way we see who exactly # called it (ownership of the file) - acceptfiles={} + acceptfiles = {} for change in changes: - dbchange=get_dbchange(os.path.basename(change), session) + dbchange = get_dbchange(os.path.basename(change), session) # strip epoch from version - version=dbchange.version - version=version[(version.find(':')+1):] + version = dbchange.version + version = version[(version.find(':')+1):] # strip possible version from source (binNMUs) source = dbchange.source.split(None, 1)[0] - acceptfilename="%s/COMMENTS/ACCEPT.%s_%s" % (os.path.dirname(os.path.abspath(changes[0])), source, version) - acceptfiles[acceptfilename]=1 + acceptfilename = "%s/COMMENTS/ACCEPT.%s_%s" % (os.path.dirname(os.path.abspath(changes[0])), source, version) + acceptfiles[acceptfilename] = 1 print "Would create %s now and then go on to accept this package, if you allow me to." % (acceptfiles.keys()) if Options["No-Action"]: diff --git a/dak/queue_report.py b/dak/queue_report.py index eeba2396..09415ea8 100755 --- a/dak/queue_report.py +++ b/dak/queue_report.py @@ -342,7 +342,7 @@ def table_row(source, version, arch, last_mod, maint, distribution, closes, fing for close in closes: print "#%s
" % (utils.html_escape(close), utils.html_escape(close)) print "" - row_number+=1 + row_number += 1 ############################################################ @@ -447,7 +447,7 @@ def process_queue(queue, log, rrd_dir): fingerprint = "" changeby = {} changedby = "" - sponsor= "" + sponsor = "" filename = i[1]["list"][0].changes.changesname last_modified = time.time()-i[1]["oldest"] source = i[1]["list"][0].changes.source diff --git a/dak/show_deferred.py b/dak/show_deferred.py index b9d69c54..27cc941c 100755 --- a/dak/show_deferred.py +++ b/dak/show_deferred.py @@ -114,7 +114,7 @@ def table_row(changesname, delay, changed_by, closes, fingerprint): res += ('%s' % ''.join(map(lambda close: '#%s
' % (close, close),closes))) res += '\n' - row_number+=1 + row_number += 1 return res @@ -179,8 +179,8 @@ def get_upload_data(changesfn): m = re.match(r'([0-9]+)-day', delay) if m: delaydays = int(m.group(1)) - 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) + 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) else: delaydays = 0 remainingtime = 0 @@ -297,7 +297,7 @@ def init(): def main(): args = init() - if len(args)!=0: + if len(args) != 0: usage(1) if "Show-Deferred::Options::Rrd" in Cnf: diff --git a/dak/show_new.py b/dak/show_new.py index f03a2e8c..dda5e988 100755 --- a/dak/show_new.py +++ b/dak/show_new.py @@ -138,7 +138,7 @@ def html_header(name, missing): def html_footer(): result = """

Timestamp: %s (UTC)

-"""% (time.strftime("%d.%m.%Y / %H:%M:%S", time.gmtime())) +""" % (time.strftime("%d.%m.%Y / %H:%M:%S", time.gmtime())) result += "" return result diff --git a/dak/transitions.py b/dak/transitions.py index 984f4985..7e559b29 100755 --- a/dak/transitions.py +++ b/dak/transitions.py @@ -451,9 +451,9 @@ def check_transitions(transitions): answer = "" if Options["no-action"]: - answer="n" + answer = "n" elif Options["automatic"]: - answer="y" + answer = "y" else: answer = utils.our_raw_input(prompt).lower() diff --git a/dak/update_db.py b/dak/update_db.py index 59b6bb95..4819e91b 100755 --- a/dak/update_db.py +++ b/dak/update_db.py @@ -130,7 +130,7 @@ Updates dak's database schema to the lastest version. You should disable crontab if "DB::Service" in cnf: connect_str = "service=%s" % cnf["DB::Service"] else: - connect_str = "dbname=%s"% (cnf["DB::Name"]) + connect_str = "dbname=%s" % (cnf["DB::Name"]) if "DB::Host" in cnf and cnf["DB::Host"] != '': connect_str += " host=%s" % (cnf["DB::Host"]) if "DB::Port" in cnf and cnf["DB::Port"] != '-1': diff --git a/daklib/changes.py b/daklib/changes.py index 30ec9e1d..f3d0d434 100644 --- a/daklib/changes.py +++ b/daklib/changes.py @@ -181,7 +181,7 @@ class Changes(object): """add "missing" in fields which we will require for the known_changes table""" for key in ['urgency', 'maintainer', 'fingerprint', 'changed-by']: 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): cnf = Config() diff --git a/daklib/dbconn.py b/daklib/dbconn.py index 69109125..57ef20e6 100755 --- a/daklib/dbconn.py +++ b/daklib/dbconn.py @@ -328,7 +328,7 @@ class Architecture(ORMObject): def __eq__(self, val): if isinstance(val, str): - return (self.arch_string== val) + return (self.arch_string == val) # This signals to use the normal comparison operator return NotImplemented @@ -2349,7 +2349,7 @@ class DBConn(object): mapper(BuildQueue, self.tbl_build_queue, 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, properties=dict(binary_id=self.tbl_binaries.c.id, @@ -2432,9 +2432,9 @@ class DBConn(object): mapper(Maintainer, self.tbl_maintainer, properties=dict(maintainer_id=self.tbl_maintainer.c.id, 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', - 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, @@ -2501,7 +2501,7 @@ class DBConn(object): fingerprint=relation(Fingerprint), changedby_id=self.tbl_source.c.changedby, 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, backref=backref('sources', lazy='dynamic')), uploaders=relation(Maintainer, @@ -2571,9 +2571,9 @@ class DBConn(object): mapper(VersionCheck, self.tbl_version_check, properties=dict( 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=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 def __createconn(self): diff --git a/daklib/ls.py b/daklib/ls.py index 81450cdd..879ef005 100644 --- a/daklib/ls.py +++ b/daklib/ls.py @@ -98,7 +98,7 @@ def list_packages(packages, suites=None, components=None, architectures=None, bi val = lambda: defaultdict(val) ret = val() 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(','), 'source': row[t.c.source], 'source_version': row[t.c.source_version] diff --git a/daklib/utils.py b/daklib/utils.py index 8034e611..14305ef1 100644 --- a/daklib/utils.py +++ b/daklib/utils.py @@ -273,7 +273,7 @@ def parse_changes(filename, signing_rules=0, dsc_file=0, keyrings=None): must_keywords = ('Format', 'Date', 'Source', 'Binary', 'Architecture', 'Version', 'Distribution', 'Maintainer', 'Description', 'Changes', 'Files') - missingfields=[] + missingfields = [] for keyword in must_keywords: if keyword.lower() not in changes: missingfields.append(keyword) diff --git a/scripts/debian/insert_missing_changedby.py b/scripts/debian/insert_missing_changedby.py index e899346d..e78bf9e2 100644 --- a/scripts/debian/insert_missing_changedby.py +++ b/scripts/debian/insert_missing_changedby.py @@ -50,7 +50,7 @@ projectB = None projectBdb = None DBNAME = "uploads-queue.db" sqliteConn = None -maintainer_id_cache={} +maintainer_id_cache = {} ############################################################################### @@ -109,7 +109,7 @@ def insert(): res = __get_changedby__(row[1], row[2]) except: print 'FAILED SQLITE' - res=None + res = None sqliteConn.text_factory = unicode if res: changedby_id = get_or_set_maintainer_id(res[0]) diff --git a/setup.cfg b/setup.cfg index 23d82699..4ffbfe55 100644 --- a/setup.cfg +++ b/setup.cfg @@ -14,7 +14,6 @@ ignore = E127, E128, E129, - E225, E226, E227, E228, diff --git a/tests/test_filewriter.py b/tests/test_filewriter.py index c298843f..399c385e 100644 --- a/tests/test_filewriter.py +++ b/tests/test_filewriter.py @@ -26,10 +26,10 @@ from daklib.filewriter import (BinaryContentsFileWriter, PackagesFileWriter, TranslationFileWriter) -SUITE='unstable' -COMPONENT='main' -ARCH='amd64' -LANG='en' +SUITE = 'unstable' +COMPONENT = 'main' +ARCH = 'amd64' +LANG = 'en' class FileWriterTest(DakTestCase): diff --git a/tools/logs.py b/tools/logs.py index 8a30c31c..1a95ce6e 100755 --- a/tools/logs.py +++ b/tools/logs.py @@ -13,7 +13,7 @@ ITEMS_TO_KEEP = 20 CACHE_FILE = '/srv/ftp-master.debian.org/misc/dinstall_time_cache' 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})$') UNSAFE = re.compile(r'[^a-zA-Z/\._:0-9\- ]') -- GitLab