[csw-devel] SF.net SVN: gar:[12477] csw/mgar/gar/v2/lib/python

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Sun Jan 9 22:36:05 CET 2011


Revision: 12477
          http://gar.svn.sourceforge.net/gar/?rev=12477&view=rev
Author:   wahwah
Date:     2011-01-09 21:36:05 +0000 (Sun, 09 Jan 2011)

Log Message:
-----------
checkpkg: Small optimization and cleanup

Taking a db query outside a loop.

Removing an unnecessary variable.

Modified Paths:
--------------
    csw/mgar/gar/v2/lib/python/checkpkg_lib.py
    csw/mgar/gar/v2/lib/python/checkpkg_lib_test.py

Modified: csw/mgar/gar/v2/lib/python/checkpkg_lib.py
===================================================================
--- csw/mgar/gar/v2/lib/python/checkpkg_lib.py	2011-01-09 21:35:32 UTC (rev 12476)
+++ csw/mgar/gar/v2/lib/python/checkpkg_lib.py	2011-01-09 21:36:05 UTC (rev 12477)
@@ -224,14 +224,12 @@
     for pkg in self.sqo_pkgs_list:
       db_stat_objs_by_pkgname[pkg.pkginst.pkgname] = pkg
     logging.debug("Deleting old errors from the database.")
+    sqo_os_rel, sqo_arch, sqo_catrel = self.GetSqlobjectTriad()
     for pkgname, db_obj in db_stat_objs_by_pkgname.iteritems():
-      sqo_os_rel, sqo_arch, sqo_catrel = self.GetSqlobjectTriad()
-      db_obj.RemoveCheckpkgResults(
-          sqo_os_rel, sqo_arch, sqo_catrel)
+      db_obj.RemoveCheckpkgResults(sqo_os_rel, sqo_arch, sqo_catrel)
     errors, messages, gar_lines = self.GetAllTags(self.sqo_pkgs_list)
-    no_errors = len(errors) + 1
     pbar = self.GetProgressBar()
-    pbar.maxval = no_errors
+    pbar.maxval = len(errors) + 1
     count = itertools.count(1)
     logging.info("Stuffing the candies under the pillow...")
     pbar.start()

Modified: csw/mgar/gar/v2/lib/python/checkpkg_lib_test.py
===================================================================
--- csw/mgar/gar/v2/lib/python/checkpkg_lib_test.py	2011-01-09 21:35:32 UTC (rev 12476)
+++ csw/mgar/gar/v2/lib/python/checkpkg_lib_test.py	2011-01-09 21:36:05 UTC (rev 12477)
@@ -1,18 +1,19 @@
 #!/usr/bin/env python2.6
 
+import checkpkg_lib
 import copy
-import unittest
-import checkpkg_lib
-import tag
-import package_stats
+import cPickle
 import database
-import sqlobject
+import inspective_package
 import models
+import mox
 import package_stats
-import inspective_package
-import mox
+import package_stats
+import pprint
+import sqlobject
+import tag
 import test_base
-import cPickle
+import unittest
 from testdata import stubs
 
 from testdata.neon_stats import pkgstats as neon_stats


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


More information about the devel mailing list