python3: Remove six.PY2/six.PY3 checks.

This commit is contained in:
Tim Abbott 2017-08-25 11:06:43 -07:00
parent 4229faf36e
commit 4b709de9c9
2 changed files with 2 additions and 14 deletions

View File

@ -9,9 +9,6 @@ exclude_lines =
raise NotImplementedError()
# Don't require coverage for test suite AssertionError -- they're usually for clarity
raise AssertionError
# Don't require coverage for Python 2/3 variations; it's impossible to cover on both
if six.PY3:
if six.PY2:
# Don't require coverage for __unicode__ statements just used for printing
def __unicode__[(]self[)]:

View File

@ -12,6 +12,7 @@ from six.moves import urllib
import re
import os.path
import glob
import html
import twitter
import platform
import time
@ -45,9 +46,6 @@ from zerver.lib.tex import render_tex
import six
from six.moves import range, html_parser
if six.PY3:
import html
# Format version of the bugdown rendering; stored along with rendered
# messages so that we can efficiently determine what needs to be re-rendered
version = 1
@ -89,13 +87,6 @@ def image_preview_enabled_for_realm():
return True
return realm.inline_image_preview
def unescape(s):
# type: (Text) -> (Text)
if six.PY2:
return html_parser.HTMLParser().unescape(s)
else: # nocoverage since coverage.py doesn't understand else statements.
return html.unescape(s)
def list_of_tlds():
# type: () -> List[Text]
# HACK we manually blacklist a few domains
@ -584,7 +575,7 @@ class InlineInterestingLinkProcessor(markdown.treeprocessors.Treeprocessor):
image_url = user.get('profile_image_url_https', user['profile_image_url'])
profile_img.set('src', image_url)
text = unescape(res['text'])
text = html.unescape(res['text'])
urls = res.get('urls', [])
user_mentions = res.get('user_mentions', [])
media = res.get('media', []) # type: List[Dict[Text, Any]]