Skip to content

Commit

Permalink
Merge pull request projectmesa#984 from rht/type
Browse files Browse the repository at this point in the history
Migrate away from type comments
  • Loading branch information
Corvince authored Feb 5, 2021
2 parents e8757cf + 727152f commit ef250a7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions mesa/space.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ def __init__(self, width: int, height: int, torus: bool) -> None:
self.width = width
self.torus = torus

self.grid = [] # type: List[List[GridContent]]
self.grid: List[List[GridContent]] = []

for x in range(self.width):
col = [] # type: List[GridContent]
col: List[GridContent] = []
for y in range(self.height):
col.append(self.default_val())
self.grid.append(col)
Expand Down Expand Up @@ -163,7 +163,7 @@ def iter_neighborhood(
"""
x, y = pos
coordinates = set() # type: Set[Coordinate]
coordinates: Set[Coordinate] = set()
for dy in range(-radius, radius + 1):
for dx in range(-radius, radius + 1):
if dx == 0 and dy == 0 and not include_center:
Expand Down Expand Up @@ -401,7 +401,7 @@ def exists_empty_cells(self) -> bool:
class SingleGrid(Grid):
""" Grid where each cell contains exactly at most one object. """

empties = set() # type: Set[Coordinate]
empties: Set[Coordinate] = set()

def __init__(self, width: int, height: int, torus: bool) -> None:
"""Create a new single-item grid.
Expand Down Expand Up @@ -687,8 +687,8 @@ def __init__(
self.torus = torus

self._agent_points = None
self._index_to_agent = {} # type: Dict[int, Agent]
self._agent_to_index = {} # type: Dict[Agent, int]
self._index_to_agent: Dict[int, Agent] = {}
self._agent_to_index: Dict[Agent, int] = {}

def place_agent(self, agent: Agent, pos: FloatCoordinate) -> None:
"""Place a new agent in the space.
Expand Down
4 changes: 2 additions & 2 deletions mesa/time.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ def __init__(self, model: Model) -> None:
""" Create a new, empty BaseScheduler. """
self.model = model
self.steps = 0
self.time = 0 # type: TimeT
self._agents = OrderedDict() # type: Dict[int, Agent]
self.time: TimeT = 0
self._agents: Dict[int, Agent] = OrderedDict()

def add(self, agent: Agent) -> None:
"""Add an Agent object to the schedule.
Expand Down

0 comments on commit ef250a7

Please sign in to comment.