From ce182c00f0f3e4b94bab3e9a0c2eee7afe301c2f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 21 Sep 2024 08:18:50 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- mesa/experimental/cell_space/cell_collection.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/mesa/experimental/cell_space/cell_collection.py b/mesa/experimental/cell_space/cell_collection.py index 2fb157a04a3..a8c36f5198f 100644 --- a/mesa/experimental/cell_space/cell_collection.py +++ b/mesa/experimental/cell_space/cell_collection.py @@ -26,9 +26,9 @@ class CellCollection(Generic[T]): """ def __init__( - self, - cells: Mapping[T, list[CellAgent]] | Iterable[T], - random: Random | None = None, + self, + cells: Mapping[T, list[CellAgent]] | Iterable[T], + random: Random | None = None, ) -> None: """Initialize a CellCollection. @@ -83,8 +83,11 @@ def select_random_agent(self) -> CellAgent: """ return self.random.choice(list(self.agents)) - - def select(self, filter_func: Callable[[T], bool] | None = None, at_most: int | float = float("inf"), ): + def select( + self, + filter_func: Callable[[T], bool] | None = None, + at_most: int | float = float("inf"), + ): """Select cells based on filter function. Args: @@ -108,7 +111,7 @@ def cell_generator(filter_func, at_most): for cell in self: if count >= at_most: break - if (not filter_func or filter_func(cell)): + if not filter_func or filter_func(cell): yield cell count += 1