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:
parent
17c5e28727
commit
fbcd4b9767
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user