KOSASIH / SilkRoad

Unnecessary else / elif used after return PYL-R1705
Style
Major
5 months ago5 months old
Unnecessary "elif" after "return", remove the leading "el" from "elif"
141        await self.receive_chat_message(message)
142
143async def video_api_app(request):
144    if request.method == "GET":145        # Get the current state of the video API
146        return sanic.response.json({"chat_messages": video_api.chat_messages})
147    elif request.method == "POST":
Unnecessary "elif" after "return", remove the leading "el" from "elif"
141        await self.receive_chat_message(message)
142
143async def video_api_app(request):
144    if request.method == "GET":145        # Get the current state of the video API
146        return sanic.response.json({"chat_messages": video_api.chat_messages})
147    elif request.method == "POST":
Unnecessary "elif" after "return", remove the leading "el" from "elif"
145    room_name = request.match_info["room_name"]
146    user_id = request.match_info["user_id"]
147
148    if request.method == "POST":149        # Create an offer
150        sdp = await app.video_chats[room_name].create_offer()
151        return sanic.response.json({"sdp": sdp})
Unnecessary "elif" after "return", remove the leading "el" from "elif"
119    room_name = request.match_info["room_name"]
120    user_id = request.match_info["user_id"]
121
122    if request.method == "GET":123        # Get the current state of the video chat
124        video_chat = app.video_chats[room_name]
125        return sanic.response.json({"chat_messages": video_chat.chat_messages, "viewers": len(video_chat.viewers)})
Unnecessary "elif" after "return", remove the leading "el" from "elif"
145    room_name = request.match_info["room_name"]
146    user_id = request.match_info["user_id"]
147
148    if request.method == "POST":149        # Create an offer
150        sdp = await app.video_chats[room_name].create_offer()
151        return sanic.response.json({"sdp": sdp})