[PATCH pyparted] Stop using type() to do comparisons.

Chris Lumens clumens at redhat.com
Tue May 5 20:40:49 UTC 2015


pylint has become more picky about this, so stop doing it.
---
 src/parted/alignment.py  | 2 +-
 src/parted/constraint.py | 2 +-
 src/parted/device.py     | 2 +-
 src/parted/disk.py       | 2 +-
 src/parted/filesystem.py | 2 +-
 src/parted/geometry.py   | 2 +-
 src/parted/partition.py  | 2 +-
 7 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/parted/alignment.py b/src/parted/alignment.py
index e11e4de..120d3a6 100644
--- a/src/parted/alignment.py
+++ b/src/parted/alignment.py
@@ -55,7 +55,7 @@ class Alignment(object):
         return not self.__ne__(other)
 
     def __ne__(self, other):
-        if type(self) != type(other):
+        if not isinstance(self, other.__class__):
             return True
 
         if getattr(other, "__hash__", None):
diff --git a/src/parted/constraint.py b/src/parted/constraint.py
index cdf4b5a..53bdd58 100644
--- a/src/parted/constraint.py
+++ b/src/parted/constraint.py
@@ -90,7 +90,7 @@ class Constraint(object):
         if hash(self) == hash(other):
             return False
 
-        if type(self) != type(other):
+        if not isinstance(self, other.__class__):
             return True
 
         c1 = self.getPedConstraint()
diff --git a/src/parted/device.py b/src/parted/device.py
index 12b4b34..58243c9 100644
--- a/src/parted/device.py
+++ b/src/parted/device.py
@@ -63,7 +63,7 @@ class Device(object):
         return not self.__ne__(other)
 
     def __ne__(self, other):
-        if type(self) != type(other):
+        if not isinstance(self, other.__class__):
             return True
 
         if getattr(other, "__hash__", None):
diff --git a/src/parted/disk.py b/src/parted/disk.py
index dd645e2..4fa84a6 100644
--- a/src/parted/disk.py
+++ b/src/parted/disk.py
@@ -74,7 +74,7 @@ class Disk(object):
         return not self.__ne__(other)
 
     def __ne__(self, other):
-        if type(self) != type(other):
+        if not isinstance(self, other.__class__):
             return True
 
         if getattr(other, "__hash__", None):
diff --git a/src/parted/filesystem.py b/src/parted/filesystem.py
index 8a2d0b1..1dac080 100644
--- a/src/parted/filesystem.py
+++ b/src/parted/filesystem.py
@@ -62,7 +62,7 @@ class FileSystem(object):
         return not self.__ne__(other)
 
     def __ne__(self, other):
-        if type(self) != type(other):
+        if not isinstance(self, other.__class__):
             return True
 
         if getattr(other, "__hash__", None):
diff --git a/src/parted/geometry.py b/src/parted/geometry.py
index 679667e..fa2886c 100644
--- a/src/parted/geometry.py
+++ b/src/parted/geometry.py
@@ -67,7 +67,7 @@ class Geometry(object):
         return not self.__ne__(other)
 
     def __ne__(self, other):
-        if type(self) != type(other):
+        if not isinstance(self, other.__class__):
             return True
 
         if getattr(other, "__hash__", None):
diff --git a/src/parted/partition.py b/src/parted/partition.py
index 1bb9dc1..1b84491 100644
--- a/src/parted/partition.py
+++ b/src/parted/partition.py
@@ -72,7 +72,7 @@ class Partition(object):
         return not self.__ne__(other)
 
     def __ne__(self, other):
-        if type(self) != type(other):
+        if not isinstance(self, other.__class__):
             return True
 
         if getattr(other, "__hash__", None):
-- 
2.2.2



More information about the anaconda-patches mailing list