mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-05 04:50:12 +03:00
Adding flake8 corrections
This commit is contained in:
parent
15351afa3a
commit
da63f5e82d
|
@ -6,10 +6,10 @@ from __future__ import unicode_literals
|
||||||
import datetime
|
import datetime
|
||||||
import decimal
|
import decimal
|
||||||
import json
|
import json
|
||||||
from json.encoder import (FLOAT_REPR, INFINITY, c_make_encoder,
|
|
||||||
encode_basestring_ascii, encode_basestring,
|
|
||||||
_make_iterencode)
|
|
||||||
import uuid
|
import uuid
|
||||||
|
from json.encoder import (FLOAT_REPR, INFINITY, _make_iterencode,
|
||||||
|
c_make_encoder, encode_basestring,
|
||||||
|
encode_basestring_ascii)
|
||||||
|
|
||||||
from django.db.models.query import QuerySet
|
from django.db.models.query import QuerySet
|
||||||
from django.utils import six, timezone
|
from django.utils import six, timezone
|
||||||
|
@ -55,7 +55,7 @@ class JSONEncoder(json.JSONEncoder):
|
||||||
return _orig_encoder(o)
|
return _orig_encoder(o)
|
||||||
|
|
||||||
def floatstr(o, allow_nan=self.allow_nan,
|
def floatstr(o, allow_nan=self.allow_nan,
|
||||||
_repr=FLOAT_REPR, _inf=INFINITY, _neginf=-INFINITY):
|
_repr=FLOAT_REPR, _inf=INFINITY, _neginf=-INFINITY):
|
||||||
# Check for specials. Note that this type of test is processor
|
# Check for specials. Note that this type of test is processor
|
||||||
# and/or platform-specific, so do tests which don't depend on the
|
# and/or platform-specific, so do tests which don't depend on the
|
||||||
# internals.
|
# internals.
|
||||||
|
@ -76,7 +76,6 @@ class JSONEncoder(json.JSONEncoder):
|
||||||
|
|
||||||
return text
|
return text
|
||||||
|
|
||||||
|
|
||||||
if (_one_shot and c_make_encoder is not None
|
if (_one_shot and c_make_encoder is not None
|
||||||
and self.indent is None):
|
and self.indent is None):
|
||||||
_iterencode = c_make_encoder(
|
_iterencode = c_make_encoder(
|
||||||
|
@ -124,7 +123,7 @@ class JSONEncoder(json.JSONEncoder):
|
||||||
elif hasattr(obj, 'tolist'):
|
elif hasattr(obj, 'tolist'):
|
||||||
# Numpy arrays and array scalars.
|
# Numpy arrays and array scalars.
|
||||||
return obj.tolist()
|
return obj.tolist()
|
||||||
elif (coreapi is not None) and isinstance(obj, (coreapi.Document,
|
elif (coreapi is not None) and isinstance(obj, (coreapi.Document,
|
||||||
coreapi.Error)):
|
coreapi.Error)):
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
'Cannot return a coreapi object from a JSON view. '
|
'Cannot return a coreapi object from a JSON view. '
|
||||||
|
|
Loading…
Reference in New Issue
Block a user