[yum-commits] 3 commits - plugins/ps plugins/security repoquery.py

Tim Lauridsen timlau at osuosl.org
Tue Aug 3 06:50:19 UTC 2010


 plugins/ps/ps.py             |   27 +++++++++++++--------------
 plugins/security/security.py |    1 -
 repoquery.py                 |   16 ++++++++--------
 3 files changed, 21 insertions(+), 23 deletions(-)

New commits:
commit a17d018b81005a4f9e966e492e0ca8ff35402c4b
Author: Tim Lauridsen <timlau at fedoraproject.org>
Date:   Tue Aug 3 08:46:55 2010 +0200

    fix pylint errors
    ************* Module repoquery
    W0211:283:pkgQuery._tree_print_req: Static method with 'self' as first argument
    W0601:325:pkgQuery._fmt_tree_prov: Global variable '__req2pkgs' undefined at the module level
    W0601:430:pkgQuery.fmt_tree_what_requires: Global variable '__prov2pkgs' undefined at the module level
    E0602:399:pkgQuery.fmt_tree_obsoletes.obs2pkgs: Undefined variable 'obbs'
    E1120:364:pkgQuery._fmt_tree_prov: No value passed for parameter 'level' in function call
    E1120:373:pkgQuery._fmt_tree_prov: No value passed for parameter 'level' in function call
    E1120:463:pkgQuery.fmt_tree_what_requires: No value passed for parameter 'level' in function call
    E1120:476:pkgQuery.fmt_tree_what_requires: No value passed for parameter 'level' in function call
    E1120:413:pkgQuery.fmt_tree_obsoletes: No value passed for parameter 'level' in function call
    E1120:420:pkgQuery.fmt_tree_obsoletes: No value passed for parameter 'level' in function call

diff --git a/repoquery.py b/repoquery.py
index a799547..76e1012 100755
--- a/repoquery.py
+++ b/repoquery.py
@@ -74,6 +74,8 @@ querytags = [ 'name', 'version', 'release', 'epoch', 'arch', 'summary',
               'relativepath', 'hdrstart', 'hdrend', 'id',
             ]
 
+
+
 def sec2isodate(timestr):
     return time.strftime("%F %T", time.gmtime(int(timestr)))
 
@@ -280,7 +282,7 @@ class pkgQuery:
 
     # These are common helpers for the --tree-* options...
     @staticmethod
-    def _tree_print_req(self, req, val, level):
+    def _tree_print_req(req, val, level):
         indent = ''
         if level:
             indent = ' |  ' * (level - 1) + ' \_  '
@@ -322,7 +324,6 @@ class pkgQuery:
         req      = kw.get('req', 'cmd line')
         level    = kw.get('level', 0)
         all_reqs = kw.get('all_reqs', {})
-        global __req2pkgs
         __req2pkgs = {}
         def req2pkgs(ignore, req):
             req = str(req)
@@ -396,7 +397,7 @@ class pkgQuery:
                         if opkg.obsoletedBy([pkg]):
                             obss.append(opkg)
             if self.yb.options.pkgnarrow in ('all', 'installed'):
-                skip = set([pkg.pkgtup for pkg in obbs])
+                skip = set([pkg.pkgtup for pkg in obss])
                 for obs_n in pkg.obsoletes_names:
                     for opkg in yb.rpmdb.searchNevra(name=obs_n):
                         if opkg.pkgtup in skip:
@@ -427,7 +428,6 @@ class pkgQuery:
         level    = kw.get('level', 0)
         all_reqs = kw.get('all_reqs', {})
 
-        global __prov2pkgs
         __prov2pkgs = {}
         def prov2pkgs(prov, ignore):
             if str(prov) in __prov2pkgs:
commit 5bffc707dc3d85bb20e8794b9c2cd620e7907535
Author: Tim Lauridsen <timlau at fedoraproject.org>
Date:   Tue Aug 3 08:17:50 2010 +0200

    fix pylint erros
    
    ************* Module ps
    W0311: 45: Bad indentation. Found 8 spaces, expected 4
    W0311: 47: Bad indentation. Found 8 spaces, expected 4
    W0311: 48: Bad indentation. Found 8 spaces, expected 4
    W0311: 49: Bad indentation. Found 12 spaces, expected 8
    W0311: 50: Bad indentation. Found 16 spaces, expected 12
    W0311: 51: Bad indentation. Found 20 spaces, expected 16
    W0311: 52: Bad indentation. Found 24 spaces, expected 20
    W0311: 53: Bad indentation. Found 20 spaces, expected 16
    W0311: 55: Bad indentation. Found 8 spaces, expected 4
    W0311: 56: Bad indentation. Found 12 spaces, expected 8
    W0311: 57: Bad indentation. Found 8 spaces, expected 4
    W0611: 26: Unused import yum
    ************* Module security
    W0611: 47: Unused import logginglevels

