Skip to content

Commit d410524

Browse files
committed
docs
git-svn-id: http://simplejson.googlecode.com/svn/trunk@7 a4795897-2c25-0410-b006-0d3caba88fa1
1 parent 27ece59 commit d410524

13 files changed

Lines changed: 1111 additions & 86 deletions

docs/class-simplejson.JSONDecoder.html

Lines changed: 54 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
<TITLE>simplejson.JSONDecoder -- Simple JSON &amp;lt;&lt;a class="reference" href="http://json.org">http://json.org&lt;/a>&amp;gt; decoder</TITLE>
66
<LINK HREF="layout.css" TYPE="text/css" REL="stylesheet">
77

8+
<SCRIPT SRC="class_to_source.js" TYPE="text/javascript">
9+
</SCRIPT>
810
</HEAD>
911
<BODY>
1012
<DIV ID="page">
@@ -57,21 +59,20 @@ <H4 CLASS="pudge-member-page-subheading">
5759
<DIV ID="pudge-section-nav">
5860
<UL>
5961
<LI>
60-
<A HREF="#attributes" CLASS="pudge-section-link">
61-
Attributes (1)
62-
</A>
6362

63+
<SPAN CLASS="pudge-missing-section-link">
64+
Attributes
65+
</SPAN>
6466
</LI>
65-
6667
<LI>
6768
<A HREF="#methods" CLASS="pudge-section-link">
68-
Methods (1)
69+
Methods (3)
6970
</A>
7071

7172
</LI>
7273

7374
<LI>
74-
<A HREF="simplejson/decoder.py.html?f=196&amp;l=257#196" CLASS="pudge-section-link">
75+
<A HREF="simplejson/decoder.py.html#196" CLASS="pudge-section-link lines-196-266">
7576
Source
7677
</A>
7778
</LI>
@@ -138,42 +139,70 @@ <H4 CLASS="pudge-member-page-subheading">
138139

139140

140141

141-
<A NAME="attributes">
142+
<A NAME="methods">
142143

143144

144145
</A>
145-
<H2>Attributes</H2>
146-
<DIV CLASS="pudge-member name">
147-
<A NAME="scanner">
146+
<H2>Methods</H2>
147+
<DIV CLASS="pudge-member routine alias">
148+
<A NAME="__init__">
148149
</A>
149150
<H4 CLASS="pudge-member-name">
150-
<SPAN CLASS="prefix">a</SPAN>
151+
<SPAN CLASS="prefix">f</SPAN>
151152
<TT>
152-
<A HREF="class-simplejson.JSONDecoder.html#scanner" CLASS="pudge-obj-link">scanner</A></TT></H4>
153+
<A HREF="class-simplejson.JSONDecoder.html#__init__" CLASS="pudge-obj-link">__init__</A>(self, encoding=None)</TT>
154+
<A HREF="simplejson/decoder.py.html#229" CLASS="lines-229-239" TITLE="View Source">...</A>
155+
</H4>
153156
<DIV CLASS="pudge-section rst">
154-
<PRE>&lt;simplejson.scanner.Scanner object at 0x67ec70></PRE>
157+
158+
<P CLASS="pudge-member-blurb">
159+
<TT CLASS="docutils literal">
160+
<SPAN CLASS="pre">encoding</SPAN></TT> determines the encoding used to interpret any <TT CLASS="docutils literal"><SPAN CLASS="pre">str</SPAN></TT>
161+
objects decoded by this instance (utf-8 by default). It has no
162+
effect when decoding <TT CLASS="docutils literal"><SPAN CLASS="pre">unicode</SPAN></TT> objects.
163+
</P>
164+
<P>Note that currently only encodings that are a superset of ASCII work,
165+
strings of other encodings should be passed in as <TT CLASS="docutils literal"><SPAN CLASS="pre">unicode</SPAN></TT>.</P>
166+
155167
</DIV>
156168
</DIV>
169+
<DIV CLASS="pudge-member routine alias">
170+
<A NAME="decode">
171+
</A>
172+
<H4 CLASS="pudge-member-name">
173+
<SPAN CLASS="prefix">f</SPAN>
174+
<TT>
175+
<A HREF="class-simplejson.JSONDecoder.html#decode" CLASS="pudge-obj-link">decode</A>(self, s)</TT>
176+
<A HREF="simplejson/decoder.py.html#240" CLASS="lines-240-250" TITLE="View Source">...</A>
177+
</H4>
178+
<DIV CLASS="pudge-section rst">
179+
180+
<P CLASS="pudge-member-blurb">
181+
Return the Python representation of <TT CLASS="docutils literal"><SPAN CLASS="pre">s</SPAN></TT> (a <TT CLASS="docutils literal"><SPAN CLASS="pre">str</SPAN></TT> or <TT CLASS="docutils literal"><SPAN CLASS="pre">unicode</SPAN></TT>
182+
instance containing a JSON document)
183+
</P>
157184

