forked from blizzthewolf/SeaCogs
fix(backup): pylint fixes
This commit is contained in:
parent
9b930fc05b
commit
756265503c
1 changed files with 8 additions and 8 deletions
|
@ -12,9 +12,9 @@ import re
|
||||||
|
|
||||||
from redbot.core import commands
|
from redbot.core import commands
|
||||||
from redbot.core.bot import Red
|
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
|
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):
|
class Backup(commands.Cog):
|
||||||
"""A utility to make reinstalling repositories and cogs after migrating the bot far easier."""
|
"""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():
|
async with ctx.typing():
|
||||||
for repo in export:
|
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']
|
name = repo['name']
|
||||||
branch = repo['branch']
|
branch = repo['branch']
|
||||||
url = repo['url']
|
url = repo['url']
|
||||||
|
@ -159,10 +159,10 @@ class Backup(commands.Cog):
|
||||||
with contextlib.suppress(commands.ExtensionNotLoaded):
|
with contextlib.suppress(commands.ExtensionNotLoaded):
|
||||||
await ctx.bot.unload_extension(cog)
|
await ctx.bot.unload_extension(cog)
|
||||||
await ctx.bot.remove_loaded_package(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:
|
else:
|
||||||
uninstall_e.append(f"Failed to uninstall {cog}")
|
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:
|
for cog in cogs:
|
||||||
cog_name = cog['name']
|
cog_name = cog['name']
|
||||||
|
@ -177,12 +177,12 @@ class Backup(commands.Cog):
|
||||||
if not cogs:
|
if not cogs:
|
||||||
install_e.append(message)
|
install_e.append(message)
|
||||||
continue
|
continue
|
||||||
failed_reqs = await downloader._install_requirements(cogs_c)
|
failed_reqs = await downloader._install_requirements(cogs_c) # pylint: disable=protected-access
|
||||||
if failed_reqs:
|
if failed_reqs:
|
||||||
install_e.append(f"Failed to install {cog_name} due to missing requirements: {failed_reqs}")
|
install_e.append(f"Failed to install {cog_name} due to missing requirements: {failed_reqs}")
|
||||||
continue
|
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:
|
if repository.available_libraries:
|
||||||
installed_libs, failed_libs = await repository.install_libraries(target_dir=downloader.SHAREDLIB_PATH, req_target_dir=downloader.LIB_PATH)
|
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:
|
for cog in installed_cogs:
|
||||||
cog.pinned = True
|
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:
|
if failed_cogs:
|
||||||
install_e.append(f"Failed to install {failed_cogs}")
|
install_e.append(f"Failed to install {failed_cogs}")
|
||||||
if failed_libs:
|
if failed_libs:
|
||||||
|
|
Loading…
Reference in a new issue