Commit 7b4a9fb
committed
Implement a hash method for
Objects of the `Component` type are used in `ComponentGraph` in sets. The
implicit hash method works there for now, but adding new members to the
`Component` class may make it unhashable in the future, if the added
members themselves are unhashable. Implementing an explicit hash method
here removes this burden from from future member types.
Component IDs are supposed to be unique in a microgrid, therefore hashing a
`Component` object just based on its component ID is enough.
Signed-off-by: Tiyash Basu <[email protected]>Component
1 parent 37ae22c commit 7b4a9fb
1 file changed
+8
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
128 | 136 | | |
129 | 137 | | |
130 | 138 | | |
| |||
0 commit comments