diff --git a/plugins/ps/ps.py b/plugins/ps/ps.py
index 50f3428..b89f04c 100644
--- a/plugins/ps/ps.py
+++ b/plugins/ps/ps.py
@@ -23,7 +23,6 @@
 #  yum ps k\*
 #  yum ps all
 
-import yum
 import yum.misc as misc
 from yum.plugins import TYPE_INTERACTIVE
 
@@ -42,19 +41,19 @@ requires_api_version = '2.5'
 plugin_type = (TYPE_INTERACTIVE,)
 
 def _rpmdb_return_running_packages(self, return_pids=False):
-        """returns a list of yum installed package objects which own a file
-           that are currently running or in use."""
-        pkgs = {}
-        for pid in misc.return_running_pids():
-            for fn in misc.get_open_files(pid):
-                for pkg in self.searchFiles(fn):
-                    if pkg not in pkgs:
-                        pkgs[pkg] = set()
-                    pkgs[pkg].add(pid)
-
-        if return_pids:
-            return pkgs
-        return sorted(pkgs.keys())
+    """returns a list of yum installed package objects which own a file
+       that are currently running or in use."""
+    pkgs = {}
+    for pid in misc.return_running_pids():
+        for fn in misc.get_open_files(pid):
+            for pkg in self.searchFiles(fn):
+                if pkg not in pkgs:
+                    pkgs[pkg] = set()
+                pkgs[pkg].add(pid)
+
+    if return_pids:
+        return pkgs
+    return sorted(pkgs.keys())
 
 
 class PSCommand:
diff --git a/plugins/security/security.py b/plugins/security/security.py
index 2dca59b..b2c3680 100755
--- a/plugins/security/security.py
+++ b/plugins/security/security.py
@@ -44,7 +44,6 @@ import fnmatch
 from yum.plugins import TYPE_INTERACTIVE
 from yum.update_md import UpdateMetadata
 import logging # for commands
-from yum import logginglevels
 
 from yum.constants import *
 
commit 1f6f31a413a9c3b9e23eda6053992128c7824aa7
Author: Tim Lauridsen <timlau at fedoraproject.org>
Date:   Tue Aug 3 08:13:32 2010 +0200

    fix pylint errors
    
    ************* Module repoquery
    W0301:322: Unnecessary semicolon
    W0301:426: Unnecessary semicolon
    E0213:267:pkgQuery.tree_print_req: Method should have "self" as first argument
    E0213:272:pkgQuery.pkg2uniq: Method should have "self" as first argument
    E0602:274:pkgQuery.pkg2uniq: Undefined variable 'self'
    E0602:274:pkgQuery.pkg2uniq: Undefined variable 'self'
    E0213:277:pkgQuery.pkg2val: Method should have "self" as first argument

diff --git a/repoquery.py b/repoquery.py
index fe81e58..a799547 100755
--- a/repoquery.py
+++ b/repoquery.py
@@ -264,23 +264,23 @@ class pkgQuery:
             loc = urlparse.urljoin(repourl, self['relativepath'])
         return loc
 
-    def tree_print_req(req, val, level):
+    def tree_print_req(self, req, val, level):
         indent = ''
         if level:
             indent = ' |  ' * (level - 1) + ' \_  '
         print "%s%s [%s]" % (indent, str(req), str(val))
-    def pkg2uniq(pkg):
+    def pkg2uniq(self, pkg):
         """ Turn a pkg into a "unique" req."""
         if self.yb and self.yb.conf.showdupesfromrepos:
             return str(pkg)
         return "%s.%s" % (pkg.name, getBaseArch(pkg.arch))
-    def pkg2val(reqs, pkg):
+    def pkg2val(self, reqs, pkg):
         reqs = sorted(reqs[pkg2req(pkg)])
         return str(len(reqs)) + ": " + ", ".join(reqs)
 
     # These are common helpers for the --tree-* options...
     @staticmethod
-    def _tree_print_req(req, val, level):
+    def _tree_print_req(self, req, val, level):
         indent = ''
         if level:
             indent = ' |  ' * (level - 1) + ' \_  '
@@ -319,7 +319,7 @@ class pkgQuery:
         return rpkgs, loc_reqs
     def _fmt_tree_prov(self, prco_type, **kw):
         pkg      = kw.get('pkg', self.pkg)
-        req      = kw.get('req', 'cmd line');
+        req      = kw.get('req', 'cmd line')
         level    = kw.get('level', 0)
         all_reqs = kw.get('all_reqs', {})
         global __req2pkgs
@@ -423,7 +423,7 @@ class pkgQuery:
 
     def fmt_tree_what_requires(self, **kw):
         pkg      = kw.get('pkg', self.pkg)
-        req      = kw.get('req', 'cmd line');
+        req      = kw.get('req', 'cmd line')
         level    = kw.get('level', 0)
         all_reqs = kw.get('all_reqs', {})
 


More information about the Yum-commits mailing list