[python-meh] Filter local variables in a nicer way and fix docstring

Vratislav Podzimek vpodzime at redhat.com
Mon Sep 23 13:09:47 UTC 2013


The localSkipList is used as a list of substrings that are searched in variable
names to determine if those should be skipped or not. Both the code and
docstring should reflect that in a readable way.

Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
 meh/__init__.py | 2 +-
 meh/dump.py     | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/meh/__init__.py b/meh/__init__.py
index 6497bf4..75b6a21 100644
--- a/meh/__init__.py
+++ b/meh/__init__.py
@@ -65,7 +65,7 @@ class Config(object):
            fileList       -- A list of files to find on the system and add
                              to the traceback dump.
            localSkipList  -- A list of strings.  When handling a traceback,
-                             any local variables found with the same name as
+                             any local variables found with their name containing
                              an element of this list will not be written to
                              the dump.  This is subtely different from
                              attrSkipList.
diff --git a/meh/dump.py b/meh/dump.py
index 0a769f2..9fe9003 100644
--- a/meh/dump.py
+++ b/meh/dump.py
@@ -420,9 +420,9 @@ class ExceptionDump(object):
             ret += "\nLocal variables in innermost frame:\n"
             try:
                 for (key, value) in frame.f_locals.items():
-                    loweredKey = key.lower()
-                    if len(filter(lambda s: loweredKey.find(s) != -1,
-                                  self.conf.localSkipList)) > 0:
+                    lowered_key = key.lower()
+                    if any(item.lower() in lowered_key
+                           for item in self.conf.localSkipList):
                         continue
 
                     ret += "%s: %s\n" % (key, value)
-- 
1.7.11.7



More information about the anaconda-patches mailing list