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 23, 2024
1 parent e000097 commit 43b2a7b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
11 changes: 9 additions & 2 deletions mesa/experimental/signals/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
"""Functionality for Observables."""

from .observable_collections import ObservableList
from .signal import All, HasObservables, Observable, Computable, Computed
from .signal import All, Computable, Computed, HasObservables, Observable

__all__ = ["Observable", "ObservableList", "HasObservables", "All", "Computable", "Computed"]
__all__ = [
"Observable",
"ObservableList",
"HasObservables",
"All",
"Computable",
"Computed",
]
8 changes: 4 additions & 4 deletions mesa/experimental/signals/signal.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ def __init__(self):

# fixme can we make this an innerclass enum?
# or some SignalTypes helper class?
self.signal_types: set = {"on_change", }
self.signal_types: set = {

Check warning on line 75 in mesa/experimental/signals/signal.py

View check run for this annotation

Codecov / codecov/patch

mesa/experimental/signals/signal.py#L75

Added line #L75 was not covered by tests
"on_change",
}
self.fallback_value = None # fixme, should this be user specifiable

Check warning on line 78 in mesa/experimental/signals/signal.py

View check run for this annotation

Codecov / codecov/patch

mesa/experimental/signals/signal.py#L78

Added line #L78 was not covered by tests

def __set__(self, instance: HasObservables, value): # noqa D103
Expand Down Expand Up @@ -260,9 +262,7 @@ def __new__(cls, *args, **kwargs): # noqa D102
# we have signal_type as a key
# we want weakrefs for the callable

obj.subscribers = defaultdict(
functools.partial(defaultdict, list)
)
obj.subscribers = defaultdict(functools.partial(defaultdict, list))

Check warning on line 265 in mesa/experimental/signals/signal.py

View check run for this annotation

Codecov / codecov/patch

mesa/experimental/signals/signal.py#L265

Added line #L265 was not covered by tests

return obj

Check warning on line 267 in mesa/experimental/signals/signal.py

View check run for this annotation

Codecov / codecov/patch

mesa/experimental/signals/signal.py#L267

Added line #L267 was not covered by tests

Expand Down
7 changes: 6 additions & 1 deletion mesa/experimental/signals/test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# noqa D100
# https://github.com/projectmesa/mesa-examples/blob/main/examples/boltzmann_wealth_model_experimental/model.py
import mesa
from mesa.experimental.signals import HasObservables, Observable, ObservableList, Computable, Computed
from mesa.experimental.signals import (

Check warning on line 4 in mesa/experimental/signals/test.py

View check run for this annotation

Codecov / codecov/patch

mesa/experimental/signals/test.py#L3-L4

Added lines #L3 - L4 were not covered by tests
Computable,
Computed,
HasObservables,
Observable,
)


def compute_gini(model): # noqa D103
Expand Down

0 comments on commit 43b2a7b

Please sign in to comment.