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.

Issues (125)

server.py (2 issues)

1
#!/usr/bin/env python3
2
"""
3
Usage:
4
    server.py [--nodb | --db TYPE]
5
6
Options:
7
    --nodb      Don't use a database (Use a mock.Mock). Caution: Will break things.
8
    --db TYPE   Use TYPE database driver [default: QMYSQL]
9
"""
10
11
import asyncio
12
13
import logging
14
from logging import handlers
15
import signal
16
import socket
17
18
from server.game_service import GameService
0 ignored issues
show
The name game_stats_service does not seem to exist in module server.stats.
Loading history...
Unable to import 'stats.game_stats_service' (invalid syntax (<string>, line 15))

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...
19
from server.matchmaker import MatchmakerQueue
20
from server.player_service import PlayerService
21
from server.natpacketserver import NatPacketServer
22
from server.stats.game_stats_service import GameStatsService, EventService, AchievementService
23
from server.api.api_accessor import ApiAccessor
24
import server
25
import server.config as config
26
from server.config import DB_SERVER, DB_PORT, DB_LOGIN, DB_PASSWORD, DB_NAME
27
28
if __name__ == '__main__':
29
    logger = logging.getLogger()
30
    stderr_handler = logging.StreamHandler()
31
    stderr_handler.setFormatter(logging.Formatter('%(levelname)-8s %(name)-30s %(message)s'))
32
    logger.addHandler(stderr_handler)
33
    logger.setLevel(logging.DEBUG)
34
35
    try:
36
        def signal_handler(signal, frame):
37
            logger.info("Received signal, shutting down")
38
            if not done.done():
39
                done.set_result(0)
40
41
        loop = asyncio.get_event_loop()
42
        done = asyncio.Future()
43
44
        from docopt import docopt
45
        args = docopt(__doc__, version='FAF Server')
46
47
        logger.info("Using StatsD server: ".format(config.STATSD_SERVER))
48
49
        # Make sure we can shutdown gracefully
50
        signal.signal(signal.SIGTERM, signal_handler)
51
        signal.signal(signal.SIGINT, signal_handler)
52
53
        pool_fut = asyncio.async(server.db.connect(host=DB_SERVER,
54
                                                   port=int(DB_PORT),
55
                                                   user=DB_LOGIN,
56
                                                   password=DB_PASSWORD,
57
                                                   maxsize=10,
58
                                                   db=DB_NAME,
59
                                                   loop=loop))
60
        db_pool = loop.run_until_complete(pool_fut)
61
62
        players_online = PlayerService(db_pool)
63
        api_accessor = ApiAccessor()
64
        event_service = EventService(api_accessor)
65
        achievement_service = AchievementService(api_accessor)
66
        game_stats_service = GameStatsService(event_service, achievement_service)
67
68
        natpacket_server = NatPacketServer(addresses=config.LOBBY_NAT_ADDRESSES, loop=loop)
69
        loop.run_until_complete(natpacket_server.listen())
70
        server.NatPacketServer.instance = natpacket_server
71
72
        games = GameService(players_online, game_stats_service)
73
        matchmaker_queue = MatchmakerQueue('ladder1v1', players_online, games)
74
        players_online.ladder_queue = matchmaker_queue
75
76
        ctrl_server = loop.run_until_complete(server.run_control_server(loop, players_online, games))
77
78
        lobby_server = server.run_lobby_server(('', 8001),
79
                                    players_online,
80
                                    games,
81
                                    loop)
82
83
        for sock in lobby_server.sockets:
84
            sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
85
86
        loop.run_until_complete(done)
87
        players_online.broadcast_shutdown()
88
        loop.close()
89
90
    except Exception as ex:
91
        logger.exception("Failure booting server {}".format(ex))
92