158185

159-
<A NAME="methods">
160-
161-
162-
</A>
163-
<H2>Methods</H2>
164-
<DIV CLASS="pudge-member routine alias">
165-
<A NAME="__init__">
186+
</DIV>
187+
</DIV>
188+
<DIV CLASS="pudge-member routine alias">
189+
<A NAME="raw_decode">
166190
</A>
167191
<H4 CLASS="pudge-member-name">
168192
<SPAN CLASS="prefix">f</SPAN>
169193
<TT>
170-
<A HREF="class-simplejson.JSONDecoder.html#__init__" CLASS="pudge-obj-link">__init__</A>(self, encoding=None)</TT>
171-
<A HREF="simplejson/decoder.py.html?f=228&amp;l=230#228" TITLE="View Source">...</A>
194+
<A HREF="class-simplejson.JSONDecoder.html#raw_decode" CLASS="pudge-obj-link">raw_decode</A>(self, s)</TT>
195+
<A HREF="simplejson/decoder.py.html#251" CLASS="lines-251-266" TITLE="View Source">...</A>
172196
</H4>
173197
<DIV CLASS="pudge-section rst">
174198

175-
176-
199+
<P CLASS="pudge-member-blurb">
200+
Decode a JSON document from <TT CLASS="docutils literal"><SPAN CLASS="pre">s</SPAN></TT> (a <TT CLASS="docutils literal"><SPAN CLASS="pre">str</SPAN></TT> or <TT CLASS="docutils literal"><SPAN CLASS="pre">unicode</SPAN></TT> beginning
201+
with a JSON document) and return a 2-tuple of the Python
202+
representation and the index in <TT CLASS="docutils literal"><SPAN CLASS="pre">s</SPAN></TT> where the document ended.
203+
</P>
204+
<P>This can be used to decode a JSON document from a string that may
205+
have extraneous data at the end.</P>
177206

178207
</DIV>
179208
</DIV>
@@ -185,7 +214,7 @@ <H4 CLASS="pudge-member-name">
185214

186215

187216
See
188-
<A HREF="simplejson/decoder.py.html?f=196&amp;l=257#196" TITLE="simplejson/decoder.py:196">the source</A>
217+
<A HREF="simplejson/decoder.py.html?f=196&amp;l=266#196" TITLE="simplejson/decoder.py:196">the source</A>
189218
for more information.
190219
</SMALL>
191220
</P>

docs/class-simplejson.JSONEncoder.html

Lines changed: 82 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
<TITLE>simplejson.JSONEncoder -- Extensible JSON &amp;lt;&lt;a class="reference" href="http://json.org">http://json.org&lt;/a>&amp;gt; encoder for Python data structures.</TITLE>
66
<LINK HREF="layout.css" TYPE="text/css" REL="stylesheet">
77

8+
<SCRIPT SRC="class_to_source.js" TYPE="text/javascript">
9+
</SCRIPT>
810
</HEAD>
911
<BODY>
1012
<DIV ID="page">
@@ -64,13 +66,13 @@ <H4 CLASS="pudge-member-page-subheading">
6466
</LI>
6567
<LI>
6668
<A HREF="#methods" CLASS="pudge-section-link">
67-
Methods (1)
69+
Methods (4)
6870
</A>
6971

7072
</LI>
7173

