From 88e951f94aa0c1780e54798b5f3af72b75502ef4 Mon Sep 17 00:00:00 2001 From: Numerlor <25886452+Numerlor@users.noreply.github.com> Date: Sat, 20 Feb 2021 01:21:42 +0100 Subject: Use "inventories" when referring to the cog's collection of sphinx invs Previously in some context inventory referred both to a single "inventory" that we got from a remote objects.inv and to the internal cog inventories. Always referring to the cog's inventories as plural The update_single docstring was also changed from rebuild to build, as the method doesn't handle anything with a preexisting inventory with the same symbols being in the cog's inventories --- bot/exts/info/doc/_cog.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/bot/exts/info/doc/_cog.py b/bot/exts/info/doc/_cog.py index b6b9b2171..ed67abb79 100644 --- a/bot/exts/info/doc/_cog.py +++ b/bot/exts/info/doc/_cog.py @@ -76,11 +76,11 @@ class DocCog(commands.Cog): async def init_refresh_inventory(self) -> None: """Refresh documentation inventory on cog initialization.""" await self.bot.wait_until_guild_available() - await self.refresh_inventory() + await self.refresh_inventories() def update_single(self, api_package_name: str, base_url: str, package: InventoryDict) -> None: """ - Rebuild the inventory for a single package. + Build the inventory for a single package. Where: * `package_name` is the package name to use, appears in the log @@ -126,7 +126,7 @@ class DocCog(commands.Cog): inventory_url: str, ) -> None: """ - Update the cog's inventory, or reschedule this method to execute again if the remote inventory is unreachable. + Update the cog's inventories, or reschedule this method to execute again if the remote inventory is unreachable. The first attempt is rescheduled to execute in `FETCH_RESCHEDULE_DELAY.first` minutes, the subsequent attempts in `FETCH_RESCHEDULE_DELAY.repeated` minutes. @@ -202,8 +202,8 @@ class DocCog(commands.Cog): self.renamed_symbols[symbol_name].append(new_symbol_name) return new_symbol_name - async def refresh_inventory(self) -> None: - """Refresh internal documentation inventory.""" + async def refresh_inventories(self) -> None: + """Refresh internal documentation inventories.""" self.refresh_event.clear() await self.symbol_get_event.wait() log.debug("Refreshing documentation inventory...") @@ -369,7 +369,7 @@ class DocCog(commands.Cog): ) self.update_single(package_name, base_url, inventory_dict) - await ctx.send(f"Added the package `{package_name}` to the database and refreshed the inventory.") + await ctx.send(f"Added the package `{package_name}` to the database and updated the inventories.") @docs_group.command(name='deletedoc', aliases=('removedoc', 'rm', 'd')) @commands.has_any_role(*MODERATION_ROLES) @@ -386,9 +386,9 @@ class DocCog(commands.Cog): async with ctx.typing(): # Rebuild the inventory to ensure that everything # that was from this package is properly deleted. - await self.refresh_inventory() + await self.refresh_inventories() await doc_cache.delete(package_name) - await ctx.send(f"Successfully deleted `{package_name}` and refreshed the inventory.") + await ctx.send(f"Successfully deleted `{package_name}` and refreshed the inventories.") @docs_group.command(name="refreshdoc", aliases=("rfsh", "r")) @commands.has_any_role(*MODERATION_ROLES) @@ -397,7 +397,7 @@ class DocCog(commands.Cog): """Refresh inventories and show the difference.""" old_inventories = set(self.base_urls) with ctx.typing(): - await self.refresh_inventory() + await self.refresh_inventories() new_inventories = set(self.base_urls) if added := ", ".join(new_inventories - old_inventories): -- cgit v1.2.3