]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
scrape: drop dependency of "six"
authorKefu Chai <tchaikov@gmail.com>
Sun, 24 Apr 2022 01:28:55 +0000 (09:28 +0800)
committerKefu Chai <tchaikov@gmail.com>
Sun, 24 Apr 2022 01:29:06 +0000 (09:29 +0800)
since we don't need to be compatible with python2, let's stop using
the six package.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
teuthology/scrape.py

index f3b907fba6396a812cd8e8b734a33faa1fda1c52..0a737683fe2e578fe99fb3eb420dc6998a4722bb 100644 (file)
@@ -12,7 +12,6 @@ import re
 import logging
 import subprocess
 
-import six
 
 log = logging.getLogger('scrape')
 log.addHandler(logging.StreamHandler())
@@ -31,11 +30,12 @@ def grep(path, expr):
     """
     Call out to native grep rather than feeding massive log files through python line by line
     """
-    p = subprocess.Popen(["grep", expr, path], stdout=subprocess.PIPE)
+    p = subprocess.Popen(["grep", expr, path], stdout=subprocess.PIPE,
+                         universal_newlines=True)
     p.wait()
     out, err = p.communicate()
     if p.returncode == 0:
-        return six.ensure_str(out).split("\n")
+        return out.split("\n")
     else:
         return []
 
@@ -410,7 +410,7 @@ class ValgrindReason(Reason):
                 log.warning("Misunderstood line: {0}".format(line))
                 continue
             err_typ, log_basename = match.groups()
-            svc_typ = six.ensure_str(log_basename).split(".")[0]
+            svc_typ = log_basename.split(".")[0]
             if err_typ not in result[svc_typ]:
                 result[svc_typ].append(err_typ)
                 result[svc_typ] = sorted(result[svc_typ])