From: Mark Hymers Date: Sat, 3 May 2008 13:46:35 +0000 (+0100) Subject: clean up pychecker warnings X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=d9efaedb2d0937bc770d33e7cfb6511f847ee74c;p=dak.git clean up pychecker warnings --- diff --git a/dak/clean_queues.py b/dak/clean_queues.py index 43f8ffb4..178c1aca 100644 --- a/dak/clean_queues.py +++ b/dak/clean_queues.py @@ -81,32 +81,32 @@ def init (): os.chdir(incoming) # Remove a file to the morgue -def remove (file): - if os.access(file, os.R_OK): - dest_filename = del_dir + '/' + os.path.basename(file) +def remove (f): + if os.access(f, os.R_OK): + dest_filename = del_dir + '/' + os.path.basename(f) # If the destination file exists; try to find another filename to use if os.path.exists(dest_filename): dest_filename = daklib.utils.find_next_free(dest_filename, 10) - daklib.utils.move(file, dest_filename, 0660) + daklib.utils.move(f, dest_filename, 0660) else: - daklib.utils.warn("skipping '%s', permission denied." % (os.path.basename(file))) + daklib.utils.warn("skipping '%s', permission denied." % (os.path.basename(f))) # Removes any old files. # [Used for Incoming/REJECT] # def flush_old (): - for file in os.listdir('.'): - if os.path.isfile(file): - if os.stat(file)[stat.ST_MTIME] < delete_date: + for f in os.listdir('.'): + if os.path.isfile(f): + if os.stat(f)[stat.ST_MTIME] < delete_date: if Options["No-Action"]: - print "I: Would delete '%s'." % (os.path.basename(file)) + print "I: Would delete '%s'." % (os.path.basename(f)) else: if Options["Verbose"]: - print "Removing '%s' (to '%s')." % (os.path.basename(file), del_dir) - remove(file) + print "Removing '%s' (to '%s')." % (os.path.basename(f), del_dir) + remove(f) else: if Options["Verbose"]: - print "Skipping, too new, '%s'." % (os.path.basename(file)) + print "Skipping, too new, '%s'." % (os.path.basename(f)) # Removes any files which are old orphans (not associated with a valid .changes file). # [Used for Incoming] @@ -132,13 +132,13 @@ def flush_orphans (): continue dsc_files = {} - for file in files.keys(): - if file.endswith(".dsc"): + for f in files.keys(): + if f.endswith(".dsc"): try: - dsc = daklib.utils.parse_changes(file) + dsc = daklib.utils.parse_changes(f) dsc_files = daklib.utils.build_file_list(dsc, is_a_dsc=1) except: - daklib.utils.warn("error processing '%s'; skipping it. [Got %s]" % (file, sys.exc_type)) + daklib.utils.warn("error processing '%s'; skipping it. [Got %s]" % (f, sys.exc_type)) continue # Ensure all the files we've seen aren't deleted @@ -153,17 +153,17 @@ def flush_orphans (): # Anthing left at this stage is not referenced by a .changes (or # a .dsc) and should be deleted if old enough. - for file in all_files.keys(): - if os.stat(file)[stat.ST_MTIME] < delete_date: + for f in all_files.keys(): + if os.stat(f)[stat.ST_MTIME] < delete_date: if Options["No-Action"]: - print "I: Would delete '%s'." % (os.path.basename(file)) + print "I: Would delete '%s'." % (os.path.basename(f)) else: if Options["Verbose"]: - print "Removing '%s' (to '%s')." % (os.path.basename(file), del_dir) - remove(file) + print "Removing '%s' (to '%s')." % (os.path.basename(f), del_dir) + remove(f) else: if Options["Verbose"]: - print "Skipping, too new, '%s'." % (os.path.basename(file)) + print "Skipping, too new, '%s'." % (os.path.basename(f)) ################################################################################