Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Vendor simplejson and ensure it is on the path

  • Loading branch information...
commit 75ece4be1dd3228414c78d1f13fe20dbd410083c 1 parent 3aa50a7
Ted Nyman authored July 08, 2012

Showing 43 changed files with 7,106 additions and 4 deletions. Show diff stats Hide diff stats

  1. 8  lib/pygments/mentos.py
  2. 2  test/test_pygments.rb
  3. 10  vendor/simplejson/.gitignore
  4. 5  vendor/simplejson/.travis.yml
  5. 291  vendor/simplejson/CHANGES.txt
  6. 19  vendor/simplejson/LICENSE.txt
  7. 5  vendor/simplejson/MANIFEST.in
  8. 19  vendor/simplejson/README.rst
  9. 179  vendor/simplejson/conf.py
  10. 628  vendor/simplejson/index.rst
  11. 18  vendor/simplejson/scripts/make_docs.py
  12. 104  vendor/simplejson/setup.py
  13. 510  vendor/simplejson/simplejson/__init__.py
  14. 2,745  vendor/simplejson/simplejson/_speedups.c
  15. 425  vendor/simplejson/simplejson/decoder.py
  16. 567  vendor/simplejson/simplejson/encoder.py
  17. 119  vendor/simplejson/simplejson/ordered_dict.py
  18. 77  vendor/simplejson/simplejson/scanner.py
  19. 67  vendor/simplejson/simplejson/tests/__init__.py
  20. 55  vendor/simplejson/simplejson/tests/test_bigint_as_string.py
  21. 30  vendor/simplejson/simplejson/tests/test_check_circular.py
  22. 66  vendor/simplejson/simplejson/tests/test_decimal.py
  23. 83  vendor/simplejson/simplejson/tests/test_decode.py
  24. 9  vendor/simplejson/simplejson/tests/test_default.py
  25. 67  vendor/simplejson/simplejson/tests/test_dump.py
  26. 46  vendor/simplejson/simplejson/tests/test_encode_basestring_ascii.py
  27. 32  vendor/simplejson/simplejson/tests/test_encode_for_html.py
  28. 34  vendor/simplejson/simplejson/tests/test_errors.py
  29. 91  vendor/simplejson/simplejson/tests/test_fail.py
  30. 19  vendor/simplejson/simplejson/tests/test_float.py
  31. 86  vendor/simplejson/simplejson/tests/test_indent.py
  32. 20  vendor/simplejson/simplejson/tests/test_item_sort_key.py
  33. 121  vendor/simplejson/simplejson/tests/test_namedtuple.py
  34. 76  vendor/simplejson/simplejson/tests/test_pass1.py
  35. 14  vendor/simplejson/simplejson/tests/test_pass2.py
  36. 20  vendor/simplejson/simplejson/tests/test_pass3.py
  37. 67  vendor/simplejson/simplejson/tests/test_recursion.py
  38. 117  vendor/simplejson/simplejson/tests/test_scanstring.py
  39. 42  vendor/simplejson/simplejson/tests/test_separators.py
  40. 20  vendor/simplejson/simplejson/tests/test_speedups.py
  41. 49  vendor/simplejson/simplejson/tests/test_tuple.py
  42. 109  vendor/simplejson/simplejson/tests/test_unicode.py
  43. 39  vendor/simplejson/simplejson/tool.py
8  lib/pygments/mentos.py
@@ -2,6 +2,11 @@
2 2
 # -*- coding: utf-8 -*-
3 3
 
4 4
 import sys, re, os, signal
  5
+import sys
  6
+if 'PYGMENTS_PATH' in os.environ:
  7
+  sys.path.insert(0, os.environ['PYGMENTS_PATH'])
  8
+sys.path.append(os.getcwd() + "/vendor/")
  9
+
5 10
 import pygments
6 11
 from pygments import lexers, formatters, styles, filters
7 12
 
@@ -10,9 +15,6 @@
10 15
 except ImportError:
11 16
     import simplejson as json
12 17
 
13  
-if 'PYGMENTS_PATH' in os.environ:
14  
-  sys.path.insert(0, os.environ['PYGMENTS_PATH'])
15  
-
16 18
 def _signal_handler(signal, frame):
