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
Pull Request — develop (#238)
by
unknown
01:21
created

GpgNetServerProtocol.send_DisconnectFromPeer()   A

Complexity

Conditions 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
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, 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 player_name: Remote player name
27
        :param player_uid: Remote player identifier
28
        """
29
        self.send_gpgnet_message('ConnectToPeer', [player_name, player_uid])
30
31
    def send_JoinGame(self, remote_player_name: str, remote_player_uid: int):
32
        """
33
        Tells the game to join the given peer by ID
34
        :param remote_player_name:
35
        :param remote_player_uid:
36
        """
37
        self.send_gpgnet_message('JoinGame', [remote_player_name, remote_player_uid])
38
39
    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...
40
        """
41
        Tells the game to start listening for incoming connections as a host
42
        :param map: Which scenario to use
43
        """
44
        self.send_gpgnet_message('HostGame', [str(map)])
45
46
    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...
47
        """
48
        Instructs the game to disconnect from the peer given by id
49
50
        :param id:
51
        :return:
52
        """
53
        self.send_gpgnet_message('DisconnectFromPeer', [id])
54
55
    def send_Ping(self):
56
        """
57
        Heartbeat pinging used between the FAF client and server
58
        :return:
59
        """
60
        self.send_gpgnet_message('ping', [])
61
62
    def send_gpgnet_message(self, command_id, arguments):
63
        message = {"command": command_id, "args": arguments}
64
        self.send_message(message)
65
66
    @abstractmethod
67
    def send_message(self, message):
68
        pass  # pragma: no cover
69
70
71
class GpgNetClientProtocol(metaclass=ABCMeta):
0 ignored issues
show
Unused Code introduced by
This abstract class does not seem to be used anywhere.
Loading history...
72
    def send_GameState(self, arguments: List[Union[int, str, bool]]) -> None:
73
        """
74
        Sent by the client when the state of LobbyComm changes
75
        """
76
        self.send_gpgnet_message('GameState', arguments)
77
78
    def send_ProcessNatPacket(self, arguments: List[Union[int, str, bool]]) -> None:
79
        """
80
        Sent by the client when it received a nat packet
81
        :param arguments:
82
        :return:
83
        """
84
        self.send_gpgnet_message('ProcessNatPacket', arguments)
85
86
    @abstractmethod
87
    def send_gpgnet_message(self, command_id, arguments: List[Union[int, str, bool]]) -> None:
88
        pass  # pragma: no cover
89