GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 0254c9...47ea54 )
by
unknown
01:26
created

GpgNetClientProtocol   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 18
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A send_GameState() 0 5 1
A send_ProcessNatPacket() 0 7 1
A send_gpgnet_message() 0 3 1
1
from abc import ABCMeta, abstractmethod
2
3
4
from typing import List, Union
0 ignored issues
show
Configuration introduced by
The import typing could not be resolved.

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
5
from server.abc.base_game import InitMode
0 ignored issues
show
Bug introduced by
The name abc does not seem to exist in module server.
Loading history...
Configuration introduced by
The import server.abc.base_game could not be resolved.

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
6
7
8
class GpgNetServerProtocol(metaclass=ABCMeta):
0 ignored issues
show
Unused Code introduced by
This abstract class does not seem to be used anywhere.
Loading history...
9
    """
10
    Defines an interface for the server side GPGNet protocol
11
    """
12
    def send_CreateLobby(self, init_mode: InitMode, port: int, login: str, uid: int, natTraversalProvider: int):
13
        """
14
        Tells the client to create a new LobbyComm instance and have it listen on the given port number
15
        :type init_mode: Whether to use ranked or ladder mode for the in game lobby
16
        :type port: The port number for the client to listen on
17
        :type login: The username of the player
18
        :type uid: The identifier of the player
19
        :type natTraversalProvider: A number representing the nat-traversal-provider, typically 1
20
        """
21
        self.send_gpgnet_message('CreateLobby', [int(init_mode.value), port, login, uid, natTraversalProvider])
22
23
    def send_ConnectToPeer(self, address_and_port: str, player_name: str, player_uid: int):
24
        """
25
        Tells a client that has a listening LobbyComm instance to connect to the given peer
26
        :param address_and_port: String of the form "adress:port"
27
        :param player_name: Remote player name
28
        :param player_uid: Remote player identifier
29
        """
30
        self.send_gpgnet_message('ConnectToPeer', [address_and_port, player_name, player_uid])
31
32
    def send_JoinGame(self, address_and_port: str, remote_player_name: str, remote_player_uid: int):
33
        """
34
        Tells the game to join the given peer by address_and_port
35
        :param address_and_port:
36
        :param remote_player_name:
37
        :param remote_player_uid:
38
        """
39
        self.send_gpgnet_message('JoinGame', [address_and_port, remote_player_name, remote_player_uid])
40
41
    def send_HostGame(self, map):
0 ignored issues
show
Bug Best Practice introduced by
This seems to re-define the built-in map.

It is generally discouraged to redefine built-ins as this makes code very hard to read.

Loading history...
42
        """
43
        Tells the game to start listening for incoming connections as a host
44
        :param map: Which scenario to use
45
        """
46
        self.send_gpgnet_message('HostGame', [str(map)])
47
48
    def send_SendNatPacket(self, address_and_port: str, message: str):
49
        """
50
        Instructs the game to send a nat-traversal UDP packet to the given remote address and port.
51
52
        The game will send the message verbatim as UDP-datagram prefixed with a \0x08 byte.
53
        :param address_and_port:
54
        :param message:
55
        """
56
        self.send_gpgnet_message('SendNatPacket', [address_and_port, message])
57
58
    def send_DisconnectFromPeer(self, id: int):
0 ignored issues
show
Bug Best Practice introduced by
This seems to re-define the built-in id.

It is generally discouraged to redefine built-ins as this makes code very hard to read.

Loading history...
59
        """
60
        Instructs the game to disconnect from the peer given by id
61
62
        :param id:
63
        :return:
64
        """
65
        self.send_gpgnet_message('DisconnectFromPeer', [id])
66
67
68
    def send_Ping(self):
69
        """
70
        Heartbeat pinging used between the FAF client and server
71
        :return:
72
        """
73
        self.send_gpgnet_message('ping', [])
74
75
    def send_gpgnet_message(self, command_id, arguments):
76
        message = {"command": command_id, "args": arguments}
77
        self.send_message(message)
78
79
    @abstractmethod
80
    def send_message(self, message):
81
        pass  # pragma: no cover
82
83
84
class GpgNetClientProtocol(metaclass=ABCMeta):
0 ignored issues
show
Unused Code introduced by
This abstract class does not seem to be used anywhere.
Loading history...
85
    def send_GameState(self, arguments: List[Union[int, str, bool]]) -> None:
86
        """
87
        Sent by the client when the state of LobbyComm changes
88
        """
89
        self.send_gpgnet_message('GameState', arguments)
90
91
    def send_ProcessNatPacket(self, arguments: List[Union[int, str, bool]]) -> None:
92
        """
93
        Sent by the client when it received a nat packet
94
        :param arguments:
95
        :return:
96
        """
97
        self.send_gpgnet_message('ProcessNatPacket', arguments)
98
99
    @abstractmethod
100
    def send_gpgnet_message(self, command_id, arguments: List[Union[int, str, bool]]) -> None:
101
        pass  # pragma: no cover
102