Skip to content

Commit cc78197

Browse files
committed
Lint files
1 parent 230e1d9 commit cc78197

File tree

7 files changed

+17
-18
lines changed

7 files changed

+17
-18
lines changed

seekers/game/camp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
@dataclasses.dataclass
77
class Camp:
88
id: str
9-
owner: "Player"
9+
owner: object
1010
position: Vector
1111
width: float
1212
height: float

seekers/game/game.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
from seekers import draw
2020

2121

22-
class GameFullError(Exception): ...
22+
class GameFullError(Exception):
23+
...
2324

2425

2526
class SeekersGame:
@@ -42,8 +43,8 @@ def __init__(self, local_ai_locations: typing.Iterable[str], config: Config,
4243
self._logger.warning("Config option `global.wait-for-players=false` is not supported for local players.")
4344

4445
if grpc_address and len(self.players) < config.global_players:
46+
from seekers.grpc.server import GrpcSeekersServer
4547
try:
46-
from .grpc.server import GrpcSeekersServer
4748
self.grpc = GrpcSeekersServer(self, grpc_address)
4849
except ImportError as e:
4950
self._logger.warning("gRPC server could not be started. Import error.", exc_info=e)
@@ -61,6 +62,7 @@ def __init__(self, local_ai_locations: typing.Iterable[str], config: Config,
6162
)
6263
self.animations = []
6364

65+
self.clock = None
6466
self.ticks = 0
6567

6668
def start(self):

seekers/game/goal.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class Goal(Physical):
88
def __init__(self, scoring_time: float, base_thrust: float, *args, **kwargs):
99
Physical.__init__(self, *args, **kwargs)
1010

11-
self.owner: "Player | None" = None
11+
self.owner = None
1212
self.time_owned: int = 0
1313

1414
self.scoring_time = scoring_time
@@ -40,4 +40,3 @@ def camp_tick(self, camp: "Camp") -> bool:
4040
self.owner = camp.owner
4141

4242
return self.time_owned >= self.scoring_time
43-

seekers/game/physical.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,3 @@ def collision(self, other: "Physical", world: "World"):
5656
if ddn < min_dist:
5757
self.position += dn * (ddn - min_dist)
5858
other.position -= dn * (ddn - min_dist)
59-

seekers/game/seeker.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ def disabled(self):
7979
return self.is_disabled
8080

8181
def magnetic_force(self, world: World, pos: Vector) -> Vector:
82-
def bump(r) -> float:
83-
return math.exp(1 / (r ** 2 - 1)) if r < 1 else 0
82+
def bump(difference) -> float:
83+
return math.exp(1 / (difference ** 2 - 1)) if difference < 1 else 0
8484

8585
torus_diff = world.torus_difference(self.position, pos)
8686
torus_diff_len = torus_diff.length()
@@ -131,4 +131,3 @@ def set_magnet_disabled(self):
131131
@property
132132
def max_speed(self):
133133
return self.base_thrust / self.friction
134-

seekers/game/world.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ def middle(self) -> Vector:
3434
return self.geometry / 2
3535

3636
def torus_difference(self, left: Vector, right: Vector, /) -> Vector:
37-
def diff1d(l, a, b):
37+
def diff1d(length, a, b):
3838
delta = abs(a - b)
39-
return b - a if delta < l - delta else a - b
39+
return b - a if delta < length - delta else a - b
4040

4141
return Vector(diff1d(self.width, left.x, right.x),
4242
diff1d(self.height, left.y, right.y))

seekers/tests/test_seekers.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import unittest
44

55
from seekers import Config
6-
from seekers.seekers_types import LocalPlayerAi
6+
from seekers.game.player import LocalPlayerAi
77
from seekers.game import SeekersGame
88
from seekers.grpc.client import GrpcSeekersServiceWrapper, GrpcSeekersClient
99

@@ -34,7 +34,7 @@ def test_speed_consistency(self):
3434

3535
for speed in 1, 1, 10, 10, 20, 40:
3636
with self.subTest(msg=f"Speed: {speed}", speed=speed):
37-
new_scores = nogrpc_game(
37+
new_scores = no_grpc_game(
3838
playtime=2000,
3939
speed=speed,
4040
players=2,
@@ -107,7 +107,7 @@ def grpc_game(playtime: int, speed: int, players: int, seed: int, filepaths: lis
107107
return {player.name: player.score for player in game.players.values()}
108108

109109

110-
def nogrpc_game(playtime: int, speed: int, players: int, seed: int, filepaths: list[str]) -> dict[str, int]:
110+
def no_grpc_game(playtime: int, speed: int, players: int, seed: int, filepaths: list[str]) -> dict[str, int]:
111111
config = Config.from_filepath("config.ini")
112112

113113
config.global_fps = 1000
@@ -143,11 +143,11 @@ def test_grpc(self):
143143
address="localhost:7778"
144144
)
145145

146-
def test_grpc_nogrpc_consistency(self):
147-
"""Test that the outcome of a game is the same for grpc and nogrpc."""
146+
def test_grpc_no_grpc_consistency(self):
147+
"""Test that the outcome of a game is the same for grpc and no grpc."""
148148
for seed in 40, 41, 42, 43, 44, 45:
149149
with self.subTest(msg=f"Seed: {seed}", seed=seed):
150-
nogrpc_scores = nogrpc_game(
150+
no_grpc_scores = no_grpc_game(
151151
playtime=2000,
152152
speed=10,
153153
players=2,
@@ -164,7 +164,7 @@ def test_grpc_nogrpc_consistency(self):
164164
address="localhost:7778"
165165
)
166166

167-
self.assertEqual(grpc_scores, nogrpc_scores,
167+
self.assertEqual(grpc_scores, no_grpc_scores,
168168
msg=f"Outcome of gRPC and non-gRPC games with seed {seed} is different.")
169169

170170

0 commit comments

Comments
 (0)