mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-09 04:38:55 -05:00
[Downloader] Move author key handling to RepoJSONMixin, fix NameError (#3285)
* Update downloader.py * Update json_mixins.py * Update installable.py * changelog pt 1 * changelog pt2 * edit of changelog pt1 * edit of changelog pt 2 (last commit before review) * Kidding, this is the last one before review.
This commit is contained in:
parent
f5949f2664
commit
af859aa755
1
changelog.d/downloader/3285.misc.1.rst
Normal file
1
changelog.d/downloader/3285.misc.1.rst
Normal file
@ -0,0 +1 @@
|
||||
Fix `NameError` in :func:`redbot.cogs.downloader.downloader.Downloader._filter_incorrect_cogs_by_names()`.
|
||||
1
changelog.d/downloader/3285.misc.2.rst
Normal file
1
changelog.d/downloader/3285.misc.2.rst
Normal file
@ -0,0 +1 @@
|
||||
Move handling of ``author`` key in ``info.json`` to :func:`redbot.cogs.downloader.json_mixins.RepoJSONMixin`.
|
||||
@ -1094,7 +1094,7 @@ class Downloader(commands.Cog):
|
||||
if name_already_used:
|
||||
message += _(
|
||||
"\nSome cogs with these names are already installed from different repos: "
|
||||
) + humanize_list(already_installed)
|
||||
) + humanize_list(name_already_used)
|
||||
correct_cogs, add_to_message = self._filter_incorrect_cogs(cogs)
|
||||
if add_to_message:
|
||||
return correct_cogs, f"{message}{add_to_message}"
|
||||
|
||||
@ -86,7 +86,6 @@ class Installable(RepoJSONMixin):
|
||||
self.repo_name = self._location.parent.stem
|
||||
self.commit = commit
|
||||
|
||||
self.author: Tuple[str, ...] = ()
|
||||
self.min_bot_version = red_version_info
|
||||
self.max_bot_version = red_version_info
|
||||
self.min_python_version = (3, 5, 1)
|
||||
@ -171,12 +170,6 @@ class Installable(RepoJSONMixin):
|
||||
else:
|
||||
self._info = info
|
||||
|
||||
try:
|
||||
author = tuple(info.get("author", []))
|
||||
except ValueError:
|
||||
author = ()
|
||||
self.author = author
|
||||
|
||||
try:
|
||||
min_bot_version = VersionInfo.from_str(str(info.get("min_bot_version", __version__)))
|
||||
except ValueError:
|
||||
|
||||
@ -9,7 +9,7 @@ class RepoJSONMixin:
|
||||
def __init__(self, repo_folder: Path):
|
||||
self._repo_folder = repo_folder
|
||||
|
||||
self.author: Optional[Tuple[str, ...]] = None
|
||||
self.author: Tuple[str, ...] = ()
|
||||
self.install_msg: Optional[str] = None
|
||||
self.short: Optional[str] = None
|
||||
self.description: Optional[str] = None
|
||||
@ -32,7 +32,12 @@ class RepoJSONMixin:
|
||||
else:
|
||||
self._info = info
|
||||
|
||||
self.author = info.get("author")
|
||||
try:
|
||||
author = tuple(info.get("author", []))
|
||||
except ValueError:
|
||||
author = ()
|
||||
self.author = author
|
||||
|
||||
self.install_msg = info.get("install_msg")
|
||||
self.short = info.get("short")
|
||||
self.description = info.get("description")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user