7274
<LI>
73-
<A HREF="simplejson/encoder.py.html?f=63&amp;l=273#63" CLASS="pudge-section-link">
75+
<A HREF="simplejson/encoder.py.html#63" CLASS="pudge-section-link lines-63-277">
7476
Source
7577
</A>
7678
</LI>
@@ -125,7 +127,7 @@ <H4 CLASS="pudge-member-page-subheading">
125127
</TBODY>
126128
</TABLE>
127129
<P>To extend this to recognize other objects, subclass and implement a
128-
<TT CLASS="docutils literal"><SPAN CLASS="pre">.default(o)</SPAN></TT> method with another method that returns a serializable
130+
<TT CLASS="docutils literal"><SPAN CLASS="pre">.default()</SPAN></TT> method with another method that returns a serializable
129131
object for <TT CLASS="docutils literal"><SPAN CLASS="pre">o</SPAN></TT> if possible, otherwise it should call the superclass
130132
implementation (to raise <TT CLASS="docutils literal"><SPAN CLASS="pre">TypeError</SPAN></TT>).</P>
131133
</DIV>
@@ -147,7 +149,7 @@ <H4 CLASS="pudge-member-name">
147149
<SPAN CLASS="prefix">f</SPAN>
148150
<TT>
149151
<A HREF="class-simplejson.JSONEncoder.html#__init__" CLASS="pudge-obj-link">__init__</A>(self, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True)</TT>
150-
<A HREF="simplejson/encoder.py.html?f=92&amp;l=120#92" TITLE="View Source">...</A>
152+
<A HREF="simplejson/encoder.py.html#93" CLASS="lines-93-121" TITLE="View Source">...</A>
151153
</H4>
152154
<DIV CLASS="pudge-section rst">
153155

@@ -171,6 +173,81 @@ <H4 CLASS="pudge-member-name">
171173

172174
</DIV>
173175
</DIV>
176+
<DIV CLASS="pudge-member routine alias">
177+
<A NAME="default">
178+
</A>
179+
<H4 CLASS="pudge-member-name">
180+
<SPAN CLASS="prefix">f</SPAN>
181+
<TT>
182+
<A HREF="class-simplejson.JSONEncoder.html#default" CLASS="pudge-obj-link">default</A>(self, o)</TT>
183+
<A HREF="simplejson/encoder.py.html#229" CLASS="lines-229-248" TITLE="View Source">...</A>
184+
</H4>
185+
<DIV CLASS="pudge-section rst">
186+
187+
<P CLASS="pudge-member-blurb">
188+
Implement this method in a subclass such that it returns
189+
a serializable object for <TT CLASS="docutils literal"><SPAN CLASS="pre">o</SPAN></TT>, or calls the base implementation
190+
(to raise a <TT CLASS="docutils literal"><SPAN CLASS="pre">TypeError</SPAN></TT>).
191+
</P>
192+
<P>For example, to support arbitrary iterators, you could
193+
implement default like this:</P>
194+
<PRE CLASS="literal-block">
195+
def default(self, o):
196+
try:
197+
iterable = iter(o)
198+
except TypeError:
199+
pass
200+
else:
201+
return list(iterable)
202+
return JSONEncoder.default(self, o)
203+
</PRE>
204+
205+
</DIV>
206+
</DIV>
207+
<DIV CLASS="pudge-member routine alias">
208+
<A NAME="encode">
209+
</A>
210+
<H4 CLASS="pudge-member-name">
211+
<SPAN CLASS="prefix">f</SPAN>
212+
<TT>
213+
<A HREF="class-simplejson.JSONEncoder.html#encode" CLASS="pudge-obj-link">encode</A>(self, o)</TT>
214+
<A HREF="simplejson/encoder.py.html#249" CLASS="lines-249-261" TITLE="View Source">...</A>
215+
</H4>
216+
<DIV CLASS="pudge-section rst">
217+
218+
<P CLASS="pudge-member-blurb">
219+
Return a JSON string representation of a Python data structure.
220+
</P>
221+
<PRE CLASS="doctest-block">
222+
>>> JSONEncoder().encode({"foo": ["bar", "baz"]})
223+
'{"foo":["bar", "baz"]}'
224+
</PRE>
225+
226+
</DIV>
227+
</DIV>
228+
<DIV CLASS="pudge-member routine alias">
229+
<A NAME="iterencode">
230+
</A>
231+
<H4 CLASS="pudge-member-name">
232+
<SPAN CLASS="prefix">f</SPAN>
233+
<TT>
234+
<A HREF="class-simplejson.JSONEncoder.html#iterencode" CLASS="pudge-obj-link">iterencode</A>(self, o)</TT>
235+
<A HREF="simplejson/encoder.py.html#262" CLASS="lines-262-277" TITLE="View Source">...</A>
236+
</H4>
237+
<DIV CLASS="pudge-section rst">
238+
239+
<P CLASS="pudge-member-blurb">
240+
Encode the given object and yield each string
241+
representation as available.
242+
</P>
243+
<P>For example:</P>
244+
<PRE CLASS="literal-block">
245+
for chunk in JSONEncoder().iterencode(bigobject):
246+
mysocket.write(chunk)
247+
</PRE>
248+
249+
</DIV>
250+
</DIV>
174251

