fix(backup): pylint fixes
All checks were successful
Actions / Lint Code (Pylint) (pull_request) Successful in 16s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 12s

This commit is contained in:
Seaswimmer 2024-01-31 14:54:36 -05:00
parent 9b930fc05b
commit 756265503c
Signed by: cswimr
GPG key ID: B8953EC01E5C4063

View file

@ -12,9 +12,9 @@ import re
from redbot.core import commands
from redbot.core.bot import Red
from redbot.core.utils.chat_formatting import error, text_to_file, inline
from redbot.cogs.downloader import errors
from redbot.cogs.downloader.converters import InstalledCog
import redbot.cogs.downloader.errors as errors
from redbot.core.utils.chat_formatting import error, text_to_file
class Backup(commands.Cog):
"""A utility to make reinstalling repositories and cogs after migrating the bot far easier."""
@ -89,7 +89,7 @@ class Backup(commands.Cog):
async with ctx.typing():
for repo in export:
# Most of this code is from the Downloader cog's repo_add funciton.
# Most of this code is from the Downloader cog.
name = repo['name']
branch = repo['branch']
url = repo['url']
@ -159,10 +159,10 @@ class Backup(commands.Cog):
with contextlib.suppress(commands.ExtensionNotLoaded):
await ctx.bot.unload_extension(cog)
await ctx.bot.remove_loaded_package(cog)
await downloader._delete_cog(poss_installed_path)
await downloader._delete_cog(poss_installed_path) # pylint: disable=protected-access
else:
uninstall_e.append(f"Failed to uninstall {cog}")
await downloader._remove_from_installed(cog_modules)
await downloader._remove_from_installed(cog_modules) # pylint: disable=protected-access
for cog in cogs:
cog_name = cog['name']
@ -177,12 +177,12 @@ class Backup(commands.Cog):
if not cogs:
install_e.append(message)
continue
failed_reqs = await downloader._install_requirements(cogs_c)
failed_reqs = await downloader._install_requirements(cogs_c) # pylint: disable=protected-access
if failed_reqs:
install_e.append(f"Failed to install {cog_name} due to missing requirements: {failed_reqs}")
continue
installed_cogs, failed_cogs = await downloader._install_cogs(cogs_c)
installed_cogs, failed_cogs = await downloader._install_cogs(cogs_c) # pylint: disable=protected-access
if repository.available_libraries:
installed_libs, failed_libs = await repository.install_libraries(target_dir=downloader.SHAREDLIB_PATH, req_target_dir=downloader.LIB_PATH)
@ -194,7 +194,7 @@ class Backup(commands.Cog):
for cog in installed_cogs:
cog.pinned = True
await downloader._save_to_installed(installed_cogs + installed_libs if installed_libs else installed_cogs)
await downloader._save_to_installed(installed_cogs + installed_libs if installed_libs else installed_cogs) # pylint: disable=protected-access
if failed_cogs:
install_e.append(f"Failed to install {failed_cogs}")
if failed_libs: