Make zerver/views/webhooks/jira.py pass mypy check.

This commit is contained in:
Eklavya Sharma 2016-05-17 09:49:00 +05:30
parent 5f053e0047
commit 16067b7013
2 changed files with 4 additions and 5 deletions

View File

@ -25,7 +25,6 @@ zerver/lib/statistics.py
zerver/middleware.py
zerver/migrations/
zerver/tests/
zerver/views/webhooks/jira.py
zilencer/models.py
""".split()

View File

@ -43,16 +43,16 @@ def convert_jira_markup(content, realm):
# Wrapping a block of code in {quote}stuff{quote} also block-quotes it
quote_re = re.compile(r'{quote}(.*?){quote}', re.DOTALL)
content = re.sub(quote_re, r'~~~ quote\n\1\n~~~', content)
content = re.sub(quote_re, r'~~~ quote\n\1\n~~~', content) # type: ignore # https://github.com/python/typeshed/issues/160
# {noformat}stuff{noformat} blocks are just code blocks with no
# syntax highlighting
noformat_re = re.compile(r'{noformat}(.*?){noformat}', re.DOTALL)
content = re.sub(noformat_re, r'~~~\n\1\n~~~', content)
content = re.sub(noformat_re, r'~~~\n\1\n~~~', content) # type: ignore # https://github.com/python/typeshed/issues/160
# Code blocks are delineated by {code[: lang]} {code}
code_re = re.compile(r'{code[^\n]*}(.*?){code}', re.DOTALL)
content = re.sub(code_re, r'~~~\n\1\n~~~', content)
content = re.sub(code_re, r'~~~\n\1\n~~~', content) # type: ignore # https://github.com/python/typeshed/issues/160
# Links are of form: [https://www.google.com] or [Link Title|https://www.google.com]
# In order to support both forms, we don't match a | in bare links
@ -60,7 +60,7 @@ def convert_jira_markup(content, realm):
# Full links which have a | are converted into a better markdown link
full_link_re = re.compile(r'\[(?:(?P<title>[^|~]+)\|)(?P<url>.*)\]')
content = re.sub(full_link_re, r'[\g<title>](\g<url>)', content)
content = re.sub(full_link_re, r'[\g<title>](\g<url>)', content) # type: ignore # https://github.com/python/typeshed/issues/160
# Try to convert a JIRA user mention of format [~username] into a
# Zulip user mention. We don't know the email, just the JIRA username,