Add pep8 formatter

This commit is contained in:
Dane Johnson 2023-02-14 08:25:27 -06:00
parent 528c98587e
commit b45e3e4dad

View File

@ -1,6 +1,5 @@
from flask import Flask, request, session
from flask_socketio import SocketIO, emit, join_room
import requests
from gencode import make_code
from game import Game
@ -10,19 +9,18 @@ socketio = SocketIO(app, cors_allowed_origins="*")
games = {}
## Display
# Display
@socketio.on('new-game')
def on_newgame():
data = {}
session.room = make_code()
session.game = Game(session.room)
games[session.room] = session.game
join_room(session.room)
emit('set-code', {'code': session.room})
## Contestant
# Contestant
@socketio.on('contestant-join')
def on_join_contestant(data):
sid = request.sid
@ -31,10 +29,11 @@ def on_join_contestant(data):
join_room(session.room)
session.game = games[session.room]
session.game.add_contestant(sid, signature)
emit('contestant-joined', {'sid': sid, 'signature': signature }, to=session.room)
emit('contestant-joined', {'sid': sid,
'signature': signature}, to=session.room)
## Host
# Host
@socketio.on('host-join')
def on_join_host(data):
sid = request.sid
@ -44,13 +43,17 @@ def on_join_host(data):
session.game.add_host(sid)
emit('host-joined', {'sid': sid}, to=session.room)
@socketio.on('host-start')
def on_host_start():
session.game.get_questions()
emit('categories', [c.name for c in session.game.categories[:6]], to=session.room)
emit('categories', [
c.name for c in session.game.categories[:6]], to=session.room)
def main():
socketio.run(app, host='0.0.0.0', debug=True)
if __name__ == '__main__':
main()