From 4b709de9c9ca4e265246a2a3c27d73c1440b26fa Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Fri, 25 Aug 2017 11:06:43 -0700 Subject: [PATCH] python3: Remove six.PY2/six.PY3 checks. --- tools/coveragerc | 3 --- zerver/lib/bugdown/__init__.py | 13 ++----------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/tools/coveragerc b/tools/coveragerc index a3fea48da4..7754ab583d 100644 --- a/tools/coveragerc +++ b/tools/coveragerc @@ -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[)]: diff --git a/zerver/lib/bugdown/__init__.py b/zerver/lib/bugdown/__init__.py index be4c4c0b64..f0969b64fe 100644 --- a/zerver/lib/bugdown/__init__.py +++ b/zerver/lib/bugdown/__init__.py @@ -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]]