Skip to content

Commit

Permalink
space: Improve typing for NetworkGrid
Browse files Browse the repository at this point in the history
  • Loading branch information
rht committed Jan 26, 2024
1 parent d87df79 commit 2d5ee33
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mesa/space.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1559,7 +1559,7 @@ class NetworkGrid:
"""Returns a bool of the contents of a cell."""
return self.G.nodes[node_id]["agent"] == self.default_val()
def get_cell_list_contents(self, cell_list: list[int]) -> list[Agent]:
def get_cell_list_contents(self, cell_list: list[int] | nx.Graph) -> list[Agent]:
"""Returns a list of the agents contained in the nodes identified
in `cell_list`; nodes with empty content are excluded.
"""
Expand All @@ -1569,7 +1569,7 @@ class NetworkGrid:
"""Returns a list of all the agents in the network."""
return self.get_cell_list_contents(self.G)
def iter_cell_list_contents(self, cell_list: list[int]) -> Iterator[Agent]:
def iter_cell_list_contents(self, cell_list: list[int] | nx.Graph) -> Iterator[Agent]:
"""Returns an iterator of the agents contained in the nodes identified
in `cell_list`; nodes with empty content are excluded.
"""
Expand Down

0 comments on commit 2d5ee33

Please sign in to comment.