FIX Coordinate().getNeighbours() min/maxY
All checks were successful
Publish to PyPI / Publish to PyPI (push) Successful in 1m4s
All checks were successful
Publish to PyPI / Publish to PyPI (push) Successful in 1m4s
FIX Coordinate() not hashable after implementing __eq__
This commit is contained in:
parent
42cbf6f85c
commit
b2cc1e814c
@ -187,7 +187,7 @@ class Coordinate(tuple):
|
||||
nb_list = [(-1, 0), (1, 0), (0, -1), (0, 1)]
|
||||
|
||||
for dx, dy in nb_list:
|
||||
if minX <= self[0] + dx <= maxX and minY <= self[0] + dy <= maxY:
|
||||
if minX <= self[0] + dx <= maxX and minY <= self[1] + dy <= maxY:
|
||||
yield self.__class__(self[0] + dx, self[1] + dy)
|
||||
else:
|
||||
if includeDiagonal:
|
||||
@ -261,6 +261,9 @@ class Coordinate(tuple):
|
||||
else:
|
||||
return self.__class__(-self[0], -self[1], -self[2])
|
||||
|
||||
def __hash__(self) -> int:
|
||||
return hash((self[0], self[1], self[2]))
|
||||
|
||||
def __eq__(self, other: Coordinate | tuple) -> bool:
|
||||
if self[2] is None:
|
||||
return self[0] == other[0] and self[1] == other[1]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user