Skip to content

Commit

Permalink
Convert integers when floats are expected
Browse files Browse the repository at this point in the history
  • Loading branch information
ViliamVadocz committed Mar 2, 2021
1 parent a69494a commit df28dd3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tmcp/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,17 @@ def from_dict(cls, message: dict) -> Optional["TMCPMessage"]:

if action_type == ActionType.BALL:
assert isinstance(action["time"], (float, int))
msg = cls.ball_action(team, index, action["time"])
msg = cls.ball_action(team, index, float(action["time"]))
elif action_type == ActionType.BOOST:
assert isinstance(action["target"], int)
msg = cls.boost_action(team, index, action["target"])
elif action_type == ActionType.DEMO:
assert isinstance(action["target"], int)
assert isinstance(action["time"], (float, int))
msg = cls.demo_action(team, index, action["target"], action["time"])
msg = cls.demo_action(team, index, action["target"], float(action["time"]))
elif action_type == ActionType.READY:
assert isinstance(action["time"], (float, int))
msg = cls.ready_action(team, index, action["time"])
msg = cls.ready_action(team, index, float(action["time"]))
elif action_type == ActionType.DEFEND:
msg = cls.defend_action(team, index)
else:
Expand Down

0 comments on commit df28dd3

Please sign in to comment.