pygments.rb 1.2.1 → 2.0.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (378) hide show
  1. checksums.yaml +5 -5
  2. data/.github/dependabot.yml +13 -0
  3. data/.github/workflows/ci.yml +28 -0
  4. data/.github/workflows/release.yml +24 -0
  5. data/.gitignore +5 -6
  6. data/CHANGELOG.adoc +119 -0
  7. data/Gemfile +3 -1
  8. data/LICENSE +1 -1
  9. data/README.adoc +161 -0
  10. data/Rakefile +10 -21
  11. data/bench.rb +8 -7
  12. data/cache-lexers.rb +3 -2
  13. data/lib/pygments.rb +10 -11
  14. data/lib/pygments/lexer.rb +5 -5
  15. data/lib/pygments/mentos.py +23 -66
  16. data/lib/pygments/popen.rb +152 -204
  17. data/lib/pygments/version.rb +2 -2
  18. data/pygments.rb.gemspec +11 -9
  19. data/test/test_pygments.rb +51 -84
  20. data/vendor/pygments-main/{AUTHORS → Pygments-2.7.3.dist-info/AUTHORS} +21 -3
  21. data/vendor/pygments-main/Pygments-2.7.3.dist-info/INSTALLER +1 -0
  22. data/vendor/pygments-main/{LICENSE → Pygments-2.7.3.dist-info/LICENSE} +1 -1
  23. data/vendor/pygments-main/Pygments-2.7.3.dist-info/METADATA +49 -0
  24. data/vendor/pygments-main/Pygments-2.7.3.dist-info/RECORD +482 -0
  25. data/vendor/pygments-main/Pygments-2.7.3.dist-info/REQUESTED +0 -0
  26. data/vendor/pygments-main/Pygments-2.7.3.dist-info/WHEEL +5 -0
  27. data/vendor/pygments-main/Pygments-2.7.3.dist-info/entry_points.txt +3 -0
  28. data/vendor/pygments-main/Pygments-2.7.3.dist-info/top_level.txt +1 -0
  29. data/vendor/pygments-main/bin/pygmentize +8 -0
  30. data/vendor/pygments-main/pygments/__init__.py +6 -11
  31. data/vendor/pygments-main/pygments/__main__.py +18 -0
  32. data/vendor/pygments-main/pygments/cmdline.py +38 -29
  33. data/vendor/pygments-main/pygments/console.py +6 -9
  34. data/vendor/pygments-main/pygments/filter.py +4 -6
  35. data/vendor/pygments-main/pygments/filters/__init__.py +609 -21
  36. data/vendor/pygments-main/pygments/formatter.py +4 -4
  37. data/vendor/pygments-main/pygments/formatters/__init__.py +9 -8
  38. data/vendor/pygments-main/pygments/formatters/_mapping.py +1 -3
  39. data/vendor/pygments-main/pygments/formatters/bbcode.py +1 -1
  40. data/vendor/pygments-main/pygments/formatters/html.py +223 -135
  41. data/vendor/pygments-main/pygments/formatters/img.py +68 -41
  42. data/vendor/pygments-main/pygments/formatters/irc.py +39 -39
  43. data/vendor/pygments-main/pygments/formatters/latex.py +56 -26
  44. data/vendor/pygments-main/pygments/formatters/other.py +12 -8
  45. data/vendor/pygments-main/pygments/formatters/rtf.py +29 -29
  46. data/vendor/pygments-main/pygments/formatters/svg.py +38 -4
  47. data/vendor/pygments-main/pygments/formatters/terminal.py +25 -31
  48. data/vendor/pygments-main/pygments/formatters/terminal256.py +22 -12
  49. data/vendor/pygments-main/pygments/lexer.py +41 -39
  50. data/vendor/pygments-main/pygments/lexers/__init__.py +342 -0
  51. data/vendor/pygments-main/pygments/lexers/_asy_builtins.py +1645 -0
  52. data/vendor/pygments-main/pygments/lexers/_cl_builtins.py +232 -0
  53. data/vendor/pygments-main/pygments/lexers/_cocoa_builtins.py +71 -0
  54. data/vendor/pygments-main/pygments/lexers/_csound_builtins.py +1725 -0
  55. data/vendor/pygments-main/pygments/lexers/_lasso_builtins.py +5327 -0
  56. data/vendor/pygments-main/pygments/lexers/_lua_builtins.py +293 -0
  57. data/vendor/pygments-main/pygments/lexers/_mapping.py +551 -0
  58. data/vendor/pygments-main/pygments/lexers/_mql_builtins.py +1172 -0
  59. data/vendor/pygments-main/pygments/lexers/_mysql_builtins.py +1282 -0
  60. data/vendor/pygments-main/pygments/lexers/_openedge_builtins.py +2547 -0
  61. data/vendor/pygments-main/pygments/lexers/_php_builtins.py +4753 -0
  62. data/vendor/pygments-main/pygments/lexers/_postgres_builtins.py +678 -0
  63. data/vendor/pygments-main/pygments/lexers/_scilab_builtins.py +3094 -0
  64. data/vendor/pygments-main/pygments/lexers/_sourcemod_builtins.py +1161 -0
  65. data/vendor/pygments-main/pygments/lexers/_stan_builtins.py +558 -0
  66. data/vendor/pygments-main/pygments/lexers/_stata_builtins.py +421 -0
  67. data/vendor/pygments-main/pygments/lexers/_tsql_builtins.py +1004 -0
  68. data/vendor/pygments-main/pygments/lexers/_usd_builtins.py +113 -0
  69. data/vendor/pygments-main/pygments/lexers/_vbscript_builtins.py +280 -0
  70. data/vendor/pygments-main/pygments/lexers/_vim_builtins.py +1939 -0
  71. data/vendor/pygments-main/pygments/lexers/actionscript.py +245 -0
  72. data/vendor/pygments-main/pygments/lexers/agile.py +24 -0
  73. data/vendor/pygments-main/pygments/lexers/algebra.py +240 -0
  74. data/vendor/pygments-main/pygments/lexers/ambient.py +76 -0
  75. data/vendor/pygments-main/pygments/lexers/ampl.py +87 -0
  76. data/vendor/pygments-main/pygments/lexers/apl.py +101 -0
  77. data/vendor/pygments-main/pygments/lexers/archetype.py +318 -0
  78. data/vendor/pygments-main/pygments/lexers/arrow.py +117 -0
  79. data/vendor/pygments-main/pygments/lexers/asm.py +1005 -0
  80. data/vendor/pygments-main/pygments/lexers/automation.py +374 -0
  81. data/vendor/pygments-main/pygments/lexers/bare.py +104 -0
  82. data/vendor/pygments-main/pygments/lexers/basic.py +662 -0
  83. data/vendor/pygments-main/pygments/lexers/bibtex.py +160 -0
  84. data/vendor/pygments-main/pygments/lexers/boa.py +102 -0
  85. data/vendor/pygments-main/pygments/lexers/business.py +627 -0
  86. data/vendor/pygments-main/pygments/lexers/c_cpp.py +344 -0
  87. data/vendor/pygments-main/pygments/lexers/c_like.py +566 -0
  88. data/vendor/pygments-main/pygments/lexers/capnproto.py +78 -0
  89. data/vendor/pygments-main/pygments/lexers/chapel.py +112 -0
  90. data/vendor/pygments-main/pygments/lexers/clean.py +179 -0
  91. data/vendor/pygments-main/pygments/lexers/compiled.py +34 -0
  92. data/vendor/pygments-main/pygments/lexers/configs.py +984 -0
  93. data/vendor/pygments-main/pygments/lexers/console.py +114 -0
  94. data/vendor/pygments-main/pygments/lexers/crystal.py +392 -0
  95. data/vendor/pygments-main/pygments/lexers/csound.py +467 -0
  96. data/vendor/pygments-main/pygments/lexers/css.py +691 -0
  97. data/vendor/pygments-main/pygments/lexers/d.py +256 -0
  98. data/vendor/pygments-main/pygments/lexers/dalvik.py +125 -0
  99. data/vendor/pygments-main/pygments/lexers/data.py +698 -0
  100. data/vendor/pygments-main/pygments/lexers/devicetree.py +109 -0
  101. data/vendor/pygments-main/pygments/lexers/diff.py +165 -0
  102. data/vendor/pygments-main/pygments/lexers/dotnet.py +707 -0
  103. data/vendor/pygments-main/pygments/lexers/dsls.py +960 -0
  104. data/vendor/pygments-main/pygments/lexers/dylan.py +287 -0
  105. data/vendor/pygments-main/pygments/lexers/ecl.py +139 -0
  106. data/vendor/pygments-main/pygments/lexers/eiffel.py +65 -0
  107. data/vendor/pygments-main/pygments/lexers/elm.py +121 -0
  108. data/vendor/pygments-main/pygments/lexers/email.py +151 -0
  109. data/vendor/pygments-main/pygments/lexers/erlang.py +530 -0
  110. data/vendor/pygments-main/pygments/lexers/esoteric.py +304 -0
  111. data/vendor/pygments-main/pygments/lexers/ezhil.py +77 -0
  112. data/vendor/pygments-main/pygments/lexers/factor.py +344 -0
  113. data/vendor/pygments-main/pygments/lexers/fantom.py +250 -0
  114. data/vendor/pygments-main/pygments/lexers/felix.py +273 -0
  115. data/vendor/pygments-main/pygments/lexers/floscript.py +83 -0
  116. data/vendor/pygments-main/pygments/lexers/forth.py +178 -0
  117. data/vendor/pygments-main/pygments/lexers/fortran.py +206 -0
  118. data/vendor/pygments-main/pygments/lexers/foxpro.py +428 -0
  119. data/vendor/pygments-main/pygments/lexers/freefem.py +898 -0
  120. data/vendor/pygments-main/pygments/lexers/functional.py +21 -0
  121. data/vendor/pygments-main/pygments/lexers/gdscript.py +346 -0
  122. data/vendor/pygments-main/pygments/lexers/go.py +101 -0
  123. data/vendor/pygments-main/pygments/lexers/grammar_notation.py +270 -0
  124. data/vendor/pygments-main/pygments/lexers/graph.py +85 -0
  125. data/vendor/pygments-main/pygments/lexers/graphics.py +800 -0
  126. data/vendor/pygments-main/pygments/lexers/haskell.py +870 -0
  127. data/vendor/pygments-main/pygments/lexers/haxe.py +936 -0
  128. data/vendor/pygments-main/pygments/lexers/hdl.py +472 -0
  129. data/vendor/pygments-main/pygments/lexers/hexdump.py +103 -0
  130. data/vendor/pygments-main/pygments/lexers/html.py +614 -0
  131. data/vendor/pygments-main/pygments/lexers/idl.py +281 -0
  132. data/vendor/pygments-main/pygments/lexers/igor.py +420 -0
  133. data/vendor/pygments-main/pygments/lexers/inferno.py +96 -0
  134. data/vendor/pygments-main/pygments/lexers/installers.py +322 -0
  135. data/vendor/pygments-main/pygments/lexers/int_fiction.py +1368 -0
  136. data/vendor/pygments-main/pygments/lexers/iolang.py +63 -0
  137. data/vendor/pygments-main/pygments/lexers/j.py +146 -0
  138. data/vendor/pygments-main/pygments/lexers/javascript.py +1540 -0
  139. data/vendor/pygments-main/pygments/lexers/julia.py +331 -0
  140. data/vendor/pygments-main/pygments/lexers/jvm.py +1673 -0
  141. data/vendor/pygments-main/pygments/lexers/lisp.py +2699 -0
  142. data/vendor/pygments-main/pygments/lexers/make.py +206 -0
  143. data/vendor/pygments-main/pygments/lexers/markup.py +765 -0
  144. data/vendor/pygments-main/pygments/lexers/math.py +21 -0
  145. data/vendor/pygments-main/pygments/lexers/matlab.py +720 -0
  146. data/vendor/pygments-main/pygments/lexers/mime.py +226 -0
  147. data/vendor/pygments-main/pygments/lexers/ml.py +958 -0
  148. data/vendor/pygments-main/pygments/lexers/modeling.py +366 -0
  149. data/vendor/pygments-main/pygments/lexers/modula2.py +1580 -0
  150. data/vendor/pygments-main/pygments/lexers/monte.py +204 -0
  151. data/vendor/pygments-main/pygments/lexers/mosel.py +448 -0
  152. data/vendor/pygments-main/pygments/lexers/ncl.py +894 -0
  153. data/vendor/pygments-main/pygments/lexers/nimrod.py +159 -0
  154. data/vendor/pygments-main/pygments/lexers/nit.py +64 -0
  155. data/vendor/pygments-main/pygments/lexers/nix.py +136 -0
  156. data/vendor/pygments-main/pygments/lexers/oberon.py +121 -0
  157. data/vendor/pygments-main/pygments/lexers/objective.py +504 -0
  158. data/vendor/pygments-main/pygments/lexers/ooc.py +85 -0
  159. data/vendor/pygments-main/pygments/lexers/other.py +41 -0
  160. data/vendor/pygments-main/pygments/lexers/parasail.py +79 -0
  161. data/vendor/pygments-main/pygments/lexers/parsers.py +800 -0
  162. data/vendor/pygments-main/pygments/lexers/pascal.py +644 -0
  163. data/vendor/pygments-main/pygments/lexers/pawn.py +205 -0
  164. data/vendor/pygments-main/pygments/lexers/perl.py +732 -0
  165. data/vendor/pygments-main/pygments/lexers/php.py +321 -0
  166. data/vendor/pygments-main/pygments/lexers/pointless.py +71 -0
  167. data/vendor/pygments-main/pygments/lexers/pony.py +94 -0
  168. data/vendor/pygments-main/pygments/lexers/praat.py +302 -0
  169. data/vendor/pygments-main/pygments/lexers/prolog.py +306 -0
  170. data/vendor/pygments-main/pygments/lexers/promql.py +183 -0
  171. data/vendor/pygments-main/pygments/lexers/python.py +1151 -0
  172. data/vendor/pygments-main/pygments/lexers/qvt.py +152 -0
  173. data/vendor/pygments-main/pygments/lexers/r.py +191 -0
  174. data/vendor/pygments-main/pygments/lexers/rdf.py +463 -0
  175. data/vendor/pygments-main/pygments/lexers/rebol.py +431 -0
  176. data/vendor/pygments-main/pygments/lexers/resource.py +85 -0
  177. data/vendor/pygments-main/pygments/lexers/ride.py +139 -0
  178. data/vendor/pygments-main/pygments/lexers/rnc.py +67 -0
  179. data/vendor/pygments-main/pygments/lexers/roboconf.py +82 -0
  180. data/vendor/pygments-main/pygments/lexers/robotframework.py +552 -0
  181. data/vendor/pygments-main/pygments/lexers/ruby.py +517 -0
  182. data/vendor/pygments-main/pygments/lexers/rust.py +224 -0
  183. data/vendor/pygments-main/pygments/lexers/sas.py +228 -0
  184. data/vendor/pygments-main/pygments/lexers/scdoc.py +83 -0
  185. data/vendor/pygments-main/pygments/lexers/scripting.py +1284 -0
  186. data/vendor/pygments-main/pygments/lexers/sgf.py +61 -0
  187. data/vendor/pygments-main/pygments/lexers/shell.py +914 -0
  188. data/vendor/pygments-main/pygments/lexers/sieve.py +69 -0
  189. data/vendor/pygments-main/pygments/lexers/slash.py +185 -0
  190. data/vendor/pygments-main/pygments/lexers/smalltalk.py +195 -0
  191. data/vendor/pygments-main/pygments/lexers/smv.py +79 -0
  192. data/vendor/pygments-main/pygments/lexers/snobol.py +83 -0
  193. data/vendor/pygments-main/pygments/lexers/solidity.py +92 -0
  194. data/vendor/pygments-main/pygments/lexers/special.py +105 -0
  195. data/vendor/pygments-main/pygments/lexers/sql.py +837 -0
  196. data/vendor/pygments-main/pygments/lexers/stata.py +171 -0
  197. data/vendor/pygments-main/pygments/lexers/supercollider.py +95 -0
  198. data/vendor/pygments-main/pygments/lexers/tcl.py +145 -0
  199. data/vendor/pygments-main/pygments/lexers/templates.py +2264 -0
  200. data/vendor/pygments-main/pygments/lexers/teraterm.py +335 -0
  201. data/vendor/pygments-main/pygments/lexers/testing.py +207 -0
  202. data/vendor/pygments-main/pygments/lexers/text.py +26 -0
  203. data/vendor/pygments-main/pygments/lexers/textedit.py +169 -0
  204. data/vendor/pygments-main/pygments/lexers/textfmts.py +430 -0
  205. data/vendor/pygments-main/pygments/lexers/theorem.py +474 -0
  206. data/vendor/pygments-main/pygments/lexers/tnt.py +263 -0
  207. data/vendor/pygments-main/pygments/lexers/trafficscript.py +54 -0
  208. data/vendor/pygments-main/pygments/lexers/typoscript.py +219 -0
  209. data/vendor/pygments-main/pygments/lexers/unicon.py +412 -0
  210. data/vendor/pygments-main/pygments/lexers/urbi.py +146 -0
  211. data/vendor/pygments-main/pygments/lexers/usd.py +90 -0
  212. data/vendor/pygments-main/pygments/lexers/varnish.py +190 -0
  213. data/vendor/pygments-main/pygments/lexers/verification.py +114 -0
  214. data/vendor/pygments-main/pygments/lexers/web.py +24 -0
  215. data/vendor/pygments-main/pygments/lexers/webidl.py +299 -0
  216. data/vendor/pygments-main/pygments/lexers/webmisc.py +991 -0
  217. data/vendor/pygments-main/pygments/lexers/whiley.py +116 -0
  218. data/vendor/pygments-main/pygments/lexers/x10.py +69 -0
  219. data/vendor/pygments-main/pygments/lexers/xorg.py +37 -0
  220. data/vendor/pygments-main/pygments/lexers/yang.py +104 -0
  221. data/vendor/pygments-main/pygments/lexers/zig.py +124 -0
  222. data/vendor/pygments-main/pygments/modeline.py +1 -1
  223. data/vendor/pygments-main/pygments/plugin.py +4 -2
  224. data/vendor/pygments-main/pygments/regexopt.py +1 -1
  225. data/vendor/pygments-main/pygments/scanner.py +2 -2
  226. data/vendor/pygments-main/pygments/sphinxext.py +2 -4
  227. data/vendor/pygments-main/pygments/style.py +61 -24
  228. data/vendor/pygments-main/pygments/styles/__init__.py +10 -4
  229. data/vendor/pygments-main/pygments/styles/abap.py +1 -1
  230. data/vendor/pygments-main/pygments/styles/algol.py +1 -1
  231. data/vendor/pygments-main/pygments/styles/algol_nu.py +1 -1
  232. data/vendor/pygments-main/pygments/styles/arduino.py +2 -2
  233. data/vendor/pygments-main/pygments/styles/autumn.py +1 -1
  234. data/vendor/pygments-main/pygments/styles/borland.py +1 -1
  235. data/vendor/pygments-main/pygments/styles/bw.py +1 -1
  236. data/vendor/pygments-main/pygments/styles/colorful.py +1 -1
  237. data/vendor/pygments-main/pygments/styles/default.py +1 -1
  238. data/vendor/pygments-main/pygments/styles/emacs.py +1 -1
  239. data/vendor/pygments-main/pygments/styles/friendly.py +1 -1
  240. data/vendor/pygments-main/pygments/styles/fruity.py +1 -1
  241. data/vendor/pygments-main/pygments/styles/igor.py +1 -1
  242. data/vendor/pygments-main/pygments/styles/inkpot.py +67 -0
  243. data/vendor/pygments-main/pygments/styles/lovelace.py +1 -1
  244. data/vendor/pygments-main/pygments/styles/manni.py +1 -1
  245. data/vendor/pygments-main/pygments/styles/monokai.py +4 -3
  246. data/vendor/pygments-main/pygments/styles/murphy.py +1 -1
  247. data/vendor/pygments-main/pygments/styles/native.py +1 -1
  248. data/vendor/pygments-main/pygments/styles/paraiso_dark.py +1 -1
  249. data/vendor/pygments-main/pygments/styles/paraiso_light.py +1 -1
  250. data/vendor/pygments-main/pygments/styles/pastie.py +1 -1
  251. data/vendor/pygments-main/pygments/styles/perldoc.py +1 -1
  252. data/vendor/pygments-main/pygments/styles/rainbow_dash.py +1 -1
  253. data/vendor/pygments-main/pygments/styles/rrt.py +1 -1
  254. data/vendor/pygments-main/pygments/styles/sas.py +1 -1
  255. data/vendor/pygments-main/pygments/styles/solarized.py +134 -0
  256. data/vendor/pygments-main/pygments/styles/stata_dark.py +41 -0
  257. data/vendor/pygments-main/pygments/styles/{stata.py → stata_light.py} +14 -15
  258. data/vendor/pygments-main/pygments/styles/tango.py +1 -1
  259. data/vendor/pygments-main/pygments/styles/trac.py +1 -1
  260. data/vendor/pygments-main/pygments/styles/vim.py +1 -1
  261. data/vendor/pygments-main/pygments/styles/vs.py +1 -1
  262. data/vendor/pygments-main/pygments/styles/xcode.py +1 -1
  263. data/vendor/pygments-main/pygments/token.py +1 -1
  264. data/vendor/pygments-main/pygments/unistring.py +47 -108
  265. data/vendor/pygments-main/pygments/util.py +15 -92
  266. metadata +69 -136
  267. data/CHANGELOG.md +0 -111
  268. data/README.md +0 -121
  269. data/circle.yml +0 -20
  270. data/test/test_data.py +0 -514
  271. data/test/test_data_generated +0 -2582
  272. data/vendor/custom_lexers/github.py +0 -565
  273. data/vendor/pygments-main/CHANGES +0 -1186
  274. data/vendor/pygments-main/MANIFEST.in +0 -6
  275. data/vendor/pygments-main/Makefile +0 -65
  276. data/vendor/pygments-main/README.rst +0 -39
  277. data/vendor/pygments-main/REVISION +0 -1
  278. data/vendor/pygments-main/TODO +0 -12
  279. data/vendor/pygments-main/doc/Makefile +0 -153
  280. data/vendor/pygments-main/doc/_static/favicon.ico +0 -0
  281. data/vendor/pygments-main/doc/_static/logo_new.png +0 -0
  282. data/vendor/pygments-main/doc/_static/logo_only.png +0 -0
  283. data/vendor/pygments-main/doc/_templates/docssidebar.html +0 -3
  284. data/vendor/pygments-main/doc/_templates/indexsidebar.html +0 -25
  285. data/vendor/pygments-main/doc/_themes/pygments14/layout.html +0 -98
  286. data/vendor/pygments-main/doc/_themes/pygments14/static/bodybg.png +0 -0
  287. data/vendor/pygments-main/doc/_themes/pygments14/static/docbg.png +0 -0
  288. data/vendor/pygments-main/doc/_themes/pygments14/static/listitem.png +0 -0
  289. data/vendor/pygments-main/doc/_themes/pygments14/static/logo.png +0 -0
  290. data/vendor/pygments-main/doc/_themes/pygments14/static/pocoo.png +0 -0
  291. data/vendor/pygments-main/doc/_themes/pygments14/static/pygments14.css_t +0 -401
  292. data/vendor/pygments-main/doc/_themes/pygments14/theme.conf +0 -15
  293. data/vendor/pygments-main/doc/conf.py +0 -241
  294. data/vendor/pygments-main/doc/docs/api.rst +0 -354
  295. data/vendor/pygments-main/doc/docs/authors.rst +0 -4
  296. data/vendor/pygments-main/doc/docs/changelog.rst +0 -1
  297. data/vendor/pygments-main/doc/docs/cmdline.rst +0 -166
  298. data/vendor/pygments-main/doc/docs/filterdevelopment.rst +0 -71
  299. data/vendor/pygments-main/doc/docs/filters.rst +0 -41
  300. data/vendor/pygments-main/doc/docs/formatterdevelopment.rst +0 -169
  301. data/vendor/pygments-main/doc/docs/formatters.rst +0 -48
  302. data/vendor/pygments-main/doc/docs/index.rst +0 -66
  303. data/vendor/pygments-main/doc/docs/integrate.rst +0 -40
  304. data/vendor/pygments-main/doc/docs/java.rst +0 -70
  305. data/vendor/pygments-main/doc/docs/lexerdevelopment.rst +0 -728
  306. data/vendor/pygments-main/doc/docs/lexers.rst +0 -69
  307. data/vendor/pygments-main/doc/docs/moinmoin.rst +0 -39
  308. data/vendor/pygments-main/doc/docs/plugins.rst +0 -93
  309. data/vendor/pygments-main/doc/docs/quickstart.rst +0 -205
  310. data/vendor/pygments-main/doc/docs/rstdirective.rst +0 -22
  311. data/vendor/pygments-main/doc/docs/styles.rst +0 -201
  312. data/vendor/pygments-main/doc/docs/tokens.rst +0 -372
  313. data/vendor/pygments-main/doc/docs/unicode.rst +0 -58
  314. data/vendor/pygments-main/doc/download.rst +0 -41
  315. data/vendor/pygments-main/doc/faq.rst +0 -139
  316. data/vendor/pygments-main/doc/index.rst +0 -54
  317. data/vendor/pygments-main/doc/languages.rst +0 -154
  318. data/vendor/pygments-main/doc/make.bat +0 -190
  319. data/vendor/pygments-main/doc/pygmentize.1 +0 -94
  320. data/vendor/pygments-main/external/autopygmentize +0 -101
  321. data/vendor/pygments-main/external/lasso-builtins-generator-9.lasso +0 -162
  322. data/vendor/pygments-main/external/markdown-processor.py +0 -67
  323. data/vendor/pygments-main/external/moin-parser.py +0 -112
  324. data/vendor/pygments-main/external/pygments.bashcomp +0 -38
  325. data/vendor/pygments-main/external/rst-directive.py +0 -82
  326. data/vendor/pygments-main/pygmentize +0 -8
  327. data/vendor/pygments-main/requirements.txt +0 -5
  328. data/vendor/pygments-main/scripts/check_sources.py +0 -211
  329. data/vendor/pygments-main/scripts/debug_lexer.py +0 -246
  330. data/vendor/pygments-main/scripts/detect_missing_analyse_text.py +0 -33
  331. data/vendor/pygments-main/scripts/epydoc.css +0 -280
  332. data/vendor/pygments-main/scripts/get_vimkw.py +0 -74
  333. data/vendor/pygments-main/scripts/pylintrc +0 -301
  334. data/vendor/pygments-main/scripts/vim2pygments.py +0 -935
  335. data/vendor/pygments-main/setup.cfg +0 -10
  336. data/vendor/pygments-main/setup.py +0 -77
  337. data/vendor/pygments-main/tox.ini +0 -7
  338. data/vendor/simplejson/.gitignore +0 -10
  339. data/vendor/simplejson/.travis.yml +0 -5
  340. data/vendor/simplejson/CHANGES.txt +0 -291
  341. data/vendor/simplejson/LICENSE.txt +0 -19
  342. data/vendor/simplejson/MANIFEST.in +0 -5
  343. data/vendor/simplejson/README.rst +0 -19
  344. data/vendor/simplejson/conf.py +0 -179
  345. data/vendor/simplejson/index.rst +0 -628
  346. data/vendor/simplejson/scripts/make_docs.py +0 -18
  347. data/vendor/simplejson/setup.py +0 -104
  348. data/vendor/simplejson/simplejson/__init__.py +0 -510
  349. data/vendor/simplejson/simplejson/_speedups.c +0 -2745
  350. data/vendor/simplejson/simplejson/decoder.py +0 -425
  351. data/vendor/simplejson/simplejson/encoder.py +0 -567
  352. data/vendor/simplejson/simplejson/ordered_dict.py +0 -119
  353. data/vendor/simplejson/simplejson/scanner.py +0 -77
  354. data/vendor/simplejson/simplejson/tests/__init__.py +0 -67
  355. data/vendor/simplejson/simplejson/tests/test_bigint_as_string.py +0 -55
  356. data/vendor/simplejson/simplejson/tests/test_check_circular.py +0 -30
  357. data/vendor/simplejson/simplejson/tests/test_decimal.py +0 -66
  358. data/vendor/simplejson/simplejson/tests/test_decode.py +0 -83
  359. data/vendor/simplejson/simplejson/tests/test_default.py +0 -9
  360. data/vendor/simplejson/simplejson/tests/test_dump.py +0 -67
  361. data/vendor/simplejson/simplejson/tests/test_encode_basestring_ascii.py +0 -46
  362. data/vendor/simplejson/simplejson/tests/test_encode_for_html.py +0 -32
  363. data/vendor/simplejson/simplejson/tests/test_errors.py +0 -34
  364. data/vendor/simplejson/simplejson/tests/test_fail.py +0 -91
  365. data/vendor/simplejson/simplejson/tests/test_float.py +0 -19
  366. data/vendor/simplejson/simplejson/tests/test_indent.py +0 -86
  367. data/vendor/simplejson/simplejson/tests/test_item_sort_key.py +0 -20
  368. data/vendor/simplejson/simplejson/tests/test_namedtuple.py +0 -121
  369. data/vendor/simplejson/simplejson/tests/test_pass1.py +0 -76
  370. data/vendor/simplejson/simplejson/tests/test_pass2.py +0 -14
  371. data/vendor/simplejson/simplejson/tests/test_pass3.py +0 -20
  372. data/vendor/simplejson/simplejson/tests/test_recursion.py +0 -67
  373. data/vendor/simplejson/simplejson/tests/test_scanstring.py +0 -117
  374. data/vendor/simplejson/simplejson/tests/test_separators.py +0 -42
  375. data/vendor/simplejson/simplejson/tests/test_speedups.py +0 -20
  376. data/vendor/simplejson/simplejson/tests/test_tuple.py +0 -49
  377. data/vendor/simplejson/simplejson/tests/test_unicode.py +0 -109
  378. data/vendor/simplejson/simplejson/tool.py +0 -39
@@ -1,179 +0,0 @@
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
@@ -1,628 +0,0 @@
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``)