From b45e3e4dadb9ca221ace9910c7467e52aebc44bb Mon Sep 17 00:00:00 2001 From: Dane Johnson Date: Tue, 14 Feb 2023 08:25:27 -0600 Subject: [PATCH] Add pep8 formatter --- venture/app.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/venture/app.py b/venture/app.py index d6f0965..23f62b8 100644 --- a/venture/app.py +++ b/venture/app.py @@ -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()