"""Return repository information if any.""" import json from aiogithubapi import AIOGitHubException, AIOGitHub from custom_components.hacs.handler.template import render_template from custom_components.hacs.hacsbase.exceptions import HacsException def info_file(repository): """get info filename.""" if repository.data.render_readme: for filename in ["readme", "readme.md", "README", "README.md", "README.MD"]: if filename in repository.treefiles: return filename return "" for filename in ["info", "info.md", "INFO", "INFO.md", "INFO.MD"]: if filename in repository.treefiles: return filename return "" async def get_info_md_content(repository): """Get the content of info.md""" filename = info_file(repository) if not filename: return "" try: info = await repository.repository_object.get_contents(filename, repository.ref) if info is None: return "" info = info.content.replace("