From 61bdb5b322f6dab8c1b35b515a5f945bd19935df Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Wed, 29 Nov 2017 10:00:55 -0600 Subject: [PATCH] Remove __eq__ and __hash__ on geometry objects --- openmc/cell.py | 26 -------------------------- openmc/lattice.py | 38 -------------------------------------- openmc/surface.py | 3 --- openmc/universe.py | 18 ------------------ 4 files changed, 85 deletions(-) diff --git a/openmc/cell.py b/openmc/cell.py index d962c27253..5975d7f70b 100644 --- a/openmc/cell.py +++ b/openmc/cell.py @@ -108,32 +108,6 @@ class Cell(IDManagerMixin): else: return point in self.region - def __eq__(self, other): - if not isinstance(other, Cell): - return False - elif self.id != other.id: - return False - elif self.name != other.name: - return False - elif self.fill != other.fill: - return False - elif self.region != other.region: - return False - elif self.rotation != other.rotation: - return False - elif self.temperature != other.temperature: - return False - elif self.translation != other.translation: - return False - else: - return True - - def __ne__(self, other): - return not self == other - - def __hash__(self): - return hash(repr(self)) - def __repr__(self): string = 'Cell\n' string += '{: <16}=\t{}\n'.format('\tID', self.id) diff --git a/openmc/lattice.py b/openmc/lattice.py index 3d078bd014..79f0d43f3b 100644 --- a/openmc/lattice.py +++ b/openmc/lattice.py @@ -517,24 +517,6 @@ class RectLattice(Lattice): # Initialize Lattice class attributes self._lower_left = None - def __eq__(self, other): - if not isinstance(other, RectLattice): - return False - elif not super(RectLattice, self).__eq__(other): - return False - elif self.shape != other.shape: - return False - elif np.any(self.lower_left != other.lower_left): - return False - else: - return True - - def __ne__(self, other): - return not self == other - - def __hash__(self): - return hash(repr(self)) - def __repr__(self): string = 'RectLattice\n' string += '{0: <16}{1}{2}\n'.format('\tID', '=\t', self._id) @@ -864,26 +846,6 @@ class HexLattice(Lattice): self._num_axial = None self._center = None - def __eq__(self, other): - if not isinstance(other, HexLattice): - return False - elif not super(HexLattice, self).__eq__(other): - return False - elif self.num_rings != other.num_rings: - return False - elif self.num_axial != other.num_axial: - return False - elif self.center != other.center: - return False - else: - return True - - def __ne__(self, other): - return not self == other - - def __hash__(self): - return hash(repr(self)) - def __repr__(self): string = 'HexLattice\n' string += '{0: <16}{1}{2}\n'.format('\tID', '=\t', self._id) diff --git a/openmc/surface.py b/openmc/surface.py index 961ac4d459..6c29ed458c 100644 --- a/openmc/surface.py +++ b/openmc/surface.py @@ -79,9 +79,6 @@ class Surface(IDManagerMixin): def __pos__(self): return Halfspace(self, '+') - def __hash__(self): - return hash(repr(self)) - def __repr__(self): string = 'Surface\n' string += '{0: <16}{1}{2}\n'.format('\tID', '=\t', self._id) diff --git a/openmc/universe.py b/openmc/universe.py index cb6574f98f..7d9f5a29f4 100644 --- a/openmc/universe.py +++ b/openmc/universe.py @@ -63,24 +63,6 @@ class Universe(IDManagerMixin): if cells is not None: self.add_cells(cells) - def __eq__(self, other): - if not isinstance(other, Universe): - return False - elif self.id != other.id: - return False - elif self.name != other.name: - return False - elif dict.__ne__(self.cells, other.cells): - return False - else: - return True - - def __ne__(self, other): - return not self == other - - def __hash__(self): - return hash(repr(self)) - def __repr__(self): string = 'Universe\n' string += '{0: <16}{1}{2}\n'.format('\tID', '=\t', self._id)