Skip to content
This repository was archived by the owner on Aug 28, 2021. It is now read-only.

Commit

Permalink
appease the linter
Browse files Browse the repository at this point in the history
  • Loading branch information
ShineyDev committed Apr 13, 2021
1 parent cba3629 commit 1260821
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 28 deletions.
12 changes: 2 additions & 10 deletions discord/ext/ipc/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,7 @@ class Client:
The secret key for your IPC server. Must match the server secret_key or requests will not go ahead, defaults to None
"""

def __init__(
self,
host="localhost",
port=None,
multicast_port=20000,
secret_key=None
):
def __init__(self, host="localhost", port=None, multicast_port=20000, secret_key=None):
"""Constructor"""
self.loop = asyncio.get_event_loop()

Expand Down Expand Up @@ -85,9 +79,7 @@ async def init_sock(self):
port_data = recv.json()
self.port = port_data["port"]

self.websocket = await self.session.ws_connect(
self.url, autoping=False, autoclose=False
)
self.websocket = await self.session.ws_connect(self.url, autoping=False, autoclose=False)
log.info("Client connected to %s", self.url)

return self.websocket
Expand Down
8 changes: 2 additions & 6 deletions discord/ext/ipc/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,7 @@ async def handle_accept(self, request):
headers = request.get("headers")

if not headers or headers.get("Authorization") != self.secret_key:
log.info(
"Received unauthorized request (Invalid or no token provided)."
)
log.info("Received unauthorized request (Invalid or no token provided).")
response = {"error": "Invalid or no token provided.", "code": 403}
else:
if not endpoint or endpoint not in self.endpoints:
Expand Down Expand Up @@ -257,8 +255,6 @@ def start(self):
self._multicast_server = aiohttp.web.Application()
self._multicast_server.router.add_route("GET", "/", self.handle_multicast)

self.loop.run_until_complete(
self.__start(self._multicast_server, self.multicast_port)
)
self.loop.run_until_complete(self.__start(self._multicast_server, self.multicast_port))

self.loop.run_until_complete(self.__start(self._server, self.port))
4 changes: 1 addition & 3 deletions examples/basic-ipc/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ async def on_ipc_error(self, endpoint, error):

@my_bot.ipc.route()
async def get_member_count(data):
guild = my_bot.get_guild(
data.guild_id
) # get the guild object using parsed guild_id
guild = my_bot.get_guild(data.guild_id) # get the guild object using parsed guild_id

return guild.member_count # return the member count to the client

Expand Down
4 changes: 1 addition & 3 deletions examples/basic-ipc/webserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@


app = Quart(__name__)
ipc_client = ipc.Client(
secret_key="my_secret_key"
) # secret_key must be the same as your server
ipc_client = ipc.Client(secret_key="my_secret_key") # secret_key must be the same as your server


@app.route("/")
Expand Down
4 changes: 1 addition & 3 deletions examples/cog_based_ipc/cogs/ipc.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ def __init__(self, bot):

@ipc.server.route()
async def get_member_count(self, data):
guild = self.bot.get_guild(
data.guild_id
) # get the guild object using parsed guild_id
guild = self.bot.get_guild(data.guild_id) # get the guild object using parsed guild_id

return guild.member_count # return the member count to the client

Expand Down
4 changes: 1 addition & 3 deletions examples/cog_based_ipc/webserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@


app = Quart(__name__)
ipc_client = ipc.Client(
secret_key="my_secret_key"
) # secret_key must be the same as your server
ipc_client = ipc.Client(secret_key="my_secret_key") # secret_key must be the same as your server


@app.route("/")
Expand Down

0 comments on commit 1260821

Please sign in to comment.