175252

176253

@@ -179,7 +256,7 @@ <H4 CLASS="pudge-member-name">
179256

180257

181258
See
182-
<A HREF="simplejson/encoder.py.html?f=63&amp;l=273#63" TITLE="simplejson/encoder.py:63">the source</A>
259+
<A HREF="simplejson/encoder.py.html?f=63&amp;l=277#63" TITLE="simplejson/encoder.py:63">the source</A>
183260
for more information.
184261
</SMALL>
185262
</P>

docs/class_to_source.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
(function () {
2+
var href = document.location.href;
3+
if (href.indexOf("file:") == 0 || !document.getElementsByTagName) return;
4+
var _old_onload = window.onload;
5+
window.onload = function () {
6+
if (_old_onload) _old_onload.call(this);
7+
_old_onload = null;
8+
var anchors = document.getElementsByTagName('A');
9+
var class_re = /\blines-(\d+)-(\d+)\b/;
10+
var hash_re = /#.*$/;
11+
for (var i = 0; i < anchors.length; i++) {
12+
var anchor = anchors[i];
13+
var found = anchor.className.match(class_re);
14+
if (!found) continue;
15+
href = anchor.href;
16+
var hashidx = href.indexOf("#");
17+
if (hashidx == -1) hashidx = href.length;
18+
anchor.href = (href.substring(0, hashidx) + "?f=" + found[1] +
19+
"&l=" + found[2] + href.substring(hashidx, href.length));
20+
}
21+
}
22+
})();

docs/index.html

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
<TITLE>simplejson -- A simple, fast, extensible JSON encoder and decoder</TITLE>
66
<LINK HREF="layout.css" TYPE="text/css" REL="stylesheet">
77

8+
<SCRIPT SRC="class_to_source.js" TYPE="text/javascript">
9+
</SCRIPT>
810
</HEAD>
911
<BODY>
1012
<DIV ID="page">
@@ -81,7 +83,7 @@ <H4 CLASS="pudge-member-page-subheading">
8183
</A>
8284
</LI>
8385
<LI>
84-
<A HREF="simplejson/__init__.py.html" CLASS="pudge-section-link">
86+
<A HREF="simplejson/__init__.py.html" CLASS="pudge-section-link ">
8587
Source
8688
</A>
8789
</LI>
@@ -161,7 +163,7 @@ <H4 CLASS="pudge-member-name">
161163
<SPAN CLASS="prefix">f</SPAN>
162164
<TT>
163165
<A HREF="module-simplejson.html#dump" CLASS="pudge-obj-link">dump</A>(obj, fp, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, cls=None)</TT>
164-
<A HREF="simplejson/__init__.py.html?f=69&amp;l=107#69" TITLE="View Source">...</A>
166+
<A HREF="simplejson/__init__.py.html#69" CLASS="lines-69-107" TITLE="View Source">...</A>
165167
</H4>
166168
<DIV CLASS="pudge-section rst">
167169

@@ -197,7 +199,7 @@ <H4 CLASS="pudge-member-name">
197199
<SPAN CLASS="prefix">f</SPAN>
198200
<TT>
199201
<A HREF="module-simplejson.html#dumps" CLASS="pudge-obj-link">dumps</A>(obj, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, cls=None)</TT>
200-
<A HREF="simplejson/__init__.py.html?f=108&amp;l=138#108" TITLE="View Source">...</A>
202+
<A HREF="simplejson/__init__.py.html#108" CLASS="lines-108-138" TITLE="View Source">...</A>
201203
</H4>
202204
<DIV CLASS="pudge-section rst">
203205

