]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
Pylint: examples: fix basestring is not in py3
authorMartin <martin.basti@gmail.com>
Sat, 2 Jul 2016 20:35:31 +0000 (22:35 +0200)
committerMartin <martin.basti@gmail.com>
Sat, 2 Jul 2016 20:35:31 +0000 (22:35 +0200)
examples/zonediff.py

index 6afa36283a6288b15572220996452c2c28372a5c..be0385189370876461bcdedd26d677c54b4bb6ef 100755 (executable)
@@ -192,15 +192,7 @@ The differences shown will be logical differences, not textual differences.
     opts.use_vc = opts.use_git or opts.use_bzr or opts.use_rcs
 
     def _open(what, err):
-        if isinstance(what, basestring):
-            # Open as normal file
-            try:
-                return open(what, 'rb')
-            except:
-                sys.stderr.write(err + "\n")
-                if opts.tracebacks:
-                    traceback.print_exc()
-        else:
+        if isinstance(what, list):
             # Must be a list, open subprocess
             try:
                 proc = subprocess.Popen(what, stdout=subprocess.PIPE)
@@ -212,6 +204,14 @@ The differences shown will be logical differences, not textual differences.
                 sys.stderr.write(err + "\n")
                 if opts.tracebacks:
                     traceback.print_exc()
+        else:
+            # Open as normal file
+            try:
+                return open(what, 'rb')
+            except:
+                sys.stderr.write(err + "\n")
+                if opts.tracebacks:
+                    traceback.print_exc()
 
     if not opts.use_vc and len(args) != 2:
         p.print_help()