[elbe-devel] [PATCH 09/28] pylint: fix unidiomatic typechecks

Torben Hohn torben.hohn at linutronix.de
Wed Aug 22 11:29:03 CEST 2018


use isiinstance() for typechecks, instead of type(x) == str.

Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
---
 elbepack/repomanager.py | 4 ++--
 elbepack/treeutils.py   | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/elbepack/repomanager.py b/elbepack/repomanager.py
index 0eff0761..081cb04b 100644
--- a/elbepack/repomanager.py
+++ b/elbepack/repomanager.py
@@ -22,12 +22,12 @@ class RepoAttributes(object):
     def __init__(self, codename, arch, components,
                  mirror='http://ftp.de.debian.org/debian'):
         self.codename = codename
-        if type(arch) is str:
+        if isinstance(arch, str):
             self.arch = set([arch])
         else:
             self.arch = set(arch)
 
-        if type(components) is str:
+        if isinstance(components, str):
             self.components = set([components])
         else:
             self.components = set(components)
diff --git a/elbepack/treeutils.py b/elbepack/treeutils.py
index a1af18ee..383f80e2 100644
--- a/elbepack/treeutils.py
+++ b/elbepack/treeutils.py
@@ -44,7 +44,7 @@ class ebase(object):
             raise Exception("Cant find path %s" % path)
         elif (el is None) and "default" in args:
             default = args["default"]
-            if type(default) == str:
+            if isinstance(default, str):
                 return default
             else:
                 return default[args["key"]]
-- 
2.11.0




More information about the elbe-devel mailing list