pygments.rb 0.2.13 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/README.md +45 -19
- data/Rakefile +21 -11
- data/bench.rb +15 -48
- data/cache-lexers.rb +8 -0
- data/lexers +0 -0
- data/lib/pygments.rb +3 -6
- data/lib/pygments/mentos.py +343 -0
- data/lib/pygments/popen.rb +383 -0
- data/lib/pygments/version.rb +1 -1
- data/pygments.rb.gemspec +5 -4
- data/test/test_data.c +2581 -0
- data/test/test_data.py +514 -0
- data/test/test_data_generated +2582 -0
- data/test/test_pygments.rb +208 -84
- data/vendor/pygments-main/pygments/lexers/_mapping.py +1 -1
- data/vendor/pygments-main/pygments/lexers/shell.py +1 -1
- data/vendor/simplejson/.gitignore +10 -0
- data/vendor/simplejson/.travis.yml +5 -0
- data/vendor/simplejson/CHANGES.txt +291 -0
- data/vendor/simplejson/LICENSE.txt +19 -0
- data/vendor/simplejson/MANIFEST.in +5 -0
- data/vendor/simplejson/README.rst +19 -0
- data/vendor/simplejson/conf.py +179 -0
- data/vendor/simplejson/index.rst +628 -0
- data/vendor/simplejson/scripts/make_docs.py +18 -0
- data/vendor/simplejson/setup.py +104 -0
- data/vendor/simplejson/simplejson/__init__.py +510 -0
- data/vendor/simplejson/simplejson/_speedups.c +2745 -0
- data/vendor/simplejson/simplejson/decoder.py +425 -0
- data/vendor/simplejson/simplejson/encoder.py +567 -0
- data/vendor/simplejson/simplejson/ordered_dict.py +119 -0
- data/vendor/simplejson/simplejson/scanner.py +77 -0
- data/vendor/simplejson/simplejson/tests/__init__.py +67 -0
- data/vendor/simplejson/simplejson/tests/test_bigint_as_string.py +55 -0
- data/vendor/simplejson/simplejson/tests/test_check_circular.py +30 -0
- data/vendor/simplejson/simplejson/tests/test_decimal.py +66 -0
- data/vendor/simplejson/simplejson/tests/test_decode.py +83 -0
- data/vendor/simplejson/simplejson/tests/test_default.py +9 -0
- data/vendor/simplejson/simplejson/tests/test_dump.py +67 -0
- data/vendor/simplejson/simplejson/tests/test_encode_basestring_ascii.py +46 -0
- data/vendor/simplejson/simplejson/tests/test_encode_for_html.py +32 -0
- data/vendor/simplejson/simplejson/tests/test_errors.py +34 -0
- data/vendor/simplejson/simplejson/tests/test_fail.py +91 -0
- data/vendor/simplejson/simplejson/tests/test_float.py +19 -0
- data/vendor/simplejson/simplejson/tests/test_indent.py +86 -0
- data/vendor/simplejson/simplejson/tests/test_item_sort_key.py +20 -0
- data/vendor/simplejson/simplejson/tests/test_namedtuple.py +121 -0
- data/vendor/simplejson/simplejson/tests/test_pass1.py +76 -0
- data/vendor/simplejson/simplejson/tests/test_pass2.py +14 -0
- data/vendor/simplejson/simplejson/tests/test_pass3.py +20 -0
- data/vendor/simplejson/simplejson/tests/test_recursion.py +67 -0
- data/vendor/simplejson/simplejson/tests/test_scanstring.py +117 -0
- data/vendor/simplejson/simplejson/tests/test_separators.py +42 -0
- data/vendor/simplejson/simplejson/tests/test_speedups.py +20 -0
- data/vendor/simplejson/simplejson/tests/test_tuple.py +49 -0
- data/vendor/simplejson/simplejson/tests/test_unicode.py +109 -0
- data/vendor/simplejson/simplejson/tool.py +39 -0
- metadata +80 -22
- data/ext/extconf.rb +0 -14
- data/ext/pygments.c +0 -466
- data/lib/pygments/c.rb +0 -54
- data/lib/pygments/ffi.rb +0 -155
- data/vendor/.gitignore +0 -1
@@ -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.
|
@@ -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
|
+
|
@@ -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
|
@@ -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
|
+
|
563
|
+
.. method:: encode(o)
|
564
|
+
|
565
|
+
Return a JSON string representation of a Python data structure, *o*. For
|
566
|
+
example::
|
567
|
+
|
568
|
+
>>> import simplejson as json
|
569
|
+
>>> json.JSONEncoder().encode({"foo": ["bar", "baz"]})
|
570
|
+
'{"foo": ["bar", "baz"]}'
|
571
|
+
|
572
|
+
|
573
|
+
.. method:: iterencode(o)
|
574
|
+
|
575
|
+
Encode the given object, *o*, and yield each string representation as
|
576
|
+
available. For example::
|
577
|
+
|
578
|
+
for chunk in JSONEncoder().iterencode(bigobject):
|
579
|
+
mysocket.write(chunk)
|
580
|
+
|
581
|
+
Note that :meth:`encode` has much better performance than
|
582
|
+
:meth:`iterencode`.
|
583
|
+
|
584
|
+
.. class:: JSONEncoderForHTML([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]]]]]]]]]]]]])
|
585
|
+
|
586
|
+
Subclass of :class:`JSONEncoder` that escapes &, <, and > for embedding in HTML.
|
587
|
+
|
588
|
+
.. versionchanged:: 2.1.0
|
589
|
+
New in 2.1.0
|
590
|
+
|
591
|
+
Exceptions
|
592
|
+
----------
|
593
|
+
|
594
|
+
.. exception:: JSONDecodeError(msg, doc, pos[, end])
|
595
|
+
|
596
|
+
Subclass of :exc:`ValueError` with the following additional attributes:
|
597
|
+
|
598
|
+
.. attribute:: msg
|
599
|
+
|
600
|
+
The unformatted error message
|
601
|
+
|
602
|
+
.. attribute:: doc
|
603
|
+
|
604
|
+
The JSON document being parsed
|
605
|
+
|
606
|
+
.. attribute:: pos
|
607
|
+
|
608
|
+
The start index of doc where parsing failed
|
609
|
+
|
610
|
+
.. attribute:: end
|
611
|
+
|
612
|
+
The end index of doc where parsing failed (may be ``None``)
|
613
|
+
|
614
|
+
.. attribute:: lineno
|
615
|
+
|
616
|
+
The line corresponding to pos
|
617
|
+
|
618
|
+
.. attribute:: colno
|
619
|
+
|
620
|
+
The column corresponding to pos
|
621
|
+
|
622
|
+
.. attribute:: endlineno
|
623
|
+
|
624
|
+
The line corresponding to end (may be ``None``)
|
625
|
+
|
626
|
+
.. attribute:: endcolno
|
627
|
+
|
628
|
+
The column corresponding to end (may be ``None``)
|