Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Sep 21, 2024
1 parent e9572a6 commit ce182c0
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions mesa/experimental/cell_space/cell_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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:
Expand All @@ -108,7 +111,7 @@ def cell_generator(filter_func, at_most):
for cell in self:
if count >= at_most:
break

Check warning on line 113 in mesa/experimental/cell_space/cell_collection.py

View check run for this annotation

Codecov / codecov/patch

mesa/experimental/cell_space/cell_collection.py#L113

Added line #L113 was not covered by tests
if (not filter_func or filter_func(cell)):
if not filter_func or filter_func(cell):
yield cell
count += 1

Expand Down

0 comments on commit ce182c0

Please sign in to comment.