From 7be1b7a609112de93182cb92aefdecb45f40ed50 Mon Sep 17 00:00:00 2001 From: "wbinventor@gmail.com" Date: Tue, 1 Dec 2015 10:13:37 -0500 Subject: [PATCH] Now using hash(repr(self)) instead of hash(str(self)) in Python API --- openmc/cross.py | 4 ++-- openmc/element.py | 2 +- openmc/filter.py | 2 +- openmc/material.py | 2 +- openmc/mesh.py | 2 +- openmc/nuclide.py | 2 +- openmc/tallies.py | 2 +- openmc/universe.py | 8 ++++---- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/openmc/cross.py b/openmc/cross.py index 435557ede7..17cdc5ea66 100644 --- a/openmc/cross.py +++ b/openmc/cross.py @@ -52,7 +52,7 @@ class CrossScore(object): self.binary_op = binary_op def __hash__(self): - return hash(str(self)) + return hash(repr(self)) def __eq__(self, other): return str(other) == str(self) @@ -152,7 +152,7 @@ class CrossNuclide(object): self.binary_op = binary_op def __hash__(self): - return hash(str(self)) + return hash(repr(self)) def __eq__(self, other): return str(other) == str(self) diff --git a/openmc/element.py b/openmc/element.py index cdc422ed2b..9f04abfdab 100644 --- a/openmc/element.py +++ b/openmc/element.py @@ -58,7 +58,7 @@ class Element(object): return not self == other def __hash__(self): - return hash(str(self)) + return hash(repr(self)) def __repr__(self): string = 'Element - {0}\n'.format(self._name) diff --git a/openmc/filter.py b/openmc/filter.py index 4c058c0855..04935b8edc 100644 --- a/openmc/filter.py +++ b/openmc/filter.py @@ -81,7 +81,7 @@ class Filter(object): return not self == other def __hash__(self): - return hash(str(self)) + return hash(repr(self)) def __deepcopy__(self, memo): existing = memo.get(id(self)) diff --git a/openmc/material.py b/openmc/material.py index 9e0a6b93b3..37ebc8a77f 100644 --- a/openmc/material.py +++ b/openmc/material.py @@ -108,7 +108,7 @@ class Material(object): return not self == other def __hash__(self): - return hash(str(self)) + return hash(repr(self)) def __repr__(self): string = 'Material\n' diff --git a/openmc/mesh.py b/openmc/mesh.py index b963a25a8e..8bad6c5374 100644 --- a/openmc/mesh.py +++ b/openmc/mesh.py @@ -190,7 +190,7 @@ class Mesh(object): self._width = width def __hash__(self): - return hash(str(self)) + return hash(repr(self)) def __repr__(self): string = 'Mesh\n' diff --git a/openmc/nuclide.py b/openmc/nuclide.py index b95601bf7d..01fb2aa459 100644 --- a/openmc/nuclide.py +++ b/openmc/nuclide.py @@ -61,7 +61,7 @@ class Nuclide(object): return not self == other def __hash__(self): - return hash(str(self)) + return hash(repr(self)) def __repr__(self): string = 'Nuclide - {0}\n'.format(self._name) diff --git a/openmc/tallies.py b/openmc/tallies.py index 8498fbb5b5..197ae29495 100644 --- a/openmc/tallies.py +++ b/openmc/tallies.py @@ -190,7 +190,7 @@ class Tally(object): return not self == other def __hash__(self): - return hash(str(self)) + return hash(repr(self)) def __repr__(self): string = 'Tally\n' diff --git a/openmc/universe.py b/openmc/universe.py index 9a8262af39..0e405e9f18 100644 --- a/openmc/universe.py +++ b/openmc/universe.py @@ -95,7 +95,7 @@ class Cell(object): return not self == other def __hash__(self): - return hash(str(self)) + return hash(repr(self)) def __repr__(self): string = 'Cell\n' @@ -483,7 +483,7 @@ class Universe(object): return not self == other def __hash__(self): - return hash(str(self)) + return hash(repr(self)) def __repr__(self): string = 'Universe\n' @@ -971,7 +971,7 @@ class RectLattice(Lattice): return not self == other def __hash__(self): - return hash(str(self)) + return hash(repr(self)) def __repr__(self): string = 'RectLattice\n' @@ -1208,7 +1208,7 @@ class HexLattice(Lattice): return not self == other def __hash__(self): - return hash(str(self)) + return hash(repr(self)) def __repr__(self): string = 'HexLattice\n'