17 19
     """
18 20
     Handle the signal given in the first argument, exiting gracefully
2  test/test_pygments.rb
@@ -198,7 +198,7 @@ def test_css_default
198 198
   end
199 199
 
200 200
   def test_css_colorful
201  
-    assert_match '.c { color: #808080 }', P.css(:style => 'colorful')
  201
+    assert_match '.c { color: #888888 }', P.css(:style => 'colorful')
202 202
   end
203 203
 end
204 204
 
10  vendor/simplejson/.gitignore
... ...
@@ -0,0 +1,10 @@
  1
+*.egg-info
  2
+*.egg
  3
+*.pyc
  4
+*.so
  5
+/MANIFEST
  6
+/.coverage
  7
+/coverage.xml
  8
+/build
  9
+/dist
  10
+/docs
5  vendor/simplejson/.travis.yml
... ...
@@ -0,0 +1,5 @@
  1
+language: python
  2
+python:
  3
+  - "2.6"
  4
+  - "2.7"
  5
+script: python setup.py test
291  vendor/simplejson/CHANGES.txt
... ...
@@ -0,0 +1,291 @@
  1
+Version 2.6.0 released 2012-06-26
  2
+
  3
+* Error messages changed to match proposal for Python 3.3.1
  4
+  http://bugs.python.org/issue5067
  5
+
  6
+Version 2.5.2 released 2012-05-10
  7
+
  8
+* Fix for regression introduced in 2.5.1
  9
+  https://github.com/simplejson/simplejson/issues/35
  10
+
  11
+Version 2.5.1 released 2012-05-10
  12
+
  13
+* Support for use_decimal=True in environments that use Python
  14
+  sub-interpreters such as uWSGI
  15
+  https://github.com/simplejson/simplejson/issues/34
  16
+
  17
+Version 2.5.0 released 2012-03-29
  18
+
  19
+* New item_sort_key option for encoder to allow fine grained control of sorted
  20
+  output
  21
+
  22
+Version 2.4.0 released 2012-03-06
  23
+
  24
+* New bigint_as_string option for encoder to trade JavaScript number precision
  25
+  issues for type issues.
  26
+  https://github.com/simplejson/simplejson/issues/31
  27
+
  28
+Version 2.3.3 released 2012-02-27
  29
+
  30
+* Allow unknown numerical types for indent parameter
  31
+  https://github.com/simplejson/simplejson/pull/29
  32
+
  33
+Version 2.3.2 released 2011-12-30
  34
+
  35
+* Fix crashing regression in speedups introduced in 2.3.1
  36
+
  37
+Version 2.3.1 released 2011-12-29
  38
+
  39
+* namedtuple_as_object now checks _asdict to ensure that it
  40
+  is callable.
  41
+  https://github.com/simplejson/simplejson/issues/26
  42
+
  43
+Version 2.3.0 released 2011-12-05
  44
+
  45
+* Any objects with _asdict() methods are now considered for
  46
+  namedtuple_as_object.
  47
+  https://github.com/simplejson/simplejson/pull/22
  48
+
  49
+Version 2.2.1 released 2011-09-06
  50
+
  51
+* Fix MANIFEST.in issue when building a sdist from a sdist.
  52
+  https://github.com/simplejson/simplejson/issues/16
  53
+
  54
+Version 2.2.0 released 2011-09-04
  55
+
  56
+* Remove setuptools requirement, reverted to pure distutils
  57
+* use_decimal default for encoding (dump, dumps, JSONEncoder) is now True
  58
+* tuple encoding as JSON objects can be turned off with new
  59
+  tuple_as_array=False option.
  60
+  https://github.com/simplejson/simplejson/pull/6
  61
+* namedtuple (or other tuple subclasses with _asdict methods) are now
  62
+  encoded as JSON objects rather than arrays by default. Can be disabled
  63
+  and treated as a tuple with the new namedtuple_as_object=False option.
  64
+  https://github.com/simplejson/simplejson/pull/6
  65
+* JSONDecodeError is now raised instead of ValueError when a document
  66
+  ends with an opening quote and the C speedups are in use.
  67
+  https://github.com/simplejson/simplejson/issues/15
  68
+* Updated documentation with information about JSONDecodeError
  69
+* Force unicode linebreak characters to be escaped (U+2028 and U+2029)
  70
+  http://timelessrepo.com/json-isnt-a-javascript-subset
  71
+* Moved documentation from a git submodule to
  72
+  http://simplejson.readthedocs.org/
  73
+
  74
+Version 2.1.6 released 2011-05-08
  75
+
  76
+* Prevent segfaults with deeply nested JSON documents
  77
+  https://github.com/simplejson/simplejson/issues/11
  78
+* Fix compatibility with Python 2.5
  79
+  https://github.com/simplejson/simplejson/issues/5
  80
+
  81
+Version 2.1.5 released 2011-04-17
  82
+
  83
+* Built sdist tarball with setuptools_git installed. Argh.
  84
+
  85
+Version 2.1.4 released 2011-04-17
  86
+
  87
+* Does not try to build the extension when using PyPy
  88
+* Trailing whitespace after commas no longer emitted when indent is used
  89
+* Migrated to github http://github.com/simplejson/simplejson
  90
+
  91
+Version 2.1.3 released 2011-01-17
  92
+
  93
+* Support the sort_keys option in C encoding speedups
  94
+  http://code.google.com/p/simplejson/issues/detail?id=86
  95
+* Allow use_decimal to work with dump()
  96
+  http://code.google.com/p/simplejson/issues/detail?id=87
  97
+
  98
+Version 2.1.2 released 2010-11-01
  99
+
  100
+* Correct wrong end when object_pairs_hook is used
  101
+  http://code.google.com/p/simplejson/issues/detail?id=85
  102
+* Correct output for indent=0
  103
+  http://bugs.python.org/issue10019
  104
+* Correctly raise TypeError when non-string keys are used with speedups
  105
+  http://code.google.com/p/simplejson/issues/detail?id=82
  106
+* Fix the endlineno, endcolno attributes of the JSONDecodeError exception.
  107
+  http://code.google.com/p/simplejson/issues/detail?id=81
  108
+
  109
+Version 2.1.1 released 2010-03-31
  110
+
  111
+* Change how setup.py imports ez_setup.py to try and workaround old versions
  112
+  of setuptools.
  113
+  http://code.google.com/p/simplejson/issues/detail?id=75
  114
+* Fix compilation on Windows platform (and other platforms with very
  115
+  picky compilers)
  116
+* Corrected simplejson.__version__ and other minor doc changes.
  117
+* Do not fail speedups tests if speedups could not be built.
  118
+  http://code.google.com/p/simplejson/issues/detail?id=73
  119
+
  120
+Version 2.1.0 released 2010-03-10
  121
+
  122
+* Decimal serialization officially supported for encoding with
  123
+  use_decimal=True. For encoding this encodes Decimal objects and
  124
+  for decoding it implies parse_float=Decimal
  125
+* Python 2.4 no longer supported (may still work, but no longer tested)
  126
+* Decoding performance and memory utilization enhancements
  127
+  http://bugs.python.org/issue7451
  128
+* JSONEncoderForHTML class for escaping &, <, >
  129
+  http://code.google.com/p/simplejson/issues/detail?id=66
  130
+* Memoization of object keys during encoding (when using speedups)
  131
+* Encoder changed to use PyIter_Next for list iteration to avoid
  132
+  potential threading issues
  133
+* Encoder changed to use iteritems rather than PyDict_Next in order to
  134
+  support dict subclasses that have a well defined ordering
  135
+  http://bugs.python.org/issue6105
  136
+* indent encoding parameter changed to be a string rather than an integer
  137
+  (integer use still supported for backwards compatibility)
  138
+  http://code.google.com/p/simplejson/issues/detail?id=56
  139
+* Test suite (python setup.py test) now automatically runs with and without
  140
+  speedups
  141
+  http://code.google.com/p/simplejson/issues/detail?id=55
  142
+* Fixed support for older versions of easy_install (e.g. stock Mac OS X config)
  143
+  http://code.google.com/p/simplejson/issues/detail?id=54
  144
+* Fixed str/unicode mismatches when using ensure_ascii=False
  145
+  http://code.google.com/p/simplejson/issues/detail?id=48
  146
+* Fixed error message when parsing an array with trailing comma with speedups
  147
+  http://code.google.com/p/simplejson/issues/detail?id=46
  148
+* Refactor decoder errors to raise JSONDecodeError instead of ValueError
  149
+  http://code.google.com/p/simplejson/issues/detail?id=45
  150
+* New ordered_pairs_hook feature in decoder which makes it possible to
  151
+  preserve key order. http://bugs.python.org/issue5381
  152
+* Fixed containerless unicode float decoding (same bug as 2.0.4, oops!)
  153
+  http://code.google.com/p/simplejson/issues/detail?id=43
  154
+* Share PosInf definition between encoder and decoder
  155
+* Minor reformatting to make it easier to backport simplejson changes
  156
+  to Python 2.7/3.1 json module
  157
+
  158
+Version 2.0.9 released 2009-02-18
  159
+
  160
+* Adds cyclic GC to the Encoder and Scanner speedups, which could've
  161
+  caused uncollectible cycles in some cases when using custom parser
  162
+  or encoder functions
  163
+
  164
+Version 2.0.8 released 2009-02-15
  165
+
  166
+* Documentation fixes
  167
+* Fixes encoding True and False as keys
  168
+* Fixes checking for True and False by identity for several parameters
  169
+
  170
+Version 2.0.7 released 2009-01-04
  171
+
  172
+* Documentation fixes
  173
+* C extension now always returns unicode strings when the input string is
  174
+  unicode, even for empty strings
  175
+
  176
+Version 2.0.6 released 2008-12-19
  177
+
  178
+* Windows build fixes
  179
+
  180
+Version 2.0.5 released 2008-11-23
  181
+
  182
+* Fixes a segfault in the C extension when using check_circular=False and
  183
+  encoding an invalid document
  184
+
  185
+Version 2.0.4 released 2008-10-24
  186
+
  187
+* Fixes a parsing error in the C extension when the JSON document is (only)
  188
+  a floating point number. It would consume one too few characters in that
  189
+  case, and claim the document invalid.
  190
+
  191
+Version 2.0.3 released 2008-10-11
  192
+
  193
+* Fixes reference leaks in the encoding speedups (sorry about that!)
  194
+* Fixes doctest suite for Python 2.6
  195
+* More optimizations for the decoder
  196
+
  197
+Version 2.0.2 released 2008-10-06
  198
+
  199
+* Fixes MSVC2003 build regression
  200
+* Fixes Python 2.4 compatibility in _speedups.c
  201
+
  202
+Version 2.0.1 released 2008-09-29
  203
+
  204
+* Fixes long encoding regression introduced in 2.0.0
  205
+* Fixes MinGW build regression introduced in 2.0.0
  206
+
  207
+Version 2.0.0 released 2008-09-27
  208
+
  209
+* optimized Python encoding path
  210
+* optimized Python decoding path
  211
+* optimized C encoding path
  212
+* optimized C decoding path
  213
+* switched to sphinx docs (nearly the same as the json module in python 2.6)
  214
+
  215
+Version 1.9.3 released 2008-09-23
  216
+
  217
+* Decoding is significantly faster (for our internal benchmarks)
  218
+* Pretty-printing tool changed from simplejson to simplejson.tool for better
  219
+  Python 2.6 comaptibility
  220
+* Misc. bug fixes
  221
+
  222
+Version 1.9 released 2008-05-03
  223
+
  224
+* Rewrote test suite with unittest and doctest (no more nosetest dependency)
  225
+* Better PEP 7 and PEP 8 source compliance
  226
+* Removed simplejson.jsonfilter demo module
  227
+* simplejson.jsonfilter is no longer included
  228
+
  229
+Version 1.8.1 released 2008-03-24
  230
+
  231
+* Optional C extension for accelerating the decoding of JSON strings
  232
+* Command line interface for pretty-printing JSON (via python -msimplejson)
  233
+* Decoding of integers and floats is now extensible (e.g. to use Decimal) via
  234
+  parse_int, parse_float options.
  235
+* Subversion and issue tracker moved to google code:
  236
+  http://code.google.com/p/simplejson/
  237
+* "/" is no longer escaped, so if you're embedding JSON directly in HTML
  238
+  you'll want to use .replace("/", "\\/") to prevent a close-tag attack.
  239
+
  240
+Version 1.7 released 2007-03-18
  241
+
  242
+* Improves encoding performance with an optional C extension to speed up
  243
+  str/unicode encoding (by 10-150x or so), which yields an overall speed
  244
+  boost of 2x+ (JSON is string-heavy).
  245
+* Support for encoding unicode code points outside the BMP to UTF-16
  246
+  surrogate code pairs (specified by the Strings section of RFC 4627).
  247
+
  248
+Version 1.6 released 2007-03-03
  249
+
  250
+* Improved str support for encoding. Previous versions of simplejson
  251
+  integrated strings directly into the output stream, this version ensures
  252
+  they're of a particular encoding (default is UTF-8) so that the output
  253
+  stream is valid.
  254
+
  255
+Version 1.5 released 2007-01-18
  256
+
  257
+* Better Python 2.5 compatibility
  258
+* Better Windows compatibility
  259
+* indent encoding parameter for pretty printing
  260
+* separators encoding parameter for generating optimally compact JSON
  261
+
  262
+Version 1.3 released 2006-04-01
  263
+
  264
+* The optional object_hook function is called upon decoding of any JSON
  265
+  object literal, and its return value is used instead of the dict that
  266
+  would normally be used. This can be used to efficiently implement
  267
+  features such as JSON-RPC class hinting, or other custom decodings of
  268
+  JSON. See the documentation for more information.
  269
+
  270
+Version 1.1 released 2005-12-31
  271
+
  272
+* Renamed from simple_json to simplejson to comply with PEP 8 module naming
  273
+  guidelines
  274
+* Full set of documentation
  275
+* More tests
  276
+* The encoder and decoder have been extended to understand NaN, Infinity, and
  277
+  -Infinity (but this can be turned off via allow_nan=False for strict JSON
  278
+  compliance)
  279
+* The decoder's scanner has been fixed so that it no longer accepts invalid
  280
+  JSON documents
  281
+* The decoder now reports line and column information as well as character
  282
+  numbers for easier debugging
  283
+* The encoder now has a circular reference checker, which can be optionally
  284
+  disabled with check_circular=False
  285
+* dump, dumps, load, loads now accept an optional cls kwarg to use an
  286
+  alternate JSONEncoder or JSONDecoder class for convenience.
  287
+* The read/write compatibility shim for json-py now have deprecation warnings
  288
+
  289
+Version 1.0 released 2005-12-25
  290
+
  291
+ * Initial release
19  vendor/simplejson/LICENSE.txt
... ...
@@ -0,0 +1,19 @@
  1
+Copyright (c) 2006 Bob Ippolito
  2
+
  3
+Permission is hereby granted, free of charge, to any person obtaining a copy of
  4
+this software and associated documentation files (the "Software"), to deal in
  5
+the Software without restriction, including without limitation the rights to
  6
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  7
+of the Software, and to permit persons to whom the Software is furnished to do
  8
+so, subject to the following conditions:
  9
+
  10
+The above copyright notice and this permission notice shall be included in all
  11
+copies or substantial portions of the Software.
  12
+
  13
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  19
+SOFTWARE.
5  vendor/simplejson/MANIFEST.in
... ...
@@ -0,0 +1,5 @@
  1
+include *.py
  2
+include *.txt
  3
+include *.rst
  4
+include scripts/*.py
  5
+include MANIFEST.in
19  vendor/simplejson/README.rst
Source Rendered
... ...
@@ -0,0 +1,19 @@
  1
+simplejson is a simple, fast, complete, correct and extensible
  2
+JSON <http://json.org> encoder and decoder for Python 2.5+.  It is
  3
+pure Python code with no dependencies, but includes an optional C
  4
+extension for a serious speed boost.
  5
+
  6
+The latest documentation for simplejson can be read online here:
  7
+http://simplejson.readthedocs.org/
  8
+
  9
+simplejson is the externally maintained development version of the
  10
+json library included with Python 2.6 and Python 3.0, but maintains
  11
+backwards compatibility with Python 2.5.
  12
+
  13
+The encoder may be subclassed to provide serialization in any kind of
  14
+situation, without any special support by the objects to be serialized
  15
+(somewhat like pickle).
  16
+
  17
+The decoder can handle incoming JSON strings of any specified encoding
  18
+(UTF-8 by default).
  19
+
179  vendor/simplejson/conf.py
... ...
@@ -0,0 +1,179 @@
  1
+# -*- coding: utf-8 -*-
  2
+#
  3
+# simplejson documentation build configuration file, created by
  4
+# sphinx-quickstart on Fri Sep 26 18:58:30 2008.
  5
+#
  6
+# This file is execfile()d with the current directory set to its containing dir.
  7
+#
  8
+# The contents of this file are pickled, so don't put values in the namespace
  9
+# that aren't pickleable (module imports are okay, they're removed automatically).
  10
+#
  11
+# All configuration values have a default value; values that are commented out
  12
+# serve to show the default value.
  13
+
  14
+import sys, os
  15
+
  16
+# If your extensions are in another directory, add it here. If the directory
  17
+# is relative to the documentation root, use os.path.abspath to make it
  18
+# absolute, like shown here.
  19
+#sys.path.append(os.path.abspath('some/directory'))
  20
+
  21
+# General configuration
  22
+# ---------------------
  23
+
  24
+# Add any Sphinx extension module names here, as strings. They can be extensions
  25
+# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
  26
+extensions = []
  27
+
  28
+# Add any paths that contain templates here, relative to this directory.
  29
+templates_path = ['_templates']
  30
+
  31
+# The suffix of source filenames.
  32
+source_suffix = '.rst'
  33
+
  34
+# The master toctree document.
  35
+master_doc = 'index'
  36
+
  37
+# General substitutions.
  38
+project = 'simplejson'
  39
+copyright = '2012, Bob Ippolito'
  40
+
  41
+# The default replacements for |version| and |release|, also used in various
  42
+# other places throughout the built documents.
  43
+#
  44
+# The short X.Y version.
  45
+version = '2.6'
  46
+# The full version, including alpha/beta/rc tags.
  47
+release = '2.6.0'
  48
+
  49
+# There are two options for replacing |today|: either, you set today to some
  50
+# non-false value, then it is used:
  51
+#today = ''
  52
+# Else, today_fmt is used as the format for a strftime call.
  53
+today_fmt = '%B %d, %Y'
  54
+
  55
+# List of documents that shouldn't be included in the build.
  56
+#unused_docs = []
  57
+
  58
+# List of directories, relative to source directories, that shouldn't be searched
  59
+# for source files.
  60
+#exclude_dirs = []
  61
+
  62
+# The reST default role (used for this markup: `text`) to use for all documents.
  63
+#default_role = None
  64
+
  65
+# If true, '()' will be appended to :func: etc. cross-reference text.
  66
+#add_function_parentheses = True
  67
+
  68
+# If true, the current module name will be prepended to all description
  69
+# unit titles (such as .. function::).
  70
+#add_module_names = True
  71
+
  72
+# If true, sectionauthor and moduleauthor directives will be shown in the
  73
+# output. They are ignored by default.
  74
+#show_authors = False
  75
+
  76
+# The name of the Pygments (syntax highlighting) style to use.
  77
+pygments_style = 'sphinx'
  78
+
  79
+
  80
+# Options for HTML output
  81
+# -----------------------
  82
+
  83
+# The style sheet to use for HTML and HTML Help pages. A file of that name
  84
+# must exist either in Sphinx' static/ path, or in one of the custom paths
  85
+# given in html_static_path.
  86
+html_style = 'default.css'
  87
+
  88
+# The name for this set of Sphinx documents.  If None, it defaults to
  89
+# "<project> v<release> documentation".
  90
+#html_title = None
  91
+
  92
+# A shorter title for the navigation bar.  Default is the same as html_title.
  93
+#html_short_title = None
  94
+
  95
+# The name of an image file (within the static path) to place at the top of
  96
+# the sidebar.
  97
+#html_logo = None
  98
+
  99
+# The name of an image file (within the static path) to use as favicon of the
  100
+# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
  101
+# pixels large.
  102
+#html_favicon = None
  103
+
  104
+# Add any paths that contain custom static files (such as style sheets) here,
  105
+# relative to this directory. They are copied after the builtin static files,
  106
+# so a file named "default.css" will overwrite the builtin "default.css".
  107
+html_static_path = ['_static']
  108
+
  109
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
  110
+# using the given strftime format.
  111
+html_last_updated_fmt = '%b %d, %Y'
  112
+
  113
+# If true, SmartyPants will be used to convert quotes and dashes to
  114
+# typographically correct entities.
  115
+#html_use_smartypants = True
  116
+
  117
+# Custom sidebar templates, maps document names to template names.
  118
+#html_sidebars = {}
  119
+
  120
+# Additional templates that should be rendered to pages, maps page names to
  121
+# template names.
  122
+#html_additional_pages = {}
  123
+
  124
+# If false, no module index is generated.
  125
+html_use_modindex = False
  126
+
  127
+# If false, no index is generated.
  128
+#html_use_index = True
  129
+
  130
+# If true, the index is split into individual pages for each letter.
  131
+#html_split_index = False
  132
+
  133
+# If true, the reST sources are included in the HTML build as _sources/<name>.
  134
+#html_copy_source = True
  135
+
  136
+# If true, an OpenSearch description file will be output, and all pages will
  137
+# contain a <link> tag referring to it.  The value of this option must be the
  138
+# base URL from which the finished HTML is served.
  139
+#html_use_opensearch = ''
  140
+
  141
+# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
  142
+html_file_suffix = '.html'
  143
+
  144
+# Output file base name for HTML help builder.
  145
+htmlhelp_basename = 'simplejsondoc'
  146
+
  147
+
  148
+# Options for LaTeX output
  149
+# ------------------------
  150
+
  151
+# The paper size ('letter' or 'a4').
  152
+#latex_paper_size = 'letter'
  153
+
  154
+# The font size ('10pt', '11pt' or '12pt').
  155
+#latex_font_size = '10pt'
  156
+
  157
+# Grouping the document tree into LaTeX files. List of tuples
  158
+# (source start file, target name, title, author, document class [howto/manual]).
  159
+latex_documents = [
  160
+  ('index', 'simplejson.tex', 'simplejson Documentation',
  161
+   'Bob Ippolito', 'manual'),
  162
+]
  163
+
  164
+# The name of an image file (relative to this directory) to place at the top of
  165
+# the title page.
  166
+#latex_logo = None
  167
+
  168
+# For "manual" documents, if this is true, then toplevel headings are parts,
  169
+# not chapters.
  170
+#latex_use_parts = False
  171
+
  172
+# Additional stuff for the LaTeX preamble.
  173
+#latex_preamble = ''
  174
+
  175
+# Documents to append as an appendix to all manuals.
  176
+#latex_appendices = []
  177
+
  178
+# If false, no module index is generated.
  179
+#latex_use_modindex = True
628  vendor/simplejson/index.rst
Source Rendered
... ...
@@ -0,0 +1,628 @@
  1
+:mod:`simplejson` --- JSON encoder and decoder
  2
+==============================================
  3
+
  4
+.. module:: simplejson
  5
+   :synopsis: Encode and decode the JSON format.
  6
+.. moduleauthor:: Bob Ippolito <bob@redivi.com>
  7
+.. sectionauthor:: Bob Ippolito <bob@redivi.com>
  8
+
  9
+JSON (JavaScript Object Notation) <http://json.org> is a subset of JavaScript
  10
+syntax (ECMA-262 3rd edition) used as a lightweight data interchange format.
  11
+
  12
+:mod:`simplejson` exposes an API familiar to users of the standard library
  13
+:mod:`marshal` and :mod:`pickle` modules. It is the externally maintained
  14
+version of the :mod:`json` library contained in Python 2.6, but maintains
  15
+compatibility with Python 2.5 and (currently) has
  16
+significant performance advantages, even without using the optional C
  17
+extension for speedups.
  18
+
  19
+Development of simplejson happens on Github:
  20
+http://github.com/simplejson/simplejson
  21
+
  22
+Encoding basic Python object hierarchies::
  23
+
  24
+    >>> import simplejson as json
  25
+    >>> json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}])
  26
+    '["foo", {"bar": ["baz", null, 1.0, 2]}]'
  27
+    >>> print json.dumps("\"foo\bar")
  28
+    "\"foo\bar"
  29
+    >>> print json.dumps(u'\u1234')
  30
+    "\u1234"
  31
+    >>> print json.dumps('\\')
  32
+    "\\"
  33
+    >>> print json.dumps({"c": 0, "b": 0, "a": 0}, sort_keys=True)
  34
+    {"a": 0, "b": 0, "c": 0}
  35
+    >>> from StringIO import StringIO
  36
+    >>> io = StringIO()
  37
+    >>> json.dump(['streaming API'], io)
  38
+    >>> io.getvalue()
  39
+    '["streaming API"]'
  40
+
  41
+Compact encoding::
  42
+
  43
+    >>> import simplejson as json
  44
+    >>> json.dumps([1,2,3,{'4': 5, '6': 7}], separators=(',', ':'))
  45
+    '[1,2,3,{"4":5,"6":7}]'
  46
+
  47
+Pretty printing::
  48
+
  49
+    >>> import simplejson as json
  50
+    >>> s = json.dumps({'4': 5, '6': 7}, sort_keys=True, indent=4 * ' ')
  51
+    >>> print '\n'.join([l.rstrip() for l in  s.splitlines()])
  52
+    {
  53
+        "4": 5,
  54
+        "6": 7
  55
+    }
  56
+
  57
+Decoding JSON::
  58
+
  59
+    >>> import simplejson as json
  60
+    >>> obj = [u'foo', {u'bar': [u'baz', None, 1.0, 2]}]
  61
+    >>> json.loads('["foo", {"bar":["baz", null, 1.0, 2]}]') == obj
  62
+    True
  63
+    >>> json.loads('"\\"foo\\bar"') == u'"foo\x08ar'
  64
+    True
  65
+    >>> from StringIO import StringIO
  66
+    >>> io = StringIO('["streaming API"]')
  67
+    >>> json.load(io)[0] == 'streaming API'
  68
+    True
  69
+
  70
+Using Decimal instead of float::
  71
+
  72
+    >>> import simplejson as json
  73
+    >>> from decimal import Decimal
  74
+    >>> json.loads('1.1', use_decimal=True) == Decimal('1.1')
  75
+    True
  76
+    >>> json.dumps(Decimal('1.1'), use_decimal=True) == '1.1'
  77
+    True
  78
+
  79
+Specializing JSON object decoding::
  80
+
  81
+    >>> import simplejson as json
  82
+    >>> def as_complex(dct):
  83
+    ...     if '__complex__' in dct:
  84
+    ...         return complex(dct['real'], dct['imag'])
  85
+    ...     return dct
  86
+    ...
  87
+    >>> json.loads('{"__complex__": true, "real": 1, "imag": 2}',
  88
+    ...     object_hook=as_complex)
  89
+    (1+2j)
  90
+    >>> import decimal
  91
+    >>> json.loads('1.1', parse_float=decimal.Decimal) == decimal.Decimal('1.1')
  92
+    True
  93
+
  94
+Specializing JSON object encoding::
  95
+
  96
+    >>> import simplejson as json
  97
+    >>> def encode_complex(obj):
  98
+    ...     if isinstance(obj, complex):
  99
+    ...         return [obj.real, obj.imag]
  100
+    ...     raise TypeError(repr(o) + " is not JSON serializable")
  101
+    ...
  102
+    >>> json.dumps(2 + 1j, default=encode_complex)
  103
+    '[2.0, 1.0]'
  104
+    >>> json.JSONEncoder(default=encode_complex).encode(2 + 1j)
  105
+    '[2.0, 1.0]'
  106
+    >>> ''.join(json.JSONEncoder(default=encode_complex).iterencode(2 + 1j))
  107
+    '[2.0, 1.0]'
  108
+
  109
+
  110
+.. highlight:: none
  111
+
  112
+Using :mod:`simplejson.tool` from the shell to validate and pretty-print::
  113
+
  114
+    $ echo '{"json":"obj"}' | python -m simplejson.tool
  115
+    {
  116
+        "json": "obj"
  117
+    }
  118
+    $ echo '{ 1.2:3.4}' | python -m simplejson.tool
  119
+    Expecting property name enclosed in double quotes: line 1 column 2 (char 2)
  120
+
  121
+.. highlight:: python
  122
+
  123
+.. note::
  124
+
  125
+   The JSON produced by this module's default settings is a subset of
  126
+   YAML, so it may be used as a serializer for that as well.
  127
+
  128
+
  129
+Basic Usage
  130
+-----------
  131
+
  132
+.. function:: dump(obj, fp[, skipkeys[, ensure_ascii[, check_circular[, allow_nan[, cls[, indent[, separators[, encoding[, default[, use_decimal[, namedtuple_as_object[, tuple_as_array[, bigint_as_string[, sort_keys[, item_sort_key[, **kw]]]]]]]]]]]]]]]])
  133
+
  134
+   Serialize *obj* as a JSON formatted stream to *fp* (a ``.write()``-supporting
  135
+   file-like object).
  136
+
  137
+   If *skipkeys* is true (default: ``False``), then dict keys that are not
  138
+   of a basic type (:class:`str`, :class:`unicode`, :class:`int`, :class:`long`,
  139
+   :class:`float`, :class:`bool`, ``None``) will be skipped instead of raising a
  140
+   :exc:`TypeError`.
  141
+
  142
+   If *ensure_ascii* is false (default: ``True``), then some chunks written
  143
+   to *fp* may be :class:`unicode` instances, subject to normal Python
  144
+   :class:`str` to :class:`unicode` coercion rules.  Unless ``fp.write()``
  145
+   explicitly understands :class:`unicode` (as in :func:`codecs.getwriter`) this
  146
+   is likely to cause an error. It's best to leave the default settings, because
  147
+   they are safe and it is highly optimized.
  148
+
  149
+   If *check_circular* is false (default: ``True``), then the circular
  150
+   reference check for container types will be skipped and a circular reference
  151
+   will result in an :exc:`OverflowError` (or worse).
  152
+
  153
+   If *allow_nan* is false (default: ``True``), then it will be a
  154
+   :exc:`ValueError` to serialize out of range :class:`float` values (``nan``,
  155
+   ``inf``, ``-inf``) in strict compliance of the JSON specification.
  156
+   If *allow_nan* is true, their JavaScript equivalents will be used
  157
+   (``NaN``, ``Infinity``, ``-Infinity``).
  158
+
  159
+   If *indent* is a string, then JSON array elements and object members
  160
+   will be pretty-printed with a newline followed by that string repeated
  161
+   for each level of nesting. ``None`` (the default) selects the most compact
  162
+   representation without any newlines. For backwards compatibility with
  163
+   versions of simplejson earlier than 2.1.0, an integer is also accepted
  164
+   and is converted to a string with that many spaces.
  165
+
  166
+   .. versionchanged:: 2.1.0
  167
+      Changed *indent* from an integer number of spaces to a string.
  168
+
  169
+   If specified, *separators* should be an ``(item_separator, dict_separator)``
  170
+   tuple.  By default, ``(', ', ': ')`` are used.  To get the most compact JSON
  171
+   representation, you should specify ``(',', ':')`` to eliminate whitespace.
  172
+
  173
+   *encoding* is the character encoding for str instances, default is
  174
+   ``'utf-8'``.
  175
+
  176
+   *default(obj)* is a function that should return a serializable version of
  177
+   *obj* or raise :exc:`TypeError`.  The default simply raises :exc:`TypeError`.
  178
+
  179
+   To use a custom :class:`JSONEncoder` subclass (e.g. one that overrides the
  180
+   :meth:`default` method to serialize additional types), specify it with the
  181
+   *cls* kwarg.
  182
+
  183
+   If *use_decimal* is true (default: ``True``) then :class:`decimal.Decimal`
  184
+   will be natively serialized to JSON with full precision.
  185
+
  186
+   .. versionchanged:: 2.1.0
  187
+      *use_decimal* is new in 2.1.0.
  188
+
  189
+   .. versionchanged:: 2.2.0
  190
+      The default of *use_decimal* changed to ``True`` in 2.2.0.
  191
+
  192
+   If *namedtuple_as_object* is true (default: ``True``),
  193
+   objects with ``_asdict()`` methods will be encoded
  194
+   as JSON objects.
  195
+
  196
+   .. versionchanged:: 2.2.0
  197
+     *namedtuple_as_object* is new in 2.2.0.
  198
+
  199
+   .. versionchanged:: 2.3.0
  200
+     *namedtuple_as_object* no longer requires that these objects be
  201
+     subclasses of :class:`tuple`.
  202
+
  203
+   If *tuple_as_array* is true (default: ``True``),
  204
+   :class:`tuple` (and subclasses) will be encoded as JSON arrays.
  205
+
  206
+   .. versionchanged:: 2.2.0
  207
+     *tuple_as_array* is new in 2.2.0.
  208
+
  209
+   If *bigint_as_string* is true (default: ``False``), :class:`int`` ``2**53``
  210
+   and higher or lower than ``-2**53`` will be encoded as strings. This is to
  211
+   avoid the rounding that happens in Javascript otherwise. Note that this
  212
+   option loses type information, so use with extreme caution.
  213
+
  214
+   .. versionchanged:: 2.4.0
  215
+     *bigint_as_string* is new in 2.4.0.
  216
+
  217
+   If *sort_keys* is true (not the default), then the output of dictionaries
  218
+   will be sorted by key; this is useful for regression tests to ensure that
  219
+   JSON serializations can be compared on a day-to-day basis.
  220
+
  221
+   If *item_sort_key* is a callable (not the default), then the output of
  222
+   dictionaries will be sorted with it. The callable will be used like this:
  223
+   ``sorted(dct.items(), key=item_sort_key)``. This option takes precedence
  224
+   over *sort_keys*.
  225
+
  226
+   .. versionchanged:: 2.5.0
  227
+      *item_sort_key* is new in 2.5.0.
  228
+
  229
+    .. note::
  230
+
  231
+        JSON is not a framed protocol so unlike :mod:`pickle` or :mod:`marshal` it
  232
+        does not make sense to serialize more than one JSON document without some
  233
+        container protocol to delimit them.
  234
+
  235
+
  236
+.. function:: dumps(obj[, skipkeys[, ensure_ascii[, check_circular[, allow_nan[, cls[, indent[, separators[, encoding[, default[, use_decimal[, namedtuple_as_object[, tuple_as_array[, bigint_as_string[, sort_keys[, item_sort_key[, **kw]]]]]]]]]]]]]]]])
  237
+
  238
+   Serialize *obj* to a JSON formatted :class:`str`.
  239
+
  240
+   If *ensure_ascii* is false, then the return value will be a
  241
+   :class:`unicode` instance.  The other arguments have the same meaning as in
  242
+   :func:`dump`. Note that the default *ensure_ascii* setting has much
  243
+   better performance.
  244
+
  245
+
  246
+.. function:: load(fp[, encoding[, cls[, object_hook[, parse_float[, parse_int[, parse_constant[, object_pairs_hook[, use_decimal[, **kw]]]]]]]]])
  247
+
  248
+   Deserialize *fp* (a ``.read()``-supporting file-like object containing a JSON
  249
+   document) to a Python object. :exc:`JSONDecodeError` will be
  250
+   raised if the given JSON document is not valid.
  251
+
  252
+   If the contents of *fp* are encoded with an ASCII based encoding other than
  253
+   UTF-8 (e.g. latin-1), then an appropriate *encoding* name must be specified.
  254
+   Encodings that are not ASCII based (such as UCS-2) are not allowed, and
  255
+   should be wrapped with ``codecs.getreader(fp)(encoding)``, or simply decoded
  256
+   to a :class:`unicode` object and passed to :func:`loads`. The default
  257
+   setting of ``'utf-8'`` is fastest and should be using whenever possible.
  258
+
  259
+   If *fp.read()* returns :class:`str` then decoded JSON strings that contain
  260
+   only ASCII characters may be parsed as :class:`str` for performance and
  261
+   memory reasons. If your code expects only :class:`unicode` the appropriate
  262
+   solution is to wrap fp with a reader as demonstrated above.
  263
+
  264
+   *object_hook* is an optional function that will be called with the result of
  265
+   any object literal decode (a :class:`dict`).  The return value of
  266
+   *object_hook* will be used instead of the :class:`dict`.  This feature can be used
  267
+   to implement custom decoders (e.g. JSON-RPC class hinting).
  268
+
  269
+   *object_pairs_hook* is an optional function that will be called with the
  270
+   result of any object literal decode with an ordered list of pairs.  The
  271
+   return value of *object_pairs_hook* will be used instead of the
  272
+   :class:`dict`.  This feature can be used to implement custom decoders that
  273
+   rely on the order that the key and value pairs are decoded (for example,
  274
+   :class:`collections.OrderedDict` will remember the order of insertion). If
  275
+   *object_hook* is also defined, the *object_pairs_hook* takes priority.
  276
+
  277
+   .. versionchanged:: 2.1.0
  278
+      Added support for *object_pairs_hook*.
  279
+
  280
+   *parse_float*, if specified, will be called with the string of every JSON
  281
+   float to be decoded.  By default, this is equivalent to ``float(num_str)``.
  282
+   This can be used to use another datatype or parser for JSON floats
  283
+   (e.g. :class:`decimal.Decimal`).
  284
+
  285
+   *parse_int*, if specified, will be called with the string of every JSON int
  286
+   to be decoded.  By default, this is equivalent to ``int(num_str)``.  This can
  287
+   be used to use another datatype or parser for JSON integers
  288
+   (e.g. :class:`float`).
  289
+
  290
+   *parse_constant*, if specified, will be called with one of the following
  291
+   strings: ``'-Infinity'``, ``'Infinity'``, ``'NaN'``.  This can be used to
  292
+   raise an exception if invalid JSON numbers are encountered.
  293
+
  294
+   If *use_decimal* is true (default: ``False``) then *parse_float* is set to
  295
+   :class:`decimal.Decimal`. This is a convenience for parity with the
  296
+   :func:`dump` parameter.
  297
+
  298
+   .. versionchanged:: 2.1.0
  299
+      *use_decimal* is new in 2.1.0.
  300
+
  301
+   To use a custom :class:`JSONDecoder` subclass, specify it with the ``cls``
  302
+   kwarg.  Additional keyword arguments will be passed to the constructor of the
  303
+   class.
  304
+
  305
+    .. note::
  306
+
  307
+        :func:`load` will read the rest of the file-like object as a string and
  308
+        then call :func:`loads`. It does not stop at the end of the first valid
  309
+        JSON document it finds and it will raise an error if there is anything
  310
+        other than whitespace after the document. Except for files containing
  311
+        only one JSON document, it is recommended to use :func:`loads`.
  312
+
  313
+
  314
+.. function:: loads(s[, encoding[, cls[, object_hook[, parse_float[, parse_int[, parse_constant[, object_pairs_hook[, use_decimal[, **kw]]]]]]]]])
  315
+
  316
+   Deserialize *s* (a :class:`str` or :class:`unicode` instance containing a JSON
  317
+   document) to a Python object. :exc:`JSONDecodeError` will be
  318
+   raised if the given JSON document is not valid.
  319
+
  320
+   If *s* is a :class:`str` instance and is encoded with an ASCII based encoding
  321
+   other than UTF-8 (e.g. latin-1), then an appropriate *encoding* name must be
  322
+   specified.  Encodings that are not ASCII based (such as UCS-2) are not
  323
+   allowed and should be decoded to :class:`unicode` first.
  324
+
  325
+   If *s* is a :class:`str` then decoded JSON strings that contain
  326
+   only ASCII characters may be parsed as :class:`str` for performance and
  327
+   memory reasons. If your code expects only :class:`unicode` the appropriate
  328
+   solution is decode *s* to :class:`unicode` prior to calling loads.
  329
+
  330
+   The other arguments have the same meaning as in :func:`load`.
  331
+
  332
+
  333
+Encoders and decoders
  334
+---------------------
  335
+
  336
+.. class:: JSONDecoder([encoding[, object_hook[, parse_float[, parse_int[, parse_constant[, object_pairs_hook[, strict]]]]]]])
  337
+
  338
+   Simple JSON decoder.
  339
+
  340
+   Performs the following translations in decoding by default:
  341
+
  342
+   +---------------+-------------------+
  343
+   | JSON          | Python            |
  344
+   +===============+===================+
  345
+   | object        | dict              |
  346
+   +---------------+-------------------+
  347
+   | array         | list              |
  348
+   +---------------+-------------------+
  349
+   | string        | unicode           |
  350
+   +---------------+-------------------+
  351
+   | number (int)  | int, long         |
  352
+   +---------------+-------------------+
  353
+   | number (real) | float             |
  354
+   +---------------+-------------------+
  355
+   | true          | True              |
  356
+   +---------------+-------------------+
  357
+   | false         | False             |
  358
+   +---------------+-------------------+
  359
+   | null          | None              |
  360
+   +---------------+-------------------+
  361
+
  362
+   It also understands ``NaN``, ``Infinity``, and ``-Infinity`` as their
  363
+   corresponding ``float`` values, which is outside the JSON spec.
  364
+
  365
+   *encoding* determines the encoding used to interpret any :class:`str` objects
  366
+   decoded by this instance (``'utf-8'`` by default).  It has no effect when decoding
  367
+   :class:`unicode` objects.
  368
+
  369
+   Note that currently only encodings that are a superset of ASCII work, strings
  370
+   of other encodings should be passed in as :class:`unicode`.
  371
+
  372
+   *object_hook* is an optional function that will be called with the result of
  373
+   every JSON object decoded and its return value will be used in place of the
  374
+   given :class:`dict`.  This can be used to provide custom deserializations
  375
+   (e.g. to support JSON-RPC class hinting).
  376
+
  377
+   *object_pairs_hook* is an optional function that will be called with the
  378
+   result of any object literal decode with an ordered list of pairs.  The
  379
+   return value of *object_pairs_hook* will be used instead of the
  380
+   :class:`dict`.  This feature can be used to implement custom decoders that
  381
+   rely on the order that the key and value pairs are decoded (for example,
  382
+   :class:`collections.OrderedDict` will remember the order of insertion). If
  383
+   *object_hook* is also defined, the *object_pairs_hook* takes priority.
  384
+
  385
+   .. versionchanged:: 2.1.0
  386
+      Added support for *object_pairs_hook*.
  387
+
  388
+   *parse_float*, if specified, will be called with the string of every JSON
  389
+   float to be decoded.  By default, this is equivalent to ``float(num_str)``.
  390
+   This can be used to use another datatype or parser for JSON floats
  391
+   (e.g. :class:`decimal.Decimal`).
  392
+
  393
+   *parse_int*, if specified, will be called with the string of every JSON int
  394
+   to be decoded.  By default, this is equivalent to ``int(num_str)``.  This can
  395
+   be used to use another datatype or parser for JSON integers
  396
+   (e.g. :class:`float`).
  397
+
  398
+   *parse_constant*, if specified, will be called with one of the following
  399
+   strings: ``'-Infinity'``, ``'Infinity'``, ``'NaN'``.  This can be used to
  400
+   raise an exception if invalid JSON numbers are encountered.
  401
+
  402
+   *strict* controls the parser's behavior when it encounters an invalid
  403
+   control character in a string. The default setting of ``True`` means that
  404
+   unescaped control characters are parse errors, if ``False`` then control
  405
+   characters will be allowed in strings.
  406
+
  407
+   .. method:: decode(s)
  408
+
  409
+      Return the Python representation of *s* (a :class:`str` or
  410
+      :class:`unicode` instance containing a JSON document)
  411
+
  412
+      If *s* is a :class:`str` then decoded JSON strings that contain
  413
+      only ASCII characters may be parsed as :class:`str` for performance and
  414
+      memory reasons. If your code expects only :class:`unicode` the
  415
+      appropriate solution is decode *s* to :class:`unicode` prior to calling
  416
+      decode.
  417
+
  418
+      :exc:`JSONDecodeError` will be raised if the given JSON
  419
+      document is not valid.
  420
+
  421
+   .. method:: raw_decode(s)
  422
+
  423
+      Decode a JSON document from *s* (a :class:`str` or :class:`unicode`
  424
+      beginning with a JSON document) and return a 2-tuple of the Python
  425
+      representation and the index in *s* where the document ended.
  426
+
  427
+      This can be used to decode a JSON document from a string that may have
  428
+      extraneous data at the end.
  429
+
  430
+      :exc:`JSONDecodeError` will be raised if the given JSON
  431
+      document is not valid.
  432
+
  433
+.. class:: JSONEncoder([skipkeys[, ensure_ascii[, check_circular[, allow_nan[, sort_keys[, indent[, separators[, encoding[, default[, use_decimal[, namedtuple_as_object[, tuple_as_array[, bigint_as_string[, item_sort_key]]]]]]]]]]]]])
  434
+
  435
+   Extensible JSON encoder for Python data structures.
  436
+
  437
+   Supports the following objects and types by default:
  438
+
  439
+   +-------------------+---------------+
  440
+   | Python            | JSON          |
  441
+   +===================+===============+
  442
+   | dict, namedtuple  | object        |
  443
+   +-------------------+---------------+
  444
+   | list, tuple       | array         |
  445
+   +-------------------+---------------+
  446
+   | str, unicode      | string        |
  447
+   +-------------------+---------------+
  448
+   | int, long, float  | number        |
  449
+   +-------------------+---------------+
  450
+   | True              | true          |
  451
+   +-------------------+---------------+
  452
+   | False             | false         |
  453
+   +-------------------+---------------+
  454
+   | None              | null          |
  455
+   +-------------------+---------------+
  456
+
  457
+   .. versionchanged:: 2.2.0
  458
+      Changed *namedtuple* encoding from JSON array to object.
  459
+
  460
+   To extend this to recognize other objects, subclass and implement a
  461
+   :meth:`default` method with another method that returns a serializable object
  462
+   for ``o`` if possible, otherwise it should call the superclass implementation
  463
+   (to raise :exc:`TypeError`).
  464
+
  465
+   If *skipkeys* is false (the default), then it is a :exc:`TypeError` to
  466
+   attempt encoding of keys that are not str, int, long, float or None.  If
  467
+   *skipkeys* is true, such items are simply skipped.
  468
+
  469
+   If *ensure_ascii* is true (the default), the output is guaranteed to be
  470
+   :class:`str` objects with all incoming unicode characters escaped.  If
  471
+   *ensure_ascii* is false, the output will be a unicode object.
  472
+
  473
+   If *check_circular* is false (the default), then lists, dicts, and custom
  474
+   encoded objects will be checked for circular references during encoding to
  475
+   prevent an infinite recursion (which would cause an :exc:`OverflowError`).
  476
+   Otherwise, no such check takes place.
  477
+
  478
+   If *allow_nan* is true (the default), then ``NaN``, ``Infinity``, and
  479
+   ``-Infinity`` will be encoded as such.  This behavior is not JSON
  480
+   specification compliant, but is consistent with most JavaScript based
  481
+   encoders and decoders.  Otherwise, it will be a :exc:`ValueError` to encode
  482
+   such floats.
  483
+
  484
+   If *sort_keys* is true (not the default), then the output of dictionaries
  485
+   will be sorted by key; this is useful for regression tests to ensure that
  486
+   JSON serializations can be compared on a day-to-day basis.
  487
+
  488
+   If *item_sort_key* is a callable (not the default), then the output of
  489
+   dictionaries will be sorted with it. The callable will be used like this:
  490
+   ``sorted(dct.items(), key=item_sort_key)``. This option takes precedence
  491
+   over *sort_keys*.
  492
+
  493
+   .. versionchanged:: 2.5.0
  494
+      *item_sort_key* is new in 2.5.0.
  495
+
  496
+   If *indent* is a string, then JSON array elements and object members
  497
+   will be pretty-printed with a newline followed by that string repeated
  498
+   for each level of nesting. ``None`` (the default) selects the most compact
  499
+   representation without any newlines. For backwards compatibility with
  500
+   versions of simplejson earlier than 2.1.0, an integer is also accepted
  501
+   and is converted to a string with that many spaces.
  502
+
  503
+   .. versionchanged:: 2.1.0
  504
+      Changed *indent* from an integer number of spaces to a string.
  505
+
  506
+   If specified, *separators* should be an ``(item_separator, key_separator)``
  507
+   tuple.  By default, ``(', ', ': ')`` are used.  To get the most compact JSON
  508
+   representation, you should specify ``(',', ':')`` to eliminate whitespace.
  509
+
  510
+   If specified, *default* should be a function that gets called for objects
  511
+   that can't otherwise be serialized.  It should return a JSON encodable
  512
+   version of the object or raise a :exc:`TypeError`.
  513
+
  514
+   If *encoding* is not ``None``, then all input strings will be transformed
  515
+   into unicode using that encoding prior to JSON-encoding.  The default is
  516
+   ``'utf-8'``.
  517
+
  518
+   If *namedtuple_as_object* is true (default: ``True``),
  519
+   objects with ``_asdict()`` methods will be encoded
  520
+   as JSON objects.
  521
+
  522
+   .. versionchanged:: 2.2.0
  523
+     *namedtuple_as_object* is new in 2.2.0.
  524
+
  525
+   .. versionchanged:: 2.3.0
  526
+     *namedtuple_as_object* no longer requires that these objects be
  527
+     subclasses of :class:`tuple`.
  528
+
  529
+   If *tuple_as_array* is true (default: ``True``),
  530
+   :class:`tuple` (and subclasses) will be encoded as JSON arrays.
  531
+
  532
+   .. versionchanged:: 2.2.0
  533
+     *tuple_as_array* is new in 2.2.0.
  534
+
  535
+   If *bigint_as_string* is true (default: ``False``), :class:`int`` ``2**53``
  536
+   and higher or lower than ``-2**53`` will be encoded as strings. This is to
  537
+   avoid the rounding that happens in Javascript otherwise. Note that this
  538
+   option loses type information, so use with extreme caution.
  539
+
  540
+   .. versionchanged:: 2.4.0
  541
+     *bigint_as_string* is new in 2.4.0.
  542
+
  543
+
  544
+   .. method:: default(o)
  545
+
  546
+      Implement this method in a subclass such that it returns a serializable
  547
+      object for *o*, or calls the base implementation (to raise a
  548
+      :exc:`TypeError`).
  549
+
  550
+      For example, to support arbitrary iterators, you could implement default
  551
+      like this::
  552
+
  553
+         def default(self, o):
  554
+            try:
  555
+                iterable = iter(o)
  556
+            except TypeError:
  557
+                pass
  558
+            else:
  559
+                return list(iterable)
  560
+            return JSONEncoder.default(self, o)
  561
+
  562
+