From dd64d04e2cb04dd2721e1ca11aa2ca0830b2e08a Mon Sep 17 00:00:00 2001 From: Magnesium12 Date: Sun, 11 Sep 2022 20:29:22 +0530 Subject: [PATCH] chore(github): Change syntax and fix typing in convert_links method. --- bot/github/github_parsers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bot/github/github_parsers.py b/bot/github/github_parsers.py index d2fa3a7..0948fd1 100644 --- a/bot/github/github_parsers.py +++ b/bot/github/github_parsers.py @@ -601,9 +601,9 @@ def convert_links(x: str) -> str: :return: Formatted text. """ reg: str = r'\[([a-zA-Z0-9!@#$%^&*,./?\'";:_=~` ]+)\]\(([(http(s)?):\/\/(www\.)?a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b[-a-zA-Z0-9@:%_\+.~#?&//=]*)\)' - gh_links: list[tuple(str)] = re.findall(reg, x) + gh_links: list[tuple(str, str)] = re.findall(reg, x) for (txt, link) in gh_links: - old: str = "[" + str(txt) + "]" + "(" + str(link) + ")" + old: str = f"[{txt}]({link})" txt = str(txt).strip() link = str(link).strip() new: str = f"<{link}|{txt}>"