@@ -230,7 +232,7 @@ <H4 CLASS="pudge-member-name">
230232
<SPAN CLASS="prefix">f</SPAN>
231233
<TT>
232234
<A HREF="module-simplejson.html#load" CLASS="pudge-obj-link">load</A>(fp, encoding=None, cls=None)</TT>
233-
<A HREF="simplejson/__init__.py.html?f=139&amp;l=157#139" TITLE="View Source">...</A>
235+
<A HREF="simplejson/__init__.py.html#139" CLASS="lines-139-157" TITLE="View Source">...</A>
234236
</H4>
235237
<DIV CLASS="pudge-section rst">
236238

@@ -256,7 +258,7 @@ <H4 CLASS="pudge-member-name">
256258
<SPAN CLASS="prefix">f</SPAN>
257259
<TT>
258260
<A HREF="module-simplejson.html#loads" CLASS="pudge-obj-link">loads</A>(s, encoding=None, cls=None)</TT>
259-
<A HREF="simplejson/__init__.py.html?f=158&amp;l=174#158" TITLE="View Source">...</A>
261+
<A HREF="simplejson/__init__.py.html#158" CLASS="lines-158-174" TITLE="View Source">...</A>
260262
</H4>
261263
<DIV CLASS="pudge-section rst">
262264

@@ -285,7 +287,7 @@ <H4 CLASS="pudge-member-name">
285287
<SPAN CLASS="prefix">C</SPAN>
286288
<TT>
287289
<A HREF="class-simplejson.JSONEncoder.html" CLASS="pudge-obj-link">JSONEncoder</A>(...)</TT>
288-
<A HREF="simplejson/encoder.py.html?f=63&amp;l=273#63" CLASS="pudge-member-view-source" TITLE="View Source">...</A>
290+
<A HREF="simplejson/encoder.py.html#63" CLASS="pudge-member-view-source lines-63-277" TITLE="View Source">...</A>
289291
</H4>
290292
<DIV CLASS="pudge-section rst">
291293

@@ -338,14 +340,14 @@ <H4 CLASS="pudge-member-name">
338340
</TBODY>
339341
</TABLE>
340342
<P>To extend this to recognize other objects, subclass and implement a
341-
<TT CLASS="docutils literal"><SPAN CLASS="pre">.default(o)</SPAN></TT> method with another method that returns a serializable
343+
<TT CLASS="docutils literal"><SPAN CLASS="pre">.default()</SPAN></TT> method with another method that returns a serializable
342344
object for <TT CLASS="docutils literal"><SPAN CLASS="pre">o</SPAN></TT> if possible, otherwise it should call the superclass
343345
implementation (to raise <TT CLASS="docutils literal"><SPAN CLASS="pre">TypeError</SPAN></TT>).</P>
344346

345347

346348
<P CLASS="note">
347349
This class contains <A HREF="class-simplejson.JSONEncoder.html#members">
348-
1 member</A>.
350+
5 members</A>.
349351
</P>
350352
</DIV>
351353
</DIV>
@@ -354,7 +356,7 @@ <H4 CLASS="pudge-member-name">
354356
<SPAN CLASS="prefix">C</SPAN>
355357
<TT>
356358
<A HREF="class-simplejson.JSONDecoder.html" CLASS="pudge-obj-link">JSONDecoder</A>(...)</TT>
357-
<A HREF="simplejson/decoder.py.html?f=196&amp;l=257#196" CLASS="pudge-member-view-source" TITLE="View Source">...</A>
359+
<A HREF="simplejson/decoder.py.html#196" CLASS="pudge-member-view-source lines-196-266" TITLE="View Source">...</A>
358360
</H4>
359361
<DIV CLASS="pudge-section rst">
360362

@@ -416,7 +418,7 @@ <H4 CLASS="pudge-member-name">
416418

417419
<P CLASS="note">
418420
This class contains <A HREF="class-simplejson.JSONDecoder.html#members">
419-
2 members</A>.
421+
4 members</A>.
420422
</P>
421423
</DIV>
422424
</DIV>

0 commit comments

Comments
 (0)