From 882b0386f288bfc757f261e0af0c2a4e8d4e3f78 Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Fri, 1 Mar 2024 23:43:46 -0500 Subject: [PATCH] fix(pterodactyl): pylint fixes --- pterodactyl/pterodactyl.py | 8 ++++---- pterodactyl/websocket.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pterodactyl/pterodactyl.py b/pterodactyl/pterodactyl.py index 3a76323..23ddab3 100644 --- a/pterodactyl/pterodactyl.py +++ b/pterodactyl/pterodactyl.py @@ -118,7 +118,7 @@ class Pterodactyl(commands.Cog): current_status = await config.current_status() if current_status == "running": return await ctx.send("Server is already running.") - elif current_status in ["starting", "stopping"]: + if current_status in ["starting", "stopping"]: return await ctx.send("Another power action is already in progress.") message = await ctx.send("Sending websocket command to start server...") await self.websocket.send(json.dumps({"event": "set state", "args": ["start"]})) @@ -130,7 +130,7 @@ class Pterodactyl(commands.Cog): current_status = await config.current_status() if current_status == "stopped": return await ctx.send("Server is already stopped.") - elif current_status in ["starting", "stopping"]: + if current_status in ["starting", "stopping"]: return await ctx.send("Another power action is already in progress.") message = await ctx.send("Sending websocket command to stop server...") await self.websocket.send(json.dumps({"event": "set state", "args": ["stop"]})) @@ -325,6 +325,6 @@ class Pterodactyl(commands.Cog): **Achievement Regex:** {box(achievement_regex, 're')}""" await ctx.send(embed=embed) - def get_bool_str(self, bool: bool) -> str: + def get_bool_str(self, inp: bool) -> str: """Return a string representation of a boolean.""" - return "Enabled" if bool else "Disabled" + return "Enabled" if inp else "Disabled" diff --git a/pterodactyl/websocket.py b/pterodactyl/websocket.py index aac1823..353e224 100644 --- a/pterodactyl/websocket.py +++ b/pterodactyl/websocket.py @@ -254,8 +254,8 @@ async def generate_achievement_embed(username: str, achievement: str, challenge: return embed def mask_ip(string: str) -> str: - def mask_ip(match): + def check(match): ip = match.group(0) masked_ip = '.'.join(r'\*' * len(octet) for octet in ip.split('.')) return masked_ip - return re.sub(r'\b(?:\d{1,3}\.){3}\d{1,3}\b', mask_ip, string) + return re.sub(r'\b(?:\d{1,3}\.){3}\d{1,3}\b', check, string)