Sanic does not support Python 3.5 and won't need this code. (#1670)

* imports code cleanup as we dropping python3.5 support
This commit is contained in:
L. Kärkkäinen 2019-09-09 00:08:34 +03:00 committed by 7
parent 17c5e28727
commit fbcd4b9767
2 changed files with 2 additions and 11 deletions

View File

@ -1,7 +1,5 @@
import asyncio
import email.utils
import json
import sys
import warnings
from collections import defaultdict, namedtuple
@ -23,14 +21,7 @@ from sanic.log import error_logger, logger
try:
from ujson import loads as json_loads
except ImportError:
if sys.version_info[:2] == (3, 5):
def json_loads(data):
# on Python 3.5 json.loads only supports str not bytes
return json.loads(data.decode())
else:
json_loads = json.loads
from json import loads as json_loads
DEFAULT_HTTP_CONTENT_TYPE = "application/octet-stream"
EXPECT_HEADER = "EXPECT"

View File

@ -12,7 +12,7 @@ from sanic.helpers import STATUS_CODES, has_message_body, remove_entity_headers
try:
from ujson import dumps as json_dumps
except BaseException:
except ImportError:
from json import dumps
# This is done in order to ensure that the JSON response is