mirror of https://github.com/zulip/zulip.git
zerver/lib/bugdown/__init__.py: Fix non-string annotations.
This commit is contained in:
parent
eafb91719c
commit
a485d63975
|
@ -30,11 +30,12 @@ from django.conf import settings
|
|||
|
||||
from zerver.lib.avatar import gravatar_hash
|
||||
from zerver.lib.bugdown import codehilite
|
||||
from zerver.lib.bugdown import fenced_code # type: ignore # excluding fenced_code from checks
|
||||
from zerver.lib.bugdown import fenced_code
|
||||
from zerver.lib.bugdown.fenced_code import FENCE_RE
|
||||
from zerver.lib.camo import get_camo_url
|
||||
from zerver.lib.timeout import timeout, TimeoutExpired
|
||||
from zerver.lib.cache import cache_with_key, cache_get_many, cache_set_many
|
||||
from zerver.models import Message
|
||||
import zerver.lib.alert_words as alert_words
|
||||
import zerver.lib.mention as mention
|
||||
import six
|
||||
|
@ -1087,7 +1088,7 @@ def _sanitize_for_log(md):
|
|||
|
||||
# Filters such as UserMentionPattern need a message, but python-markdown
|
||||
# provides no way to pass extra params through to a pattern. Thus, a global.
|
||||
current_message = None # type: Any # Should be Message but bugdown doesn't import models.py.
|
||||
current_message = None # type: Optional[Message]
|
||||
|
||||
# We avoid doing DB queries in our markdown thread to avoid the overhead of
|
||||
# opening a new DB connection. These connections tend to live longer than the
|
||||
|
@ -1095,7 +1096,7 @@ current_message = None # type: Any # Should be Message but bugdown doesn't impor
|
|||
db_data = None # type: Dict[text_type, Any]
|
||||
|
||||
def do_convert(md, realm_domain=None, message=None):
|
||||
# type: ignore # (markdown.Markdown, Optional[text_type], Message) -> Optional[text_type]
|
||||
# type: (markdown.Markdown, Optional[text_type], Optional[Message]) -> Optional[text_type]
|
||||
"""Convert Markdown to HTML, with Zulip-specific settings and hacks."""
|
||||
from zerver.models import get_active_user_dicts_in_realm, UserProfile
|
||||
|
||||
|
@ -1173,7 +1174,7 @@ def bugdown_stats_finish():
|
|||
bugdown_total_time += (time.time() - bugdown_time_start)
|
||||
|
||||
def convert(md, realm_domain=None, message=None):
|
||||
# type: (markdown.Markdown, Optional[text_type], Optional[text_type]) -> Optional[text_type]
|
||||
# type: (markdown.Markdown, Optional[text_type], Optional[Message]) -> Optional[text_type]
|
||||
bugdown_stats_start()
|
||||
ret = do_convert(md, realm_domain, message)
|
||||
bugdown_stats_finish()
|
||||
|
|
Loading…
Reference in New Issue