diff --git a/redbot/cogs/downloader/downloader.py b/redbot/cogs/downloader/downloader.py index fc496f0c7ed..2f171b7284a 100644 --- a/redbot/cogs/downloader/downloader.py +++ b/redbot/cogs/downloader/downloader.py @@ -648,14 +648,18 @@ async def _repo_list(self, ctx: commands.Context) -> None: joined = _("There are no repos installed.") else: if len(repos) > 1: - joined = _("# Installed Repos\n") + joined = _("## Installed Repos\n") else: - joined = _("# Installed Repo\n") + joined = _("## Installed Repo\n") for repo in sorted_repos: - joined += "+ {}: {}\n".format(repo.name, repo.short or "") + joined += "- **{}:** {}\n - {}\n".format( + repo.name, + repo.short or "", + "<{}>".format(repo.url), + ) for page in pagify(joined, ["\n"], shorten_by=16): - await ctx.send(box(page.lstrip(" "), lang="markdown")) + await ctx.send(page) @repo.command(name="info") async def _repo_info(self, ctx: commands.Context, repo: Repo) -> None: diff --git a/redbot/cogs/trivia/data/lists/harrypotter.yaml b/redbot/cogs/trivia/data/lists/harrypotter.yaml index de377e32d3f..e83b28e9e84 100644 --- a/redbot/cogs/trivia/data/lists/harrypotter.yaml +++ b/redbot/cogs/trivia/data/lists/harrypotter.yaml @@ -98,6 +98,7 @@ What are draco's parents' names?: - Narcissa and Lucious What book does Hermione insist Ron and Harry read?: - Hogwarts, A History +- Hogwarts A History What breed was Hagrid's pet dragon?: - Norwegian Ridgeback What color are unicorn foals?: @@ -194,7 +195,7 @@ What is Severus Snape's mother's first name?: What is Tonks's first name?: - Nymphadora What is considered Harry's 'trademark spell'?: -- Expelliarmus. +- Expelliarmus What is the Hogwarts School motto in English?: - Never Tickle a Sleeping Dragon What is the age requirement for an Apparation License?: @@ -222,6 +223,7 @@ What is the name of Dumbledore's phoenix?: - fawkes What is the name of Filch's cat?: - Mrs. Norris +- Mrs Norris What is the name of Harry Potter’s pet owl?: - Hedwig What is the name of Harry's aunt?: @@ -609,4 +611,4 @@ How many hours into the past do Harry and Hermione travel in an attempt to rescu - Three How many muggles did Peter Pettigrew kill when he faked his own death?: - 12 -- Twelve \ No newline at end of file +- Twelve diff --git a/redbot/cogs/trivia/trivia.py b/redbot/cogs/trivia/trivia.py index ea319b06005..b4ab7e5aaed 100644 --- a/redbot/cogs/trivia/trivia.py +++ b/redbot/cogs/trivia/trivia.py @@ -29,6 +29,7 @@ UNIQUE_ID = 0xB3C0E453 _ = Translator("Trivia", __file__) +YAMLSafeLoader = getattr(yaml, "CSafeLoader", yaml.SafeLoader) class InvalidListError(Exception): @@ -759,7 +760,7 @@ async def _save_trivia_list( return buffer = io.BytesIO(await attachment.read()) - trivia_dict = yaml.safe_load(buffer) + trivia_dict = yaml.load(buffer, YAMLSafeLoader) TRIVIA_LIST_SCHEMA.validate(trivia_dict) buffer.seek(0) @@ -803,7 +804,7 @@ def get_core_lists() -> List[pathlib.Path]: return list(core_lists_path.glob("*.yaml")) -def get_list(path: pathlib.Path) -> Dict[str, Any]: +def get_list(path: pathlib.Path, *, validate_schema: bool = True) -> Dict[str, Any]: """ Returns a trivia list dictionary from the given path. @@ -814,12 +815,14 @@ def get_list(path: pathlib.Path) -> Dict[str, Any]: """ with path.open(encoding="utf-8") as file: try: - trivia_dict = yaml.safe_load(file) + trivia_dict = yaml.load(file, YAMLSafeLoader) except yaml.error.YAMLError as exc: raise InvalidListError("YAML parsing failed.") from exc - try: - TRIVIA_LIST_SCHEMA.validate(trivia_dict) - except schema.SchemaError as exc: - raise InvalidListError("The list does not adhere to the schema.") from exc + if validate_schema: + try: + TRIVIA_LIST_SCHEMA.validate(trivia_dict) + except schema.SchemaError as exc: + raise InvalidListError("The list does not adhere to the schema.") from exc + return trivia_dict