|
|
@ -101,9 +101,14 @@ class Node: |
|
|
|
|
|
|
|
|
|
|
|
def __eq__(self, other): |
|
|
|
def __eq__(self, other): |
|
|
|
"""Checks equality of node name and kind. Does not check pin connections. |
|
|
|
"""Checks equality of node name and kind. Does not check pin connections. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This is ok, because (name, kind) is unique within a circuit. |
|
|
|
""" |
|
|
|
""" |
|
|
|
return self.name == other.name and self.kind == other.kind |
|
|
|
return self.name == other.name and self.kind == other.kind |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def __hash__(self): |
|
|
|
|
|
|
|
return hash((self.name, self.kind)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Line: |
|
|
|
class Line: |
|
|
|
"""A line is a directional 1:1 connection between two nodes. |
|
|
|
"""A line is a directional 1:1 connection between two nodes. |
|
|
@ -181,6 +186,9 @@ class Line: |
|
|
|
return self.driver == other.driver and self.driver_pin == other.driver_pin and \ |
|
|
|
return self.driver == other.driver and self.driver_pin == other.driver_pin and \ |
|
|
|
self.reader == other.reader and self.reader_pin == other.reader_pin |
|
|
|
self.reader == other.reader and self.reader_pin == other.reader_pin |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def __hash__(self): |
|
|
|
|
|
|
|
return hash((self.driver, self.driver_pin, self.reader, self.reader_pin)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Circuit: |
|
|
|
class Circuit: |
|
|
|
"""A Circuit is a container for interconnected nodes and lines. |
|
|
|
"""A Circuit is a container for interconnected nodes and lines. |
|
|
|