From b38e4e57f7775605b5a48aa718d22dcddc4f4eb0 Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Tue, 7 Mar 2017 12:25:49 +1300 Subject: [PATCH] booby trap all the __eq__ methods I am preeeetttty sure they are never used --- subiquity/models/actions.py | 75 ++++-------------------------------- subiquity/models/blockdev.py | 25 +----------- 2 files changed, 10 insertions(+), 90 deletions(-) diff --git a/subiquity/models/actions.py b/subiquity/models/actions.py index 3a116c70..d93b2539 100644 --- a/subiquity/models/actions.py +++ b/subiquity/models/actions.py @@ -31,16 +31,7 @@ class DiskAction(): __hash__ = None def __eq__(self, other): - if isinstance(other, self.__class__): - return (self._action_id == other._action_id and - self.parent == other.parent and - self._ptable == other._ptable and - self._model == other._model and - self._serial == other._serial and - self._wipe == other._wipe and - self._type == other._type) - else: - return False + 1/0 def get_parent(self): return self.parent @@ -98,15 +89,7 @@ class RaidAction(DiskAction): __hash__ = None def __eq__(self, other): - if isinstance(other, self.__class__): - return (self._action_id == other._action_id and - self.parent == other.parent and - self._raidlevel == other._raidlevel and - self._devices == other._devices and - self._spares == other._spares and - self._type == other._type) - else: - return False + 1/0 def get(self): action = { @@ -131,14 +114,7 @@ class LVMVolGroupAction(DiskAction): __hash__ = None def __eq__(self, other): - if isinstance(other, self.__class__): - return (self._action_id == other._action_id and - self.parent == other.parent and - self._volgroup == other._volgroup and - self._devices == other._devices and - self._type == other._type) - else: - return False + 1/0 def get(self): action = { @@ -170,14 +146,7 @@ class LVMPartitionAction(DiskAction): __hash__ = None def __eq__(self, other): - if isinstance(other, self.__class__): - return (self._action_id == other._action_id and - self.parent == other.parent and - self._lvmpartition == other._lvmpartition and - self._devices == other._devices and - self._type == other._type) - else: - return False + 1/0 def get(self): action = { @@ -215,16 +184,7 @@ class PartitionAction(DiskAction): __hash__ = None def __eq__(self, other): - if isinstance(other, self.__class__): - return (self._action_id == other._action_id and - self.parent == other.parent and - self.partnum == other.partnum and - self._offset == other._offset and - self._size == other._size and - self.flags == other.flags and - self._type == other._type) - else: - return False + 1/0 @property def path(self): @@ -273,14 +233,7 @@ class BcacheAction(DiskAction): return self._cache_device def __eq__(self, other): - if isinstance(other, self.__class__): - return (self._action_id == other._action_id and - self.parent == other.parent and - self.backing_device == other.backing_device and - self.cache_device == other.cache_device and - self._type == other._type) - else: - return False + 1/0 def get(self): return { @@ -304,13 +257,7 @@ class FormatAction(DiskAction): __hash__ = None def __eq__(self, other): - if isinstance(other, self.__class__): - return (self._action_id == other._action_id and - self.parent == other.parent and - self._fstype == other._fstype and - self._type == other._type) - else: - return False + 1/0 @property def fstype(self): @@ -335,13 +282,7 @@ class MountAction(DiskAction): __hash__ = None def __eq__(self, other): - if isinstance(other, self.__class__): - return (self._action_id == other._action_id and - self.parent == other.parent and - self._path == other._path and - self._type == other._type) - else: - return False + 1/0 @property def path(self): diff --git a/subiquity/models/blockdev.py b/subiquity/models/blockdev.py index 0adf7402..1c3ddfcd 100644 --- a/subiquity/models/blockdev.py +++ b/subiquity/models/blockdev.py @@ -49,22 +49,10 @@ class Disk(): self._partitions = OrderedDict() def __eq__(self, other): - if isinstance(other, self.__class__): - print('disk same class, checking members') - return (self._devpath == other._devpath and - self._serial == other._serial and - self._parttype == other._parttype and - self._model == other._model and - self._size == other._size and - self._partitions == other._partitions) - else: - return False + 1/0 __hash__ = None # declare we don't supply a hash - def __ne__(self, other): - return not self.__eq__(other) - def _get_size(self, devpath, size): if size: return size @@ -137,16 +125,7 @@ class Blockdev(): self.disk.parttype) def __eq__(self, other): - if isinstance(other, self.__class__): - return (self.disk == other.disk and - self._filesystems == other._filesystems and - self._mounts == other._mounts and - self._mountactions == other._mountactions and - self.bcache == other.bcache and - self.lvm == other.lvm and - self.baseaction == other.baseaction) - else: - return False + 1/0 __hash__ = None # declare we don't supply a hash