Baracchino-Della-Scuola / Bot

Consider decorating method with @staticmethod PYL-R0201
Performance
Major
5 months ago2 years old
Method doesn't use the class instance and could be converted into a static method
13        self.bot = bot
14        self.tts = aiogTTS()
15
16    async def to_bytes(self, url):17        async with bot.session.get(url) as r:
18            res = await r.read()
19            return res
Method doesn't use the class instance and could be converted into a static method
 8        self.bot = bot
 9        self._last_result = None
10
11    def cleanup_code(self, content):12        """Automatically removes code blocks from the code."""
13        if content.startswith("```") and content.endswith("```"):
14            return "\n".join(content.split("\n")[1:-1])
Method doesn't use the class instance and could be converted into a static method
305    async def cog_before_invoke(self, ctx: commands.Context):
306        ctx.voice_state = self.get_voice_state(ctx)
307
308    async def cog_command_error(309        self, ctx: commands.Context, error: commands.CommandError
310    ):
311        await ctx.send("An error occurred: {}".format(str(error)))
Method doesn't use the class instance and could be converted into a static method
294        for state in self.voice_states.values():
295            self.bot.loop.create_task(state.stop())
296
297    def cog_check(self, ctx: commands.Context):298        if not ctx.guild:
299            raise commands.NoPrivateMessage(
300                "This command can't be used in DM channels."
Method doesn't use the class instance and could be converted into a static method
15    def __init__(self, bot):
16        self.bot = bot
17
18    def sanitize(self, mat):19        """Sanitize input with the best-in-class algorithm to prevent abuse"""
20        to_remove = ["self", '"', "'", "import", "prototype", "proto"]
21