fix(seautils): pylint fixes

This commit is contained in:
Seaswimmer 2024-05-19 00:18:48 -04:00
parent d95c9b3255
commit 7ed836a1cd
Signed by untrusted user: cswimr
GPG key ID: 5D671B5D03D65A7F

View file

@ -38,7 +38,7 @@ class SeaUtils(commands.Cog):
] ]
return "\n".join(text) return "\n".join(text)
def format_src(self, ctx: commands.Context, obj: Any) -> str: def format_src(self, obj: Any) -> str:
"""A large portion of this code is repurposed from Zephyrkul's RTFS cog. """A large portion of this code is repurposed from Zephyrkul's RTFS cog.
https://github.com/Zephyrkul/FluffyCogs/blob/master/rtfs/rtfs.py""" https://github.com/Zephyrkul/FluffyCogs/blob/master/rtfs/rtfs.py"""
obj = inspect.unwrap(obj) obj = inspect.unwrap(obj)
@ -55,15 +55,15 @@ class SeaUtils(commands.Cog):
@commands.command(aliases=["source", "src", "code", "showsource"]) @commands.command(aliases=["source", "src", "code", "showsource"])
@commands.is_owner() @commands.is_owner()
async def showcode(self, ctx: commands.Context, *, object: str): async def showcode(self, ctx: commands.Context, *, object: str): # pylint: disable=redefined-builtin
"""Show the code for a particular object.""" """Show the code for a particular object."""
try: try:
if object.startswith("/") and (obj := ctx.bot.tree.get_command(object[1:])): if object.startswith("/") and (obj := ctx.bot.tree.get_command(object[1:])):
text = self.format_src(ctx, obj) text = self.format_src(obj)
elif obj := ctx.bot.get_cog(object): elif obj := ctx.bot.get_cog(object):
text = self.format_src(ctx, type(obj)) text = self.format_src(type(obj))
elif obj := ctx.bot.get_command(object): elif obj := ctx.bot.get_command(object):
text = self.format_src(ctx, obj) text = self.format_src(obj)
temp_content = cf.pagify( temp_content = cf.pagify(
text=cleanup_code(text), text=cleanup_code(text),
escape_mass_mentions=True, escape_mass_mentions=True,