Skip to content

Commit

Permalink
Fix grpc imports
Browse files Browse the repository at this point in the history
  • Loading branch information
Kiyotoko committed Jul 31, 2024
1 parent 85bdf8c commit 230e1d9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion seekers/grpc/converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from .stubs.org.seekers.grpc.game.vector2d_pb2 import Vector2D
from .stubs.org.seekers.grpc.service.seekers_pb2 import Section

from .. import seekers_types as seekers
import seekers


def vector_to_seekers(vector: Vector2D) -> seekers.Vector:
Expand Down
10 changes: 6 additions & 4 deletions seekers/grpc/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
from .stubs.org.seekers.grpc.service.seekers_pb2_grpc import *

from .. import game
from seekers.game.player import GrpcClientPlayer
from seekers.game.config import get_id


class GrpcSeekersServicer(SeekersServicer):
Expand Down Expand Up @@ -57,7 +59,7 @@ def Command(self, request: CommandRequest, context: grpc.ServicerContext) -> Com

# check if seeker is owned by player
# noinspection PyTypeChecker
if not isinstance(seeker.owner, seekers.GrpcClientPlayer) or seeker.owner.token != request.token:
if not isinstance(seeker.owner, GrpcClientPlayer) or seeker.owner.token != request.token:
context.abort(
grpc.StatusCode.PERMISSION_DENIED,
f"Seeker with id {command.seeker_id!r} (owner player id: {seeker.owner.id!r}) "
Expand Down Expand Up @@ -96,10 +98,10 @@ def join_game(self, name: str, color: seekers.Color | None) -> tuple[str, str]:
i += 1

# create new player
new_token = seekers.get_id("Token")
player = seekers.GrpcClientPlayer(
new_token = get_id("Token")
player = GrpcClientPlayer(
token=new_token,
id=seekers.get_id("Player"),
id=get_id("Player"),
name=_requested_name,
score=0,
seekers={},
Expand Down

0 comments on commit 230e1d9

Please sign in to comment.