From 3e441559242f28e247fafe71c3e35a593fd15c36 Mon Sep 17 00:00:00 2001 From: Hari Date: Thu, 21 Mar 2024 12:01:12 +0100 Subject: [PATCH] Update node.py --- pathfinding3d/core/node.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/pathfinding3d/core/node.py b/pathfinding3d/core/node.py index 8b564f1..29b42fc 100644 --- a/pathfinding3d/core/node.py +++ b/pathfinding3d/core/node.py @@ -101,7 +101,7 @@ class GridNode(Node): # Set it to None if you only have one grid. grid_id: Optional[int] = None - connections: Optional[List] = None + connections: List["GridNode"] = dataclasses.field(default_factory=list) def __post_init__(self): super().__init__() @@ -126,7 +126,4 @@ def connect(self, other_node: "GridNode"): other_node : GridNode The node to connect to. """ - if not self.connections: - self.connections = [other_node] - else: - self.connections.append(other_node) + self.connections.append(other_node)