Skip to content
Snippets Groups Projects
Commit 0ef3f0fd authored by Markus Holzer's avatar Markus Holzer
Browse files

Merge branch 'bauerd/fix-custom-code-node-eq' into 'master'

Fix typo in CustomCodeNode.__eq__

See merge request !361
parents 644d2ee7 d3638918
Branches
No related merge requests found
......@@ -151,8 +151,8 @@ class CustomCodeNode(Node):
def undefined_symbols(self):
return self._symbols_read - self._symbols_defined
def __eq___(self, other):
return self._code == other._code
def __eq__(self, other):
return type(self) == type(other) and self._code == other._code
def __hash__(self):
return hash(self._code)
......
......@@ -61,6 +61,15 @@ class RNGBase(CustomCodeNode):
return ", ".join([str(s) for s in self.result_symbols]) + " \\leftarrow " + \
self._name.capitalize() + "_RNG(" + ", ".join([str(a) for a in self.args]) + ")"
def _hashable_content(self):
return (self._name, *self.result_symbols, *self.args)
def __eq__(self, other):
return type(self) == type(other) and self._hashable_content() == other._hashable_content()
def __hash__(self):
return hash(self._hashable_content())
class PhiloxTwoDoubles(RNGBase):
_name = "philox_double2"
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment