|
11 | 11 | import contextlib
|
12 | 12 | import copy
|
13 | 13 | import operator
|
14 |
| -import warnings |
15 | 14 | import weakref
|
16 |
| -from collections import defaultdict |
17 | 15 | from collections.abc import Callable, Iterable, Iterator, MutableSet, Sequence
|
18 | 16 | from random import Random
|
19 | 17 |
|
@@ -50,19 +48,7 @@ def __init__(self, unique_id: int, model: Model) -> None:
|
50 | 48 | self.pos: Position | None = None
|
51 | 49 |
|
52 | 50 | # register agent
|
53 |
| - try: |
54 |
| - self.model.agents_[type(self)][self] = None |
55 |
| - except AttributeError: |
56 |
| - # model super has not been called |
57 |
| - self.model.agents_ = defaultdict(dict) |
58 |
| - self.model.agents_[type(self)][self] = None |
59 |
| - self.model.agentset_experimental_warning_given = False |
60 |
| - |
61 |
| - warnings.warn( |
62 |
| - "The Mesa Model class was not initialized. In the future, you need to explicitly initialize the Model by calling super().__init__() on initialization.", |
63 |
| - FutureWarning, |
64 |
| - stacklevel=2, |
65 |
| - ) |
| 51 | + self.model.agents_[type(self)][self] = None |
66 | 52 |
|
67 | 53 | def remove(self) -> None:
|
68 | 54 | """Remove and delete the agent from the model."""
|
@@ -100,8 +86,6 @@ class AgentSet(MutableSet, Sequence):
|
100 | 86 | which means that agents not referenced elsewhere in the program may be automatically removed from the AgentSet.
|
101 | 87 | """
|
102 | 88 |
|
103 |
| - agentset_experimental_warning_given = False |
104 |
| - |
105 | 89 | def __init__(self, agents: Iterable[Agent], model: Model):
|
106 | 90 | """
|
107 | 91 | Initializes the AgentSet with a collection of agents and a reference to the model.
|
|
0 commit comments