feat(repo): make all cogs pylance-typechecking compliant
Some checks failed
Actions / Lint Code (Ruff & Pylint) (push) Failing after 43s
Actions / Build Documentation (MkDocs) (push) Failing after 24s

at `basic` level, does not include Aurora as it's being rewritten in the `aurora/v3` branch
This commit is contained in:
cswimr 2025-02-01 16:57:45 +00:00
parent ea0b7937f8
commit 2a5b924409
Signed by: cswimr
GPG key ID: 0EC431A8DA8F8087
11 changed files with 184 additions and 139 deletions

View file

@ -26,7 +26,7 @@ class Backup(commands.Cog):
__author__ = ["[cswimr](https://www.coastalcommits.com/cswimr)"]
__git__ = "https://www.coastalcommits.com/cswimr/SeaCogs"
__version__ = "1.1.2"
__version__ = "1.1.3"
__documentation__ = "https://seacogs.coastalcommits.com/backup/"
def __init__(self, bot: Red):
@ -45,14 +45,15 @@ class Backup(commands.Cog):
]
return "\n".join(text)
@commands.group(autohelp=True)
@commands.group(autohelp=True) # type: ignore
@commands.is_owner()
async def backup(self, ctx: commands.Context):
async def backup(self, ctx: commands.Context) -> None:
"""Backup your installed cogs."""
pass
@backup.command(name="export")
@commands.is_owner()
async def backup_export(self, ctx: commands.Context):
async def backup_export(self, ctx: commands.Context) -> None:
"""Export your installed repositories and cogs to a file."""
downloader = ctx.bot.get_cog("Downloader")
if downloader is None:
@ -91,13 +92,13 @@ class Backup(commands.Cog):
@backup.command(name="import")
@commands.is_owner()
async def backup_import(self, ctx: commands.Context):
async def backup_import(self, ctx: commands.Context) -> None:
"""Import your installed repositories and cogs from an export file."""
try:
export = json.loads(await ctx.message.attachments[0].read())
except (json.JSONDecodeError, IndexError):
try:
export = json.loads(await ctx.message.reference.resolved.attachments[0].read())
export = json.loads(await ctx.message.reference.resolved.attachments[0].read()) # type: ignore - this is fine to let error because it gets handled
except (json.JSONDecodeError, IndexError, AttributeError):
await ctx.send(error("Please provide a valid JSON export file."))
return