Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Black formatting (no spaces for power operator) #1160

Merged
merged 1 commit into from
Feb 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/sugarscape_cg/sugarscape_cg/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def get_distance(pos_1, pos_2):
x2, y2 = pos_2
dx = x1 - x2
dy = y1 - y2
return math.sqrt(dx ** 2 + dy ** 2)
return math.sqrt(dx**2 + dy**2)


class SsAgent(Agent):
Expand Down
2 changes: 1 addition & 1 deletion mesa/space.py
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,7 @@ def get_neighbors(
deltas = np.minimum(deltas, self.size - deltas)
dists = deltas[:, 0] ** 2 + deltas[:, 1] ** 2

(idxs,) = np.where(dists <= radius ** 2)
(idxs,) = np.where(dists <= radius**2)
neighbors = [
self._index_to_agent[x] for x in idxs if include_center or dists[x] > 0
]
Expand Down
2 changes: 1 addition & 1 deletion tests/test_space.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def test_distance_calculations(self):

pos_6 = (-30, -29)
pos_7 = (21, -5)
assert self.space.get_distance(pos_6, pos_7) == np.sqrt(49 ** 2 + 24 ** 2)
assert self.space.get_distance(pos_6, pos_7) == np.sqrt(49**2 + 24**2)

def test_heading(self):
pos_1 = (-30, -30)
Expand Down