Code

Ticket #18023: remove_simplejson_absolute.diff

File remove_simplejson_absolute.diff, 48.7 KB (added by Clueless, 2 years ago)

Alternate patch, uses from __future__ import absolute_import so that we can have a simplejson.py

Line 
1diff --git a/django/utils/simplejson.py b/django/utils/simplejson.py
2new file mode 100644
3index 0000000..b265419
4--- /dev/null
5+++ b/django/utils/simplejson.py
6@@ -0,0 +1,28 @@
7+# Make sure that `from simplejson import *` isn't a circular import
8+from __future__ import absolute_import
9+
10+import warnings
11+
12+warnings.warn(
13+    "The 'django.utils.simplejson' module is deprecated, "
14+    "use 'json' from the standard library instead; "
15+    "please see the Django 1.5 release notes "
16+    "(https://docs.djangoproject.com/en/dev/releases/1.5/).",
17+    PendingDeprecationWarning)
18+
19+# Try to use the system simplejson first. If that fails, use python's standard
20+# json module.
21+try:
22+    from simplejson import *
23+    from simplejson import __version__
24+except ImportError:
25+    from json import *
26+    from json import __version__
27+
28+    try:
29+        # There is a "json" package around that is not Python's "json", so we
30+        # check for something that is only in the namespace of the version we
31+        # want.
32+        JSONDecoder
33+    except NameError:
34+        raise ImportError("Module 'json' is not from python's standard library")
35diff --git a/django/utils/simplejson/LICENSE.txt b/django/utils/simplejson/LICENSE.txt
36deleted file mode 100644
37index ad95f29..0000000
38--- a/django/utils/simplejson/LICENSE.txt
39+++ /dev/null
40@@ -1,19 +0,0 @@
41-Copyright (c) 2006 Bob Ippolito
42-
43-Permission is hereby granted, free of charge, to any person obtaining a copy of
44-this software and associated documentation files (the "Software"), to deal in
45-the Software without restriction, including without limitation the rights to
46-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
47-of the Software, and to permit persons to whom the Software is furnished to do
48-so, subject to the following conditions:
49-
50-The above copyright notice and this permission notice shall be included in all
51-copies or substantial portions of the Software.
52-
53-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
54-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
55-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
56-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
57-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
58-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
59-SOFTWARE.
60diff --git a/django/utils/simplejson/__init__.py b/django/utils/simplejson/__init__.py
61deleted file mode 100644
62index a9418da..0000000
63--- a/django/utils/simplejson/__init__.py
64+++ /dev/null
65@@ -1,353 +0,0 @@
66-r"""JSON (JavaScript Object Notation) <http://json.org> is a subset of
67-JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data
68-interchange format.
69-
70-:mod:`simplejson` exposes an API familiar to users of the standard library
71-:mod:`marshal` and :mod:`pickle` modules. It is the externally maintained
72-version of the :mod:`json` library contained in Python 2.6, but maintains
73-compatibility with Python 2.4 and Python 2.5 and (currently) has
74-significant performance advantages, even without using the optional C
75-extension for speedups.
76-
77-Encoding basic Python object hierarchies::
78-
79-    >>> import simplejson as json
80-    >>> json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}])
81-    '["foo", {"bar": ["baz", null, 1.0, 2]}]'
82-    >>> print json.dumps("\"foo\bar")
83-    "\"foo\bar"
84-    >>> print json.dumps(u'\u1234')
85-    "\u1234"
86-    >>> print json.dumps('\\')
87-    "\\"
88-    >>> print json.dumps({"c": 0, "b": 0, "a": 0}, sort_keys=True)
89-    {"a": 0, "b": 0, "c": 0}
90-    >>> from StringIO import StringIO
91-    >>> io = StringIO()
92-    >>> json.dump(['streaming API'], io)
93-    >>> io.getvalue()
94-    '["streaming API"]'
95-
96-Compact encoding::
97-
98-    >>> import simplejson as json
99-    >>> json.dumps([1,2,3,{'4': 5, '6': 7}], separators=(',',':'))
100-    '[1,2,3,{"4":5,"6":7}]'
101-
102-Pretty printing::
103-
104-    >>> import simplejson as json
105-    >>> s = json.dumps({'4': 5, '6': 7}, sort_keys=True, indent=4)
106-    >>> print '\n'.join([l.rstrip() for l in  s.splitlines()])
107-    {
108-        "4": 5,
109-        "6": 7
110-    }
111-
112-Decoding JSON::
113-
114-    >>> import simplejson as json
115-    >>> obj = [u'foo', {u'bar': [u'baz', None, 1.0, 2]}]
116-    >>> json.loads('["foo", {"bar":["baz", null, 1.0, 2]}]') == obj
117-    True
118-    >>> json.loads('"\\"foo\\bar"') == u'"foo\x08ar'
119-    True
120-    >>> from StringIO import StringIO
121-    >>> io = StringIO('["streaming API"]')
122-    >>> json.load(io)[0] == 'streaming API'
123-    True
124-
125-Specializing JSON object decoding::
126-
127-    >>> import simplejson as json
128-    >>> def as_complex(dct):
129-    ...     if '__complex__' in dct:
130-    ...         return complex(dct['real'], dct['imag'])
131-    ...     return dct
132-    ...
133-    >>> json.loads('{"__complex__": true, "real": 1, "imag": 2}',
134-    ...     object_hook=as_complex)
135-    (1+2j)
136-    >>> import decimal
137-    >>> json.loads('1.1', parse_float=decimal.Decimal) == decimal.Decimal('1.1')
138-    True
139-
140-Specializing JSON object encoding::
141-
142-    >>> import simplejson as json
143-    >>> def encode_complex(obj):
144-    ...     if isinstance(obj, complex):
145-    ...         return [obj.real, obj.imag]
146-    ...     raise TypeError("%r is not JSON serializable" % (o,))
147-    ...
148-    >>> json.dumps(2 + 1j, default=encode_complex)
149-    '[2.0, 1.0]'
150-    >>> json.JSONEncoder(default=encode_complex).encode(2 + 1j)
151-    '[2.0, 1.0]'
152-    >>> ''.join(json.JSONEncoder(default=encode_complex).iterencode(2 + 1j))
153-    '[2.0, 1.0]'
154-
155-
156-Using simplejson.tool from the shell to validate and pretty-print::
157-
158-    $ echo '{"json":"obj"}' | python -msimplejson.tool
159-    {
160-        "json": "obj"
161-    }
162-    $ echo '{ 1.2:3.4}' | python -msimplejson.tool
163-    Expecting property name: line 1 column 2 (char 2)
164-"""
165-
166-# Django modification: try to use the system version first, providing it's
167-# either of a later version of has the C speedups in place. Otherwise, fall
168-# back to our local copy.
169-
170-__version__ = '2.0.7'
171-
172-use_system_version = False
173-try:
174-    # The system-installed version has priority providing it is either not an
175-    # earlier version or it contains the C speedups.
176-    import simplejson
177-    if (simplejson.__version__.split('.') >= __version__.split('.') or
178-            hasattr(simplejson, '_speedups')):
179-        from simplejson import *
180-        use_system_version = True
181-        # Make sure we copy over the version. See #17071
182-        __version__ = simplejson.__version__
183-except ImportError:
184-    pass
185-
186-if not use_system_version:
187-    try:
188-        from json import *      # Python 2.6 preferred over local copy.
189-
190-        # There is a "json" package around that is not Python's "json", so we
191-        # check for something that is only in the namespace of the version we
192-        # want.
193-        JSONDecoder
194-
195-        use_system_version = True
196-        # Make sure we copy over the version. See #17071
197-        __version__ = json.__version__
198-    except (ImportError, NameError):
199-        pass
200-
201-# If all else fails, we have a bundled version that can be used.
202-if not use_system_version:
203-    __all__ = [
204-        'dump', 'dumps', 'load', 'loads',
205-        'JSONDecoder', 'JSONEncoder',
206-    ]
207-
208-    from django.utils.simplejson.decoder import JSONDecoder
209-    from django.utils.simplejson.encoder import JSONEncoder
210-
211-    _default_encoder = JSONEncoder(
212-        skipkeys=False,
213-        ensure_ascii=True,
214-        check_circular=True,
215-        allow_nan=True,
216-        indent=None,
217-        separators=None,
218-        encoding='utf-8',
219-        default=None,
220-    )
221-
222-    def dump(obj, fp, skipkeys=False, ensure_ascii=True, check_circular=True,
223-            allow_nan=True, cls=None, indent=None, separators=None,
224-            encoding='utf-8', default=None, **kw):
225-        """Serialize ``obj`` as a JSON formatted stream to ``fp`` (a
226-        ``.write()``-supporting file-like object).
227-
228-        If ``skipkeys`` is ``True`` then ``dict`` keys that are not basic types
229-        (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``)
230-        will be skipped instead of raising a ``TypeError``.
231-
232-        If ``ensure_ascii`` is ``False``, then the some chunks written to ``fp``
233-        may be ``unicode`` instances, subject to normal Python ``str`` to
234-        ``unicode`` coercion rules. Unless ``fp.write()`` explicitly
235-        understands ``unicode`` (as in ``codecs.getwriter()``) this is likely
236-        to cause an error.
237-
238-        If ``check_circular`` is ``False``, then the circular reference check
239-        for container types will be skipped and a circular reference will
240-        result in an ``OverflowError`` (or worse).
241-
242-        If ``allow_nan`` is ``False``, then it will be a ``ValueError`` to
243-        serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``)
244-        in strict compliance of the JSON specification, instead of using the
245-        JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``).
246-
247-        If ``indent`` is a non-negative integer, then JSON array elements and object
248-        members will be pretty-printed with that indent level. An indent level
249-        of 0 will only insert newlines. ``None`` is the most compact representation.
250-
251-        If ``separators`` is an ``(item_separator, dict_separator)`` tuple
252-        then it will be used instead of the default ``(', ', ': ')`` separators.
253-        ``(',', ':')`` is the most compact JSON representation.
254-
255-        ``encoding`` is the character encoding for str instances, default is UTF-8.
256-
257-        ``default(obj)`` is a function that should return a serializable version
258-        of obj or raise TypeError. The default simply raises TypeError.
259-
260-        To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the
261-        ``.default()`` method to serialize additional types), specify it with
262-        the ``cls`` kwarg.
263-
264-        """
265-        # cached encoder
266-        if (skipkeys is False and ensure_ascii is True and
267-            check_circular is True and allow_nan is True and
268-            cls is None and indent is None and separators is None and
269-            encoding == 'utf-8' and default is None and not kw):
270-            iterable = _default_encoder.iterencode(obj)
271-        else:
272-            if cls is None:
273-                cls = JSONEncoder
274-            iterable = cls(skipkeys=skipkeys, ensure_ascii=ensure_ascii,
275-                check_circular=check_circular, allow_nan=allow_nan, indent=indent,
276-                separators=separators, encoding=encoding,
277-                default=default, **kw).iterencode(obj)
278-        # could accelerate with writelines in some versions of Python, at
279-        # a debuggability cost
280-        for chunk in iterable:
281-            fp.write(chunk)
282-
283-
284-    def dumps(obj, skipkeys=False, ensure_ascii=True, check_circular=True,
285-            allow_nan=True, cls=None, indent=None, separators=None,
286-            encoding='utf-8', default=None, **kw):
287-        """Serialize ``obj`` to a JSON formatted ``str``.
288-
289-        If ``skipkeys`` is ``True`` then ``dict`` keys that are not basic types
290-        (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``)
291-        will be skipped instead of raising a ``TypeError``.
292-
293-        If ``ensure_ascii`` is ``False``, then the return value will be a
294-        ``unicode`` instance subject to normal Python ``str`` to ``unicode``
295-        coercion rules instead of being escaped to an ASCII ``str``.
296-
297-        If ``check_circular`` is ``False``, then the circular reference check
298-        for container types will be skipped and a circular reference will
299-        result in an ``OverflowError`` (or worse).
300-
301-        If ``allow_nan`` is ``False``, then it will be a ``ValueError`` to
302-        serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in
303-        strict compliance of the JSON specification, instead of using the
304-        JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``).
305-
306-        If ``indent`` is a non-negative integer, then JSON array elements and
307-        object members will be pretty-printed with that indent level. An indent
308-        level of 0 will only insert newlines. ``None`` is the most compact
309-        representation.
310-
311-        If ``separators`` is an ``(item_separator, dict_separator)`` tuple
312-        then it will be used instead of the default ``(', ', ': ')`` separators.
313-        ``(',', ':')`` is the most compact JSON representation.
314-
315-        ``encoding`` is the character encoding for str instances, default is UTF-8.
316-
317-        ``default(obj)`` is a function that should return a serializable version
318-        of obj or raise TypeError. The default simply raises TypeError.
319-
320-        To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the
321-        ``.default()`` method to serialize additional types), specify it with
322-        the ``cls`` kwarg.
323-
324-        """
325-        # cached encoder
326-        if (skipkeys is False and ensure_ascii is True and
327-            check_circular is True and allow_nan is True and
328-            cls is None and indent is None and separators is None and
329-            encoding == 'utf-8' and default is None and not kw):
330-            return _default_encoder.encode(obj)
331-        if cls is None:
332-            cls = JSONEncoder
333-        return cls(
334-            skipkeys=skipkeys, ensure_ascii=ensure_ascii,
335-            check_circular=check_circular, allow_nan=allow_nan, indent=indent,
336-            separators=separators, encoding=encoding, default=default,
337-            **kw).encode(obj)
338-
339-
340-    _default_decoder = JSONDecoder(encoding=None, object_hook=None)
341-
342-
343-    def load(fp, encoding=None, cls=None, object_hook=None, parse_float=None,
344-            parse_int=None, parse_constant=None, **kw):
345-        """Deserialize ``fp`` (a ``.read()``-supporting file-like object containing
346-        a JSON document) to a Python object.
347-
348-        If the contents of ``fp`` is encoded with an ASCII based encoding other
349-        than utf-8 (e.g. latin-1), then an appropriate ``encoding`` name must
350-        be specified. Encodings that are not ASCII based (such as UCS-2) are
351-        not allowed, and should be wrapped with
352-        ``codecs.getreader(fp)(encoding)``, or simply decoded to a ``unicode``
353-        object and passed to ``loads()``
354-
355-        ``object_hook`` is an optional function that will be called with the
356-        result of any object literal decode (a ``dict``). The return value of
357-        ``object_hook`` will be used instead of the ``dict``. This feature
358-        can be used to implement custom decoders (e.g. JSON-RPC class hinting).
359-
360-        To use a custom ``JSONDecoder`` subclass, specify it with the ``cls``
361-        kwarg.
362-
363-        """
364-        return loads(fp.read(),
365-            encoding=encoding, cls=cls, object_hook=object_hook,
366-            parse_float=parse_float, parse_int=parse_int,
367-            parse_constant=parse_constant, **kw)
368-
369-
370-    def loads(s, encoding=None, cls=None, object_hook=None, parse_float=None,
371-            parse_int=None, parse_constant=None, **kw):
372-        """Deserialize ``s`` (a ``str`` or ``unicode`` instance containing a JSON
373-        document) to a Python object.
374-
375-        If ``s`` is a ``str`` instance and is encoded with an ASCII based encoding
376-        other than utf-8 (e.g. latin-1) then an appropriate ``encoding`` name
377-        must be specified. Encodings that are not ASCII based (such as UCS-2)
378-        are not allowed and should be decoded to ``unicode`` first.
379-
380-        ``object_hook`` is an optional function that will be called with the
381-        result of any object literal decode (a ``dict``). The return value of
382-        ``object_hook`` will be used instead of the ``dict``. This feature
383-        can be used to implement custom decoders (e.g. JSON-RPC class hinting).
384-
385-        ``parse_float``, if specified, will be called with the string
386-        of every JSON float to be decoded. By default this is equivalent to
387-        float(num_str). This can be used to use another datatype or parser
388-        for JSON floats (e.g. decimal.Decimal).
389-
390-        ``parse_int``, if specified, will be called with the string
391-        of every JSON int to be decoded. By default this is equivalent to
392-        int(num_str). This can be used to use another datatype or parser
393-        for JSON integers (e.g. float).
394-
395-        ``parse_constant``, if specified, will be called with one of the
396-        following strings: -Infinity, Infinity, NaN, null, true, false.
397-        This can be used to raise an exception if invalid JSON numbers
398-        are encountered.
399-
400-        To use a custom ``JSONDecoder`` subclass, specify it with the ``cls``
401-        kwarg.
402-
403-        """
404-        if (cls is None and encoding is None and object_hook is None and
405-                parse_int is None and parse_float is None and
406-                parse_constant is None and not kw):
407-            return _default_decoder.decode(s)
408-        if cls is None:
409-            cls = JSONDecoder
410-        if object_hook is not None:
411-            kw['object_hook'] = object_hook
412-        if parse_float is not None:
413-            kw['parse_float'] = parse_float
414-        if parse_int is not None:
415-            kw['parse_int'] = parse_int
416-        if parse_constant is not None:
417-            kw['parse_constant'] = parse_constant
418-        return cls(encoding=encoding, **kw).decode(s)
419diff --git a/django/utils/simplejson/decoder.py b/django/utils/simplejson/decoder.py
420deleted file mode 100644
421index 5a845cc..0000000
422--- a/django/utils/simplejson/decoder.py
423+++ /dev/null
424@@ -1,345 +0,0 @@
425-"""Implementation of JSONDecoder
426-"""
427-import re
428-import sys
429-import struct
430-
431-from django.utils.simplejson.scanner import make_scanner
432-c_scanstring = None
433-
434-__all__ = ['JSONDecoder']
435-
436-FLAGS = re.VERBOSE | re.MULTILINE | re.DOTALL
437-
438-def _floatconstants():
439-    _BYTES = '7FF80000000000007FF0000000000000'.decode('hex')
440-    if sys.byteorder != 'big':
441-        _BYTES = _BYTES[:8][::-1] + _BYTES[8:][::-1]
442-    nan, inf = struct.unpack('dd', _BYTES)
443-    return nan, inf, -inf
444-
445-NaN, PosInf, NegInf = _floatconstants()
446-
447-
448-def linecol(doc, pos):
449-    lineno = doc.count('\n', 0, pos) + 1
450-    if lineno == 1:
451-        colno = pos
452-    else:
453-        colno = pos - doc.rindex('\n', 0, pos)
454-    return lineno, colno
455-
456-
457-def errmsg(msg, doc, pos, end=None):
458-    # Note that this function is called from _speedups
459-    lineno, colno = linecol(doc, pos)
460-    if end is None:
461-        return '%s: line %d column %d (char %d)' % (msg, lineno, colno, pos)
462-    endlineno, endcolno = linecol(doc, end)
463-    return '%s: line %d column %d - line %d column %d (char %d - %d)' % (
464-        msg, lineno, colno, endlineno, endcolno, pos, end)
465-
466-
467-_CONSTANTS = {
468-    '-Infinity': NegInf,
469-    'Infinity': PosInf,
470-    'NaN': NaN,
471-}
472-
473-STRINGCHUNK = re.compile(r'(.*?)(["\\\x00-\x1f])', FLAGS)
474-BACKSLASH = {
475-    '"': u'"', '\\': u'\\', '/': u'/',
476-    'b': u'\b', 'f': u'\f', 'n': u'\n', 'r': u'\r', 't': u'\t',
477-}
478-
479-DEFAULT_ENCODING = "utf-8"
480-
481-def py_scanstring(s, end, encoding=None, strict=True, _b=BACKSLASH, _m=STRINGCHUNK.match):
482-    """Scan the string s for a JSON string. End is the index of the
483-    character in s after the quote that started the JSON string.
484-    Unescapes all valid JSON string escape sequences and raises ValueError
485-    on attempt to decode an invalid string. If strict is False then literal
486-    control characters are allowed in the string.
487-   
488-    Returns a tuple of the decoded string and the index of the character in s
489-    after the end quote."""
490-    if encoding is None:
491-        encoding = DEFAULT_ENCODING
492-    chunks = []
493-    _append = chunks.append
494-    begin = end - 1
495-    while 1:
496-        chunk = _m(s, end)
497-        if chunk is None:
498-            raise ValueError(
499-                errmsg("Unterminated string starting at", s, begin))
500-        end = chunk.end()
501-        content, terminator = chunk.groups()
502-        # Content is contains zero or more unescaped string characters
503-        if content:
504-            if not isinstance(content, unicode):
505-                content = unicode(content, encoding)
506-            _append(content)
507-        # Terminator is the end of string, a literal control character,
508-        # or a backslash denoting that an escape sequence follows
509-        if terminator == '"':
510-            break
511-        elif terminator != '\\':
512-            if strict:
513-                msg = "Invalid control character %r at" % (terminator,)
514-                raise ValueError(msg, s, end)
515-            else:
516-                _append(terminator)
517-                continue
518-        try:
519-            esc = s[end]
520-        except IndexError:
521-            raise ValueError(
522-                errmsg("Unterminated string starting at", s, begin))
523-        # If not a unicode escape sequence, must be in the lookup table
524-        if esc != 'u':
525-            try:
526-                char = _b[esc]
527-            except KeyError:
528-                raise ValueError(
529-                    errmsg("Invalid \\escape: %r" % (esc,), s, end))
530-            end += 1
531-        else:
532-            # Unicode escape sequence
533-            esc = s[end + 1:end + 5]
534-            next_end = end + 5
535-            if len(esc) != 4:
536-                msg = "Invalid \\uXXXX escape"
537-                raise ValueError(errmsg(msg, s, end))
538-            uni = int(esc, 16)
539-            # Check for surrogate pair on UCS-4 systems
540-            if 0xd800 <= uni <= 0xdbff and sys.maxunicode > 65535:
541-                msg = "Invalid \\uXXXX\\uXXXX surrogate pair"
542-                if not s[end + 5:end + 7] == '\\u':
543-                    raise ValueError(errmsg(msg, s, end))
544-                esc2 = s[end + 7:end + 11]
545-                if len(esc2) != 4:
546-                    raise ValueError(errmsg(msg, s, end))
547-                uni2 = int(esc2, 16)
548-                uni = 0x10000 + (((uni - 0xd800) << 10) | (uni2 - 0xdc00))
549-                next_end += 6
550-            char = unichr(uni)
551-            end = next_end
552-        # Append the unescaped character
553-        _append(char)
554-    return u''.join(chunks), end
555-
556-
557-# Use speedup if available
558-scanstring = c_scanstring or py_scanstring
559-
560-WHITESPACE = re.compile(r'[ \t\n\r]*', FLAGS)
561-WHITESPACE_STR = ' \t\n\r'
562-
563-def JSONObject((s, end), encoding, strict, scan_once, object_hook, _w=WHITESPACE.match, _ws=WHITESPACE_STR):
564-    pairs = {}
565-    # Use a slice to prevent IndexError from being raised, the following
566-    # check will raise a more specific ValueError if the string is empty
567-    nextchar = s[end:end + 1]
568-    # Normally we expect nextchar == '"'
569-    if nextchar != '"':
570-        if nextchar in _ws:
571-            end = _w(s, end).end()
572-            nextchar = s[end:end + 1]
573-        # Trivial empty object
574-        if nextchar == '}':
575-            return pairs, end + 1
576-        elif nextchar != '"':
577-            raise ValueError(errmsg("Expecting property name", s, end))
578-    end += 1
579-    while True:
580-        key, end = scanstring(s, end, encoding, strict)
581-
582-        # To skip some function call overhead we optimize the fast paths where
583-        # the JSON key separator is ": " or just ":".
584-        if s[end:end + 1] != ':':
585-            end = _w(s, end).end()
586-            if s[end:end + 1] != ':':
587-                raise ValueError(errmsg("Expecting : delimiter", s, end))
588-
589-        end += 1
590-
591-        try:
592-            if s[end] in _ws:
593-                end += 1
594-                if s[end] in _ws:
595-                    end = _w(s, end + 1).end()
596-        except IndexError:
597-            pass
598-
599-        try:
600-            value, end = scan_once(s, end)
601-        except StopIteration:
602-            raise ValueError(errmsg("Expecting object", s, end))
603-        pairs[key] = value
604-
605-        try:
606-            nextchar = s[end]
607-            if nextchar in _ws:
608-                end = _w(s, end + 1).end()
609-                nextchar = s[end]
610-        except IndexError:
611-            nextchar = ''
612-        end += 1
613-
614-        if nextchar == '}':
615-            break
616-        elif nextchar != ',':
617-            raise ValueError(errmsg("Expecting , delimiter", s, end - 1))
618-
619-        try:
620-            nextchar = s[end]
621-            if nextchar in _ws:
622-                end += 1
623-                nextchar = s[end]
624-                if nextchar in _ws:
625-                    end = _w(s, end + 1).end()
626-                    nextchar = s[end]
627-        except IndexError:
628-            nextchar = ''
629-
630-        end += 1
631-        if nextchar != '"':
632-            raise ValueError(errmsg("Expecting property name", s, end - 1))
633-
634-    if object_hook is not None:
635-        pairs = object_hook(pairs)
636-    return pairs, end
637-
638-def JSONArray((s, end), scan_once, _w=WHITESPACE.match, _ws=WHITESPACE_STR):
639-    values = []
640-    nextchar = s[end:end + 1]
641-    if nextchar in _ws:
642-        end = _w(s, end + 1).end()
643-        nextchar = s[end:end + 1]
644-    # Look-ahead for trivial empty array
645-    if nextchar == ']':
646-        return values, end + 1
647-    _append = values.append
648-    while True:
649-        try:
650-            value, end = scan_once(s, end)
651-        except StopIteration:
652-            raise ValueError(errmsg("Expecting object", s, end))
653-        _append(value)
654-        nextchar = s[end:end + 1]
655-        if nextchar in _ws:
656-            end = _w(s, end + 1).end()
657-            nextchar = s[end:end + 1]
658-        end += 1
659-        if nextchar == ']':
660-            break
661-        elif nextchar != ',':
662-            raise ValueError(errmsg("Expecting , delimiter", s, end))
663-
664-        try:
665-            if s[end] in _ws:
666-                end += 1
667-                if s[end] in _ws:
668-                    end = _w(s, end + 1).end()
669-        except IndexError:
670-            pass
671-
672-    return values, end
673-
674-class JSONDecoder(object):
675-    """Simple JSON <http://json.org> decoder
676-
677-    Performs the following translations in decoding by default:
678-
679-    +---------------+-------------------+
680-    | JSON          | Python            |
681-    +===============+===================+
682-    | object        | dict              |
683-    +---------------+-------------------+
684-    | array         | list              |
685-    +---------------+-------------------+
686-    | string        | unicode           |
687-    +---------------+-------------------+
688-    | number (int)  | int, long         |
689-    +---------------+-------------------+
690-    | number (real) | float             |
691-    +---------------+-------------------+
692-    | true          | True              |
693-    +---------------+-------------------+
694-    | false         | False             |
695-    +---------------+-------------------+
696-    | null          | None              |
697-    +---------------+-------------------+
698-
699-    It also understands ``NaN``, ``Infinity``, and ``-Infinity`` as
700-    their corresponding ``float`` values, which is outside the JSON spec.
701-
702-    """
703-
704-    def __init__(self, encoding=None, object_hook=None, parse_float=None,
705-            parse_int=None, parse_constant=None, strict=True):
706-        """``encoding`` determines the encoding used to interpret any ``str``
707-        objects decoded by this instance (utf-8 by default).  It has no
708-        effect when decoding ``unicode`` objects.
709-
710-        Note that currently only encodings that are a superset of ASCII work,
711-        strings of other encodings should be passed in as ``unicode``.
712-
713-        ``object_hook``, if specified, will be called with the result
714-        of every JSON object decoded and its return value will be used in
715-        place of the given ``dict``.  This can be used to provide custom
716-        deserializations (e.g. to support JSON-RPC class hinting).
717-
718-        ``parse_float``, if specified, will be called with the string
719-        of every JSON float to be decoded. By default this is equivalent to
720-        float(num_str). This can be used to use another datatype or parser
721-        for JSON floats (e.g. decimal.Decimal).
722-
723-        ``parse_int``, if specified, will be called with the string
724-        of every JSON int to be decoded. By default this is equivalent to
725-        int(num_str). This can be used to use another datatype or parser
726-        for JSON integers (e.g. float).
727-
728-        ``parse_constant``, if specified, will be called with one of the
729-        following strings: -Infinity, Infinity, NaN.
730-        This can be used to raise an exception if invalid JSON numbers
731-        are encountered.
732-
733-        """
734-        self.encoding = encoding
735-        self.object_hook = object_hook
736-        self.parse_float = parse_float or float
737-        self.parse_int = parse_int or int
738-        self.parse_constant = parse_constant or _CONSTANTS.__getitem__
739-        self.strict = strict
740-        self.parse_object = JSONObject
741-        self.parse_array = JSONArray
742-        self.parse_string = scanstring
743-        self.scan_once = make_scanner(self)
744-
745-    def decode(self, s, _w=WHITESPACE.match):
746-        """Return the Python representation of ``s`` (a ``str`` or ``unicode``
747-        instance containing a JSON document)
748-
749-        """
750-        obj, end = self.raw_decode(s, idx=_w(s, 0).end())
751-        end = _w(s, end).end()
752-        if end != len(s):
753-            raise ValueError(errmsg("Extra data", s, end, len(s)))
754-        return obj
755-
756-    def raw_decode(self, s, idx=0):
757-        """Decode a JSON document from ``s`` (a ``str`` or ``unicode`` beginning
758-        with a JSON document) and return a 2-tuple of the Python
759-        representation and the index in ``s`` where the document ended.
760-
761-        This can be used to decode a JSON document from a string that may
762-        have extraneous data at the end.
763-
764-        """
765-        try:
766-            obj, end = self.scan_once(s, idx)
767-        except StopIteration:
768-            raise ValueError("No JSON object could be decoded")
769-        return obj, end
770diff --git a/django/utils/simplejson/encoder.py b/django/utils/simplejson/encoder.py
771deleted file mode 100644
772index 06ebe62..0000000
773--- a/django/utils/simplejson/encoder.py
774+++ /dev/null
775@@ -1,430 +0,0 @@
776-"""Implementation of JSONEncoder
777-"""
778-import re
779-
780-c_encode_basestring_ascii = None
781-c_make_encoder = None
782-
783-ESCAPE = re.compile(r'[\x00-\x1f\\"\b\f\n\r\t]')
784-ESCAPE_ASCII = re.compile(r'([\\"]|[^\ -~])')
785-HAS_UTF8 = re.compile(r'[\x80-\xff]')
786-ESCAPE_DCT = {
787-    '\\': '\\\\',
788-    '"': '\\"',
789-    '\b': '\\b',
790-    '\f': '\\f',
791-    '\n': '\\n',
792-    '\r': '\\r',
793-    '\t': '\\t',
794-}
795-for i in range(0x20):
796-    ESCAPE_DCT.setdefault(chr(i), '\\u%04x' % (i,))
797-
798-# Assume this produces an infinity on all machines (probably not guaranteed)
799-INFINITY = float('1e66666')
800-FLOAT_REPR = repr
801-
802-def encode_basestring(s):
803-    """Return a JSON representation of a Python string
804-
805-    """
806-    def replace(match):
807-        return ESCAPE_DCT[match.group(0)]
808-    return '"' + ESCAPE.sub(replace, s) + '"'
809-
810-
811-def py_encode_basestring_ascii(s):
812-    """Return an ASCII-only JSON representation of a Python string
813-
814-    """
815-    if isinstance(s, str) and HAS_UTF8.search(s) is not None:
816-        s = s.decode('utf-8')
817-    def replace(match):
818-        s = match.group(0)
819-        try:
820-            return ESCAPE_DCT[s]
821-        except KeyError:
822-            n = ord(s)
823-            if n < 0x10000:
824-                return '\\u%04x' % (n,)
825-            else:
826-                # surrogate pair
827-                n -= 0x10000
828-                s1 = 0xd800 | ((n >> 10) & 0x3ff)
829-                s2 = 0xdc00 | (n & 0x3ff)
830-                return '\\u%04x\\u%04x' % (s1, s2)
831-    return '"' + str(ESCAPE_ASCII.sub(replace, s)) + '"'
832-
833-
834-encode_basestring_ascii = c_encode_basestring_ascii or py_encode_basestring_ascii
835-
836-class JSONEncoder(object):
837-    """Extensible JSON <http://json.org> encoder for Python data structures.
838-
839-    Supports the following objects and types by default:
840-
841-    +-------------------+---------------+
842-    | Python            | JSON          |
843-    +===================+===============+
844-    | dict              | object        |
845-    +-------------------+---------------+
846-    | list, tuple       | array         |
847-    +-------------------+---------------+
848-    | str, unicode      | string        |
849-    +-------------------+---------------+
850-    | int, long, float  | number        |
851-    +-------------------+---------------+
852-    | True              | true          |
853-    +-------------------+---------------+
854-    | False             | false         |
855-    +-------------------+---------------+
856-    | None              | null          |
857-    +-------------------+---------------+
858-
859-    To extend this to recognize other objects, subclass and implement a
860-    ``.default()`` method with another method that returns a serializable
861-    object for ``o`` if possible, otherwise it should call the superclass
862-    implementation (to raise ``TypeError``).
863-
864-    """
865-    item_separator = ', '
866-    key_separator = ': '
867-    def __init__(self, skipkeys=False, ensure_ascii=True,
868-            check_circular=True, allow_nan=True, sort_keys=False,
869-            indent=None, separators=None, encoding='utf-8', default=None):
870-        """Constructor for JSONEncoder, with sensible defaults.
871-
872-        If skipkeys is False, then it is a TypeError to attempt
873-        encoding of keys that are not str, int, long, float or None.  If
874-        skipkeys is True, such items are simply skipped.
875-
876-        If ensure_ascii is True, the output is guaranteed to be str
877-        objects with all incoming unicode characters escaped.  If
878-        ensure_ascii is false, the output will be unicode object.
879-
880-        If check_circular is True, then lists, dicts, and custom encoded
881-        objects will be checked for circular references during encoding to
882-        prevent an infinite recursion (which would cause an OverflowError).
883-        Otherwise, no such check takes place.
884-
885-        If allow_nan is True, then NaN, Infinity, and -Infinity will be
886-        encoded as such.  This behavior is not JSON specification compliant,
887-        but is consistent with most JavaScript based encoders and decoders.
888-        Otherwise, it will be a ValueError to encode such floats.
889-
890-        If sort_keys is True, then the output of dictionaries will be
891-        sorted by key; this is useful for regression tests to ensure
892-        that JSON serializations can be compared on a day-to-day basis.
893-
894-        If indent is a non-negative integer, then JSON array
895-        elements and object members will be pretty-printed with that
896-        indent level.  An indent level of 0 will only insert newlines.
897-        None is the most compact representation.
898-
899-        If specified, separators should be a (item_separator, key_separator)
900-        tuple.  The default is (', ', ': ').  To get the most compact JSON
901-        representation you should specify (',', ':') to eliminate whitespace.
902-
903-        If specified, default is a function that gets called for objects
904-        that can't otherwise be serialized.  It should return a JSON encodable
905-        version of the object or raise a ``TypeError``.
906-
907-        If encoding is not None, then all input strings will be
908-        transformed into unicode using that encoding prior to JSON-encoding.
909-        The default is UTF-8.
910-
911-        """
912-
913-        self.skipkeys = skipkeys
914-        self.ensure_ascii = ensure_ascii
915-        self.check_circular = check_circular
916-        self.allow_nan = allow_nan
917-        self.sort_keys = sort_keys
918-        self.indent = indent
919-        if separators is not None:
920-            self.item_separator, self.key_separator = separators
921-        if default is not None:
922-            self.default = default
923-        self.encoding = encoding
924-
925-    def default(self, o):
926-        """Implement this method in a subclass such that it returns
927-        a serializable object for ``o``, or calls the base implementation
928-        (to raise a ``TypeError``).
929-
930-        For example, to support arbitrary iterators, you could
931-        implement default like this::
932-
933-            def default(self, o):
934-                try:
935-                    iterable = iter(o)
936-                except TypeError:
937-                    pass
938-                else:
939-                    return list(iterable)
940-                return JSONEncoder.default(self, o)
941-
942-        """
943-        raise TypeError("%r is not JSON serializable" % (o,))
944-
945-    def encode(self, o):
946-        """Return a JSON string representation of a Python data structure.
947-
948-        >>> JSONEncoder().encode({"foo": ["bar", "baz"]})
949-        '{"foo": ["bar", "baz"]}'
950-
951-        """
952-        # This is for extremely simple cases and benchmarks.
953-        if isinstance(o, basestring):
954-            if isinstance(o, str):
955-                _encoding = self.encoding
956-                if (_encoding is not None
957-                        and not (_encoding == 'utf-8')):
958-                    o = o.decode(_encoding)
959-            if self.ensure_ascii:
960-                return encode_basestring_ascii(o)
961-            else:
962-                return encode_basestring(o)
963-        # This doesn't pass the iterator directly to ''.join() because the
964-        # exceptions aren't as detailed.  The list call should be roughly
965-        # equivalent to the PySequence_Fast that ''.join() would do.
966-        chunks = self.iterencode(o, _one_shot=True)
967-        if not isinstance(chunks, (list, tuple)):
968-            chunks = list(chunks)
969-        return ''.join(chunks)
970-
971-    def iterencode(self, o, _one_shot=False):
972-        """Encode the given object and yield each string
973-        representation as available.
974-
975-        For example::
976-
977-            for chunk in JSONEncoder().iterencode(bigobject):
978-                mysocket.write(chunk)
979-
980-        """
981-        if self.check_circular:
982-            markers = {}
983-        else:
984-            markers = None
985-        if self.ensure_ascii:
986-            _encoder = encode_basestring_ascii
987-        else:
988-            _encoder = encode_basestring
989-        if self.encoding != 'utf-8':
990-            def _encoder(o, _orig_encoder=_encoder, _encoding=self.encoding):
991-                if isinstance(o, str):
992-                    o = o.decode(_encoding)
993-                return _orig_encoder(o)
994-
995-        def floatstr(o, allow_nan=self.allow_nan, _repr=FLOAT_REPR, _inf=INFINITY, _neginf=-INFINITY):
996-            # Check for specials.  Note that this type of test is processor- and/or
997-            # platform-specific, so do tests which don't depend on the internals.
998-
999-            if o != o:
1000-                text = 'NaN'
1001-            elif o == _inf:
1002-                text = 'Infinity'
1003-            elif o == _neginf:
1004-                text = '-Infinity'
1005-            else:
1006-                return _repr(o)
1007-
1008-            if not allow_nan:
1009-                raise ValueError("Out of range float values are not JSON compliant: %r"
1010-                    % (o,))
1011-
1012-            return text
1013-
1014-
1015-        if _one_shot and c_make_encoder is not None and not self.indent and not self.sort_keys:
1016-            _iterencode = c_make_encoder(
1017-                markers, self.default, _encoder, self.indent,
1018-                self.key_separator, self.item_separator, self.sort_keys,
1019-                self.skipkeys, self.allow_nan)
1020-        else:
1021-            _iterencode = _make_iterencode(
1022-                markers, self.default, _encoder, self.indent, floatstr,
1023-                self.key_separator, self.item_separator, self.sort_keys,
1024-                self.skipkeys, _one_shot)
1025-        return _iterencode(o, 0)
1026-
1027-def _make_iterencode(markers, _default, _encoder, _indent, _floatstr, _key_separator, _item_separator, _sort_keys, _skipkeys, _one_shot,
1028-        ## HACK: hand-optimized bytecode; turn globals into locals
1029-        False=False,
1030-        True=True,
1031-        ValueError=ValueError,
1032-        basestring=basestring,
1033-        dict=dict,
1034-        float=float,
1035-        id=id,
1036-        int=int,
1037-        isinstance=isinstance,
1038-        list=list,
1039-        long=long,
1040-        str=str,
1041-        tuple=tuple,
1042-    ):
1043-
1044-    def _iterencode_list(lst, _current_indent_level):
1045-        if not lst:
1046-            yield '[]'
1047-            return
1048-        if markers is not None:
1049-            markerid = id(lst)
1050-            if markerid in markers:
1051-                raise ValueError("Circular reference detected")
1052-            markers[markerid] = lst
1053-        buf = '['
1054-        if _indent is not None:
1055-            _current_indent_level += 1
1056-            newline_indent = '\n' + (' ' * (_indent * _current_indent_level))
1057-            separator = _item_separator + newline_indent
1058-            buf += newline_indent
1059-        else:
1060-            newline_indent = None
1061-            separator = _item_separator
1062-        first = True
1063-        for value in lst:
1064-            if first:
1065-                first = False
1066-            else:
1067-                buf = separator
1068-            if isinstance(value, basestring):
1069-                yield buf + _encoder(value)
1070-            elif value is None:
1071-                yield buf + 'null'
1072-            elif value is True:
1073-                yield buf + 'true'
1074-            elif value is False:
1075-                yield buf + 'false'
1076-            elif isinstance(value, (int, long)):
1077-                yield buf + str(value)
1078-            elif isinstance(value, float):
1079-                yield buf + _floatstr(value)
1080-            else:
1081-                yield buf
1082-                if isinstance(value, (list, tuple)):
1083-                    chunks = _iterencode_list(value, _current_indent_level)
1084-                elif isinstance(value, dict):
1085-                    chunks = _iterencode_dict(value, _current_indent_level)
1086-                else:
1087-                    chunks = _iterencode(value, _current_indent_level)
1088-                for chunk in chunks:
1089-                    yield chunk
1090-        if newline_indent is not None:
1091-            _current_indent_level -= 1
1092-            yield '\n' + (' ' * (_indent * _current_indent_level))
1093-        yield ']'
1094-        if markers is not None:
1095-            del markers[markerid]
1096-
1097-    def _iterencode_dict(dct, _current_indent_level):
1098-        if not dct:
1099-            yield '{}'
1100-            return
1101-        if markers is not None:
1102-            markerid = id(dct)
1103-            if markerid in markers:
1104-                raise ValueError("Circular reference detected")
1105-            markers[markerid] = dct
1106-        yield '{'
1107-        if _indent is not None:
1108-            _current_indent_level += 1
1109-            newline_indent = '\n' + (' ' * (_indent * _current_indent_level))
1110-            item_separator = _item_separator + newline_indent
1111-            yield newline_indent
1112-        else:
1113-            newline_indent = None
1114-            item_separator = _item_separator
1115-        first = True
1116-        if _sort_keys:
1117-            items = dct.items()
1118-            items.sort(key=lambda kv: kv[0])
1119-        else:
1120-            items = dct.iteritems()
1121-        for key, value in items:
1122-            if isinstance(key, basestring):
1123-                pass
1124-            # JavaScript is weakly typed for these, so it makes sense to
1125-            # also allow them.  Many encoders seem to do something like this.
1126-            elif isinstance(key, float):
1127-                key = _floatstr(key)
1128-            elif isinstance(key, (int, long)):
1129-                key = str(key)
1130-            elif key is True:
1131-                key = 'true'
1132-            elif key is False:
1133-                key = 'false'
1134-            elif key is None:
1135-                key = 'null'
1136-            elif _skipkeys:
1137-                continue
1138-            else:
1139-                raise TypeError("key %r is not a string" % (key,))
1140-            if first:
1141-                first = False
1142-            else:
1143-                yield item_separator
1144-            yield _encoder(key)
1145-            yield _key_separator
1146-            if isinstance(value, basestring):
1147-                yield _encoder(value)
1148-            elif value is None:
1149-                yield 'null'
1150-            elif value is True:
1151-                yield 'true'
1152-            elif value is False:
1153-                yield 'false'
1154-            elif isinstance(value, (int, long)):
1155-                yield str(value)
1156-            elif isinstance(value, float):
1157-                yield _floatstr(value)
1158-            else:
1159-                if isinstance(value, (list, tuple)):
1160-                    chunks = _iterencode_list(value, _current_indent_level)
1161-                elif isinstance(value, dict):
1162-                    chunks = _iterencode_dict(value, _current_indent_level)
1163-                else:
1164-                    chunks = _iterencode(value, _current_indent_level)
1165-                for chunk in chunks:
1166-                    yield chunk
1167-        if newline_indent is not None:
1168-            _current_indent_level -= 1
1169-            yield '\n' + (' ' * (_indent * _current_indent_level))
1170-        yield '}'
1171-        if markers is not None:
1172-            del markers[markerid]
1173-
1174-    def _iterencode(o, _current_indent_level):
1175-        if isinstance(o, basestring):
1176-            yield _encoder(o)
1177-        elif o is None:
1178-            yield 'null'
1179-        elif o is True:
1180-            yield 'true'
1181-        elif o is False:
1182-            yield 'false'
1183-        elif isinstance(o, (int, long)):
1184-            yield str(o)
1185-        elif isinstance(o, float):
1186-            yield _floatstr(o)
1187-        elif isinstance(o, (list, tuple)):
1188-            for chunk in _iterencode_list(o, _current_indent_level):
1189-                yield chunk
1190-        elif isinstance(o, dict):
1191-            for chunk in _iterencode_dict(o, _current_indent_level):
1192-                yield chunk
1193-        else:
1194-            if markers is not None:
1195-                markerid = id(o)
1196-                if markerid in markers:
1197-                    raise ValueError("Circular reference detected")
1198-                markers[markerid] = o
1199-            o = _default(o)
1200-            for chunk in _iterencode(o, _current_indent_level):
1201-                yield chunk
1202-            if markers is not None:
1203-                del markers[markerid]
1204-
1205-    return _iterencode
1206diff --git a/django/utils/simplejson/scanner.py b/django/utils/simplejson/scanner.py
1207deleted file mode 100644
1208index adbc6ec..0000000
1209--- a/django/utils/simplejson/scanner.py
1210+++ /dev/null
1211@@ -1,65 +0,0 @@
1212-"""JSON token scanner
1213-"""
1214-import re
1215-try:
1216-    from simplejson._speedups import make_scanner as c_make_scanner
1217-except ImportError:
1218-    c_make_scanner = None
1219-
1220-__all__ = ['make_scanner']
1221-
1222-NUMBER_RE = re.compile(
1223-    r'(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?',
1224-    (re.VERBOSE | re.MULTILINE | re.DOTALL))
1225-
1226-def py_make_scanner(context):
1227-    parse_object = context.parse_object
1228-    parse_array = context.parse_array
1229-    parse_string = context.parse_string
1230-    match_number = NUMBER_RE.match
1231-    encoding = context.encoding
1232-    strict = context.strict
1233-    parse_float = context.parse_float
1234-    parse_int = context.parse_int
1235-    parse_constant = context.parse_constant
1236-    object_hook = context.object_hook
1237-
1238-    def _scan_once(string, idx):
1239-        try:
1240-            nextchar = string[idx]
1241-        except IndexError:
1242-            raise StopIteration
1243-
1244-        if nextchar == '"':
1245-            return parse_string(string, idx + 1, encoding, strict)
1246-        elif nextchar == '{':
1247-            return parse_object((string, idx + 1), encoding, strict, _scan_once, object_hook)
1248-        elif nextchar == '[':
1249-            return parse_array((string, idx + 1), _scan_once)
1250-        elif nextchar == 'n' and string[idx:idx + 4] == 'null':
1251-            return None, idx + 4
1252-        elif nextchar == 't' and string[idx:idx + 4] == 'true':
1253-            return True, idx + 4
1254-        elif nextchar == 'f' and string[idx:idx + 5] == 'false':
1255-            return False, idx + 5
1256-
1257-        m = match_number(string, idx)
1258-        if m is not None:
1259-            integer, frac, exp = m.groups()
1260-            if frac or exp:
1261-                res = parse_float(integer + (frac or '') + (exp or ''))
1262-            else:
1263-                res = parse_int(integer)
1264-            return res, m.end()
1265-        elif nextchar == 'N' and string[idx:idx + 3] == 'NaN':
1266-            return parse_constant('NaN'), idx + 3
1267-        elif nextchar == 'I' and string[idx:idx + 8] == 'Infinity':
1268-            return parse_constant('Infinity'), idx + 8
1269-        elif nextchar == '-' and string[idx:idx + 9] == '-Infinity':
1270-            return parse_constant('-Infinity'), idx + 9
1271-        else:
1272-            raise StopIteration
1273-
1274-    return _scan_once
1275-
1276-make_scanner = c_make_scanner or py_make_scanner
1277diff --git a/django/utils/simplejson/tool.py b/django/utils/simplejson/tool.py
1278deleted file mode 100644
1279index 74401c2..0000000
1280--- a/django/utils/simplejson/tool.py
1281+++ /dev/null
1282@@ -1,35 +0,0 @@
1283-r"""Using simplejson from the shell to validate and
1284-pretty-print::
1285-
1286-    $ echo '{"json":"obj"}' | python -msimplejson.tool
1287-    {
1288-        "json": "obj"
1289-    }
1290-    $ echo '{ 1.2:3.4}' | python -msimplejson.tool
1291-    Expecting property name: line 1 column 2 (char 2)
1292-"""
1293-from django.utils import simplejson
1294-
1295-def main():
1296-    import sys
1297-    if len(sys.argv) == 1:
1298-        infile = sys.stdin
1299-        outfile = sys.stdout
1300-    elif len(sys.argv) == 2:
1301-        infile = open(sys.argv[1], 'rb')
1302-        outfile = sys.stdout
1303-    elif len(sys.argv) == 3:
1304-        infile = open(sys.argv[1], 'rb')
1305-        outfile = open(sys.argv[2], 'wb')
1306-    else:
1307-        raise SystemExit("%s [infile [outfile]]" % (sys.argv[0],))
1308-    try:
1309-        obj = simplejson.load(infile)
1310-    except ValueError, e:
1311-        raise SystemExit(e)
1312-    simplejson.dump(obj, outfile, sort_keys=True, indent=4)
1313-    outfile.write('\n')
1314-
1315-
1316-if __name__ == '__main__':
1317-    main()