pygments.rb 0.2.13 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. data/.gitignore +1 -0
  2. data/README.md +45 -19
  3. data/Rakefile +21 -11
  4. data/bench.rb +15 -48
  5. data/cache-lexers.rb +8 -0
  6. data/lexers +0 -0
  7. data/lib/pygments.rb +3 -6
  8. data/lib/pygments/mentos.py +343 -0
  9. data/lib/pygments/popen.rb +383 -0
  10. data/lib/pygments/version.rb +1 -1
  11. data/pygments.rb.gemspec +5 -4
  12. data/test/test_data.c +2581 -0
  13. data/test/test_data.py +514 -0
  14. data/test/test_data_generated +2582 -0
  15. data/test/test_pygments.rb +208 -84
  16. data/vendor/pygments-main/pygments/lexers/_mapping.py +1 -1
  17. data/vendor/pygments-main/pygments/lexers/shell.py +1 -1
  18. data/vendor/simplejson/.gitignore +10 -0
  19. data/vendor/simplejson/.travis.yml +5 -0
  20. data/vendor/simplejson/CHANGES.txt +291 -0
  21. data/vendor/simplejson/LICENSE.txt +19 -0
  22. data/vendor/simplejson/MANIFEST.in +5 -0
  23. data/vendor/simplejson/README.rst +19 -0
  24. data/vendor/simplejson/conf.py +179 -0
  25. data/vendor/simplejson/index.rst +628 -0
  26. data/vendor/simplejson/scripts/make_docs.py +18 -0
  27. data/vendor/simplejson/setup.py +104 -0
  28. data/vendor/simplejson/simplejson/__init__.py +510 -0
  29. data/vendor/simplejson/simplejson/_speedups.c +2745 -0
  30. data/vendor/simplejson/simplejson/decoder.py +425 -0
  31. data/vendor/simplejson/simplejson/encoder.py +567 -0
  32. data/vendor/simplejson/simplejson/ordered_dict.py +119 -0
  33. data/vendor/simplejson/simplejson/scanner.py +77 -0
  34. data/vendor/simplejson/simplejson/tests/__init__.py +67 -0
  35. data/vendor/simplejson/simplejson/tests/test_bigint_as_string.py +55 -0
  36. data/vendor/simplejson/simplejson/tests/test_check_circular.py +30 -0
  37. data/vendor/simplejson/simplejson/tests/test_decimal.py +66 -0
  38. data/vendor/simplejson/simplejson/tests/test_decode.py +83 -0
  39. data/vendor/simplejson/simplejson/tests/test_default.py +9 -0
  40. data/vendor/simplejson/simplejson/tests/test_dump.py +67 -0
  41. data/vendor/simplejson/simplejson/tests/test_encode_basestring_ascii.py +46 -0
  42. data/vendor/simplejson/simplejson/tests/test_encode_for_html.py +32 -0
  43. data/vendor/simplejson/simplejson/tests/test_errors.py +34 -0
  44. data/vendor/simplejson/simplejson/tests/test_fail.py +91 -0
  45. data/vendor/simplejson/simplejson/tests/test_float.py +19 -0
  46. data/vendor/simplejson/simplejson/tests/test_indent.py +86 -0
  47. data/vendor/simplejson/simplejson/tests/test_item_sort_key.py +20 -0
  48. data/vendor/simplejson/simplejson/tests/test_namedtuple.py +121 -0
  49. data/vendor/simplejson/simplejson/tests/test_pass1.py +76 -0
  50. data/vendor/simplejson/simplejson/tests/test_pass2.py +14 -0
  51. data/vendor/simplejson/simplejson/tests/test_pass3.py +20 -0
  52. data/vendor/simplejson/simplejson/tests/test_recursion.py +67 -0
  53. data/vendor/simplejson/simplejson/tests/test_scanstring.py +117 -0
  54. data/vendor/simplejson/simplejson/tests/test_separators.py +42 -0
  55. data/vendor/simplejson/simplejson/tests/test_speedups.py +20 -0
  56. data/vendor/simplejson/simplejson/tests/test_tuple.py +49 -0
  57. data/vendor/simplejson/simplejson/tests/test_unicode.py +109 -0
  58. data/vendor/simplejson/simplejson/tool.py +39 -0
  59. metadata +80 -22
  60. data/ext/extconf.rb +0 -14
  61. data/ext/pygments.c +0 -466
  62. data/lib/pygments/c.rb +0 -54
  63. data/lib/pygments/ffi.rb +0 -155
  64. data/vendor/.gitignore +0 -1
@@ -1,148 +1,272 @@
1
- # coding: utf-8
1
+ #coding: utf-8
2
2
 
3
3
  require 'test/unit'
4
- require 'pygments'
4
+ require File.join(File.dirname(__FILE__), '..', '/lib/pygments.rb')
5
+ ENV['mentos-test'] = "yes"
5
6
 
6
- class PygmentsLexerTest < Test::Unit::TestCase
7
- include Pygments
7
+ P = Pygments
8
8
 
9
+ class PygmentsHighlightTest < Test::Unit::TestCase
9
10
  RUBY_CODE = "#!/usr/bin/ruby\nputs 'foo'"
11
+ RUBY_CODE_TRAILING_NEWLINE = "#!/usr/bin/ruby\nputs 'foo'\n"
12
+ REDIS_CODE = File.read(File.join(File.dirname(__FILE__), '..', '/test/test_data.c'))
13
+
14
+ def test_highlight_defaults_to_html
15
+ code = P.highlight(RUBY_CODE)
16
+ assert_match '<span class="c1">#!/usr/bin/ruby</span>', code
17
+ assert_equal '<div class', code[0..9]
18
+ end
19
+
20
+ def test_highlight_works_with_larger_files
21
+ code = P.highlight(REDIS_CODE)
22
+ assert_match 'used_memory_peak_human', code
23
+ assert_equal 454107, code.bytesize.to_i
24
+ end
25
+
26
+ def test_returns_nil_on_timeout
27
+ large_code = REDIS_CODE * 300
28
+ code = P.highlight(large_code) # a 30 mb highlight request will timeout
29
+ assert_equal nil, code
30
+ end
31
+
32
+ def test_highlight_works_with_null_bytes
33
+ code = P.highlight("\0hello", :lexer => 'rb')
34
+ assert_match "hello", code
35
+ end
36
+
37
+ def test_highlight_works_on_utf8
38
+ code = P.highlight('# ø', :lexer => 'rb', :options => {:encoding => 'utf-8'})
39
+ assert_match "# ø", code
40
+ end
41
+
42
+ def test_highlight_works_on_utf8_automatically
43
+ code = P.highlight('# ø', :lexer => 'rb')
44
+ assert_match "# ø", code
45
+ end
46
+
47
+ def test_highlight_works_on_utf8_all_chars_automatically
48
+ code = P.highlight('def foo: # ø', :lexer => 'py')
49
+
50
+ assert_equal '<div class="highlight"><pre><span clas', code[0,38]
51
+ end
52
+
53
+ def test_highlight_works_with_multiple_utf8
54
+ code = P.highlight('# ø ø ø', :lexer => 'rb', :options => {:encoding => 'utf-8'})
55
+ assert_match "# ø ø ø", code
56
+ end
57
+
58
+ def test_highlight_works_with_multiple_utf8_and_trailing_newline
59
+ code = P.highlight("#!/usr/bin/ruby\nputs 'ø..ø'\n", :lexer => 'rb')
60
+ assert_match "ø..ø", code
61
+ end
62
+
63
+ def test_highlight_formatter_bbcode
64
+ code = P.highlight(RUBY_CODE, :formatter => 'bbcode')
65
+ assert_match 'color=#408080][i]#!/usr/bin/ruby[/i]', code
66
+ end
67
+
68
+ def test_highlight_formatter_terminal
69
+ code = P.highlight(RUBY_CODE, :formatter => 'terminal')
70
+ assert_match '39;49;00m', code
71
+ end
72
+
73
+ def test_highlight_options
74
+ code = P.highlight(RUBY_CODE, :options => {:full => true, :title => 'test'})
75
+ assert_match '<title>test</title>', code
76
+ end
77
+
78
+ def test_highlight_works_with_single_character_input
79
+ code = P.highlight("a")
80
+ assert_match 'a</span>', code
81
+ end
82
+
83
+ def test_highlight_works_with_trailing_newline
84
+ code = P.highlight(RUBY_CODE_TRAILING_NEWLINE)
85
+ assert_match '<span class="c1">#!/usr/bin/ruby</span>', code
86
+ end
87
+
88
+ def test_highlight_works_with_multiple_newlines
89
+ code = P.highlight(RUBY_CODE_TRAILING_NEWLINE + "derp\n\n")
90
+ assert_match '<span class="c1">#!/usr/bin/ruby</span>', code
91
+ end
92
+
93
+ def test_highlight_works_with_trailing_cr
94
+ code = P.highlight(RUBY_CODE_TRAILING_NEWLINE + "\r")
95
+ assert_match '<span class="c1">#!/usr/bin/ruby</span>', code
96
+ end
97
+
98
+ def test_highlight_still_works_with_invalid_code
99
+ code = P.highlight("importr python; wat?", :lexer => 'py')
100
+ assert_match ">importr</span>", code
101
+ end
102
+ end
103
+
104
+ # Philosophically, I'm not the biggest fan of testing private
105
+ # methods, but given the relative delicacy of validity checking
106
+ # over the pipe I think it's necessary and informative.
107
+ class PygmentsValidityTest < Test::Unit::TestCase
108
+ def test_add_ids_with_padding
109
+ res = P.send(:add_ids, "herp derp baz boo foo", "ABCDEFGH")
110
+ assert_equal "ABCDEFGH herp derp baz boo foo ABCDEFGH", res
111
+ end
112
+
113
+ def test_add_ids_on_empty_string
114
+ res = P.send(:add_ids, "", "ABCDEFGH")
115
+ assert_equal "ABCDEFGH ABCDEFGH", res
116
+ end
117
+
118
+ def test_add_ids_with_unicode_data
119
+ res = P.send(:add_ids, "# ø ø ø", "ABCDEFGH")
120
+ assert_equal "ABCDEFGH # ø ø ø ABCDEFGH", res
121
+ end
122
+
123
+ def test_add_ids_with_starting_slashes
124
+ res = P.send(:add_ids, '\\# ø ø ø..//', "ABCDEFGH")
125
+ assert_equal "ABCDEFGH \\# ø ø ø..// ABCDEFGH", res
126
+ end
127
+
128
+ def test_get_fixed_bits_from_header
129
+ bits = P.send(:get_fixed_bits_from_header, '{"herp": "derp"}')
130
+ assert_equal "00000000000000000000000000010000", bits
131
+ end
132
+
133
+ def test_get_fixed_bits_from_header_works_with_large_headers
134
+ bits = P.send(:get_fixed_bits_from_header, '{"herp": "derp"}' * 10000)
135
+ assert_equal "00000000000000100111000100000000", bits
136
+ end
137
+
138
+ def test_size_check
139
+ size = "00000000000000000000000000100110"
140
+ res = P.send(:size_check, size)
141
+ assert_equal res, true
142
+ end
10
143
 
11
- def test_lexer_by_content
12
- assert_equal 'rb', lexer_name_for(RUBY_CODE)
144
+ def test_size_check_bad
145
+ size = "some random thing"
146
+ res = P.send(:size_check, size)
147
+ assert_equal res, false
13
148
  end
149
+ end
150
+
151
+ class PygmentsLexerTest < Test::Unit::TestCase
152
+ RUBY_CODE = "#!/usr/bin/ruby\nputs 'foo'"
153
+
14
154
  def test_lexer_by_mimetype
15
- assert_equal 'rb', lexer_name_for(:mimetype => 'text/x-ruby')
155
+ assert_equal 'rb', P.lexer_name_for(:mimetype => 'text/x-ruby')
156
+ assert_equal 'json', P.lexer_name_for(:mimetype => 'application/json')
16
157
  end
158
+
17
159
  def test_lexer_by_filename
18
- assert_equal 'rb', lexer_name_for(:filename => 'test.rb')
160
+ assert_equal 'rb', P.lexer_name_for(:filename => 'test.rb')
161
+ assert_equal 'scala', P.lexer_name_for(:filename => 'test.scala')
19
162
  end
163
+
20
164
  def test_lexer_by_name
21
- assert_equal 'rb', lexer_name_for(:lexer => 'ruby')
165
+ assert_equal 'rb', P.lexer_name_for(:lexer => 'ruby')
166
+ assert_equal 'python', P.lexer_name_for(:lexer => 'python')
167
+ assert_equal 'c', P.lexer_name_for(:lexer => 'c')
22
168
  end
169
+
23
170
  def test_lexer_by_filename_and_content
24
- assert_equal 'rb', lexer_name_for(RUBY_CODE, :filename => 'test.rb')
171
+ assert_equal 'rb', P.lexer_name_for(RUBY_CODE, :filename => 'test.rb')
25
172
  end
173
+
26
174
  def test_lexer_by_nothing
27
- assert_equal nil, lexer_name_for(:invalid => true)
175
+ assert_raise MentosError do
176
+ P.lexer_name_for(:invalid => true)
177
+ end
28
178
  end
29
179
  end
30
180
 
31
181
  class PygmentsLexerClassTest < Test::Unit::TestCase
32
- include Pygments
33
-
34
182
  def test_find
35
- assert_equal 'Ruby', Lexer['Ruby'].name
36
- assert_equal 'Ruby', Lexer['ruby'].name
37
- assert_equal 'Ruby', Lexer['rb'].name
38
- assert_equal 'Ruby', Lexer['rake'].name
39
- assert_equal 'Ruby', Lexer['gemspec'].name
183
+ assert_equal 'Ruby', P::Lexer['Ruby'].name
184
+ assert_equal 'Ruby', P::Lexer['ruby'].name
185
+ assert_equal 'Ruby', P::Lexer['rb'].name
186
+ assert_equal 'Ruby', P::Lexer['rake'].name
187
+ assert_equal 'Ruby', P::Lexer['gemspec'].name
40
188
  end
189
+
41
190
  def test_find_by_name
42
- assert_equal Lexer['Ruby'], Lexer.find_by_name('Ruby')
191
+ assert_equal P::Lexer['Ruby'], P::Lexer.find_by_name('Ruby')
192
+ assert_equal P::Lexer['C'], P::Lexer.find_by_name('C')
43
193
  end
194
+
44
195
  def test_find_by_alias
45
- assert_equal Lexer['Ruby'], Lexer.find_by_alias('rb')
46
- assert_equal Lexer['Ruby'], Lexer.find_by_alias('ruby')
196
+ assert_equal P::Lexer['Ruby'], P::Lexer.find_by_alias('rb')
197
+ assert_equal P::Lexer['Ruby'], P::Lexer.find_by_alias('ruby')
198
+ assert_equal P::Lexer['Scala'], P::Lexer.find_by_alias('scala')
199
+ assert_equal P::Lexer['Go'], P::Lexer.find_by_alias('go')
47
200
  end
201
+
48
202
  def test_find_lexer_by_extname
49
- assert_equal Lexer['Ruby'], Lexer.find_by_extname('.rb')
50
- assert_equal Lexer['PHP'], Lexer.find_by_extname('.php4')
51
- assert_equal Lexer['PHP'], Lexer.find_by_extname('.php5')
52
- assert_equal Lexer['Groff'], Lexer.find_by_extname('.1')
53
- assert_equal Lexer['Groff'], Lexer.find_by_extname('.3')
203
+ assert_equal P::Lexer['Ruby'], P::Lexer.find_by_extname('.rb')
204
+ assert_equal P::Lexer['PHP'], P::Lexer.find_by_extname('.php4')
205
+ assert_equal P::Lexer['PHP'], P::Lexer.find_by_extname('.php5')
206
+ assert_equal P::Lexer['Groff'], P::Lexer.find_by_extname('.1')
207
+ assert_equal P::Lexer['Groff'], P::Lexer.find_by_extname('.3')
208
+ assert_equal P::Lexer['C'], P::Lexer.find_by_extname('.c')
209
+ assert_equal P::Lexer['C'], P::Lexer.find_by_extname('.h')
210
+ assert_equal P::Lexer['Python'], P::Lexer.find_by_extname('.py')
211
+ assert_equal P::Lexer['Java'], P::Lexer.find_by_extname('.java')
54
212
  end
55
- def test_find_lexer_by_mimetype
56
- assert_equal Lexer['Ruby'], Lexer.find_by_mimetype('text/x-ruby')
213
+
214
+ def test_find_lexer_by_mimetype
215
+ assert_equal P::Lexer['Ruby'], P::Lexer.find_by_mimetype('text/x-ruby')
216
+ assert_equal P::Lexer['JSON'], P::Lexer.find_by_mimetype('application/json')
217
+ assert_equal P::Lexer['Python'], P::Lexer.find_by_mimetype('text/x-python')
57
218
  end
58
219
  end
59
220
 
221
+
60
222
  class PygmentsCssTest < Test::Unit::TestCase
61
223
  include Pygments
62
224
 
63
225
  def test_css
64
- assert_match /^\.err \{/, css
226
+ assert_match /^\.err \{/, P.css
65
227
  end
228
+
66
229
  def test_css_prefix
67
- assert_match /^\.highlight \.err \{/, css('.highlight')
230
+ assert_match /^\.highlight \.err \{/, P.css('.highlight')
68
231
  end
232
+
69
233
  def test_css_options
70
- assert_match /^\.codeerr \{/, css(:classprefix => 'code')
234
+ assert_match /^\.codeerr \{/, P.css(:classprefix => 'code')
71
235
  end
236
+
72
237
  def test_css_prefix_and_options
73
- assert_match /^\.mycode \.codeerr \{/, css('.mycode', :classprefix => 'code')
238
+ assert_match /^\.mycode \.codeerr \{/, P.css('.mycode', :classprefix => 'code')
74
239
  end
240
+
75
241
  def test_css_default
76
- assert_match '.c { color: #408080; font-style: italic }', css
242
+ assert_match '.c { color: #408080; font-style: italic }', P.css
77
243
  end
244
+
78
245
  def test_css_colorful
79
- assert_match '.c { color: #808080 }', css(:style => 'colorful')
246
+ assert_match '.c { color: #888888 }', P.css(:style => 'colorful')
80
247
  end
81
248
  end
82
249
 
83
250
  class PygmentsConfigTest < Test::Unit::TestCase
84
- include Pygments
85
-
86
251
  def test_styles
87
- assert styles.include?('colorful')
252
+ assert P.styles.include?('colorful')
88
253
  end
254
+
89
255
  def test_filters
90
- assert filters.include?('codetagify')
256
+ assert P.filters.include?('codetagify')
91
257
  end
258
+
92
259
  def test_lexers
93
- list = lexers
260
+ list = P.lexers
94
261
  assert list.has_key?('Ruby')
95
262
  assert list['Ruby'][:aliases].include?('duby')
96
263
  end
264
+
97
265
  def test_formatters
98
- list = formatters
266
+ list = P.formatters
99
267
  assert list.has_key?('Html')
100
268
  assert list['Html'][:aliases].include?('html')
101
269
  end
102
270
  end
103
271
 
104
- class PygmentsHighlightTest < Test::Unit::TestCase
105
- include Pygments
106
-
107
- RUBY_CODE = "#!/usr/bin/ruby\nputs 'foo'"
108
-
109
- def test_highlight_empty
110
- highlight('')
111
- highlight(nil)
112
- end
113
-
114
- def test_highlight_defaults_to_html
115
- code = highlight(RUBY_CODE)
116
- assert_match '<span class="c1">#!/usr/bin/ruby</span>', code
117
- end
118
-
119
- def test_highlight_markdown_compatible_html
120
- code = highlight(RUBY_CODE)
121
- assert_no_match %r{</pre></div>\Z}, code
122
- end
123
-
124
- def test_highlight_works_with_null_bytes
125
- code = highlight("\0hello", :lexer => 'rb')
126
- assert_match "hello", code
127
- end
128
-
129
- def test_highlight_works_on_utf8
130
- code = highlight('# ø', :lexer => 'rb', :options => {:encoding => 'utf-8'})
131
- assert_match '<span class="c1"># ø</span>', code
132
- end
133
-
134
- def test_highlight_formatter_bbcode
135
- code = highlight(RUBY_CODE, :formatter => 'bbcode')
136
- assert_match '[i]#!/usr/bin/ruby[/i]', code
137
- end
138
272
 
139
- def test_highlight_formatter_terminal
140
- code = highlight(RUBY_CODE, :formatter => 'terminal')
141
- assert_match "\e[37m#!/usr/bin/ruby\e[39;49;00m", code
142
- end
143
-
144
- def test_highlight_options
145
- code = highlight(RUBY_CODE, :options => {:full => true, :title => 'test'})
146
- assert_match '<title>test</title>', code
147
- end
148
- end
@@ -35,7 +35,7 @@ LEXERS = {
35
35
  'AwkLexer': ('pygments.lexers.other', 'Awk', ('awk', 'gawk', 'mawk', 'nawk'), ('*.awk',), ('application/x-awk',)),
36
36
  'BBCodeLexer': ('pygments.lexers.text', 'BBCode', ('bbcode',), (), ('text/x-bbcode',)),
37
37
  'BaseMakefileLexer': ('pygments.lexers.text', 'Base Makefile', ('basemake',), (), ()),
38
- 'BashLexer': ('pygments.lexers.shell', 'Bash', ('bash', 'sh', 'ksh'), ('*.sh', '*.ksh', '*.bash', '*.ebuild', '*.eclass', '.bashrc', 'bashrc', '.bash_*', 'bash_*'), ('application/x-sh', 'application/x-shellscript')),
38
+ 'BashLexer': ('pygments.lexers.shell', 'Bash', ('bash', 'sh', 'ksh', 'shell'), ('*.sh', '*.ksh', '*.bash', '*.ebuild', '*.eclass', '.bashrc', 'bashrc', '.bash_*', 'bash_*'), ('application/x-sh', 'application/x-shellscript')),
39
39
  'BashSessionLexer': ('pygments.lexers.shell', 'Bash Session', ('console',), ('*.sh-session',), ('application/x-shell-session',)),
40
40
  'BatchLexer': ('pygments.lexers.shell', 'Batchfile', ('bat',), ('*.bat', '*.cmd'), ('application/x-dos-batch',)),
41
41
  'BefungeLexer': ('pygments.lexers.other', 'Befunge', ('befunge',), ('*.befunge',), ('application/x-befunge',)),
@@ -31,7 +31,7 @@ class BashLexer(RegexLexer):
31
31
  """
32
32
 
33
33
  name = 'Bash'
34
- aliases = ['bash', 'sh', 'ksh']
34
+ aliases = ['bash', 'sh', 'ksh', 'shell']
35
35
  filenames = ['*.sh', '*.ksh', '*.bash', '*.ebuild', '*.eclass',
36
36
  '.bashrc', 'bashrc', '.bash_*', 'bash_*']
37
37
  mimetypes = ['application/x-sh', 'application/x-shellscript']
@@ -0,0 +1,10 @@
1
+ *.egg-info
2
+ *.egg
3
+ *.pyc
4
+ *.so
5
+ /MANIFEST
6
+ /.coverage
7
+ /coverage.xml
8
+ /build
9
+ /dist
10
+ /docs
@@ -0,0 +1,5 @@
1
+ language: python
2
+ python:
3
+ - "2.6"
4
+ - "2.7"
5
+ script: python setup.py test
@@ -0,0 +1,291 @@
1
+ Version 2.6.0 released 2012-06-26
2
+
3
+ * Error messages changed to match proposal for Python 3.3.1
4
+ http://bugs.python.org/issue5067
5
+
6
+ Version 2.5.2 released 2012-05-10
7
+
8
+ * Fix for regression introduced in 2.5.1
9
+ https://github.com/simplejson/simplejson/issues/35
10
+
11
+ Version 2.5.1 released 2012-05-10
12
+
13
+ * Support for use_decimal=True in environments that use Python
14
+ sub-interpreters such as uWSGI
15
+ https://github.com/simplejson/simplejson/issues/34
16
+
17
+ Version 2.5.0 released 2012-03-29
18
+
19
+ * New item_sort_key option for encoder to allow fine grained control of sorted
20
+ output
21
+
22
+ Version 2.4.0 released 2012-03-06
23
+
24
+ * New bigint_as_string option for encoder to trade JavaScript number precision
25
+ issues for type issues.
26
+ https://github.com/simplejson/simplejson/issues/31
27
+
28
+ Version 2.3.3 released 2012-02-27
29
+
30
+ * Allow unknown numerical types for indent parameter
31
+ https://github.com/simplejson/simplejson/pull/29
32
+
33
+ Version 2.3.2 released 2011-12-30
34
+
35
+ * Fix crashing regression in speedups introduced in 2.3.1
36
+
37
+ Version 2.3.1 released 2011-12-29
38
+
39
+ * namedtuple_as_object now checks _asdict to ensure that it
40
+ is callable.
41
+ https://github.com/simplejson/simplejson/issues/26
42
+
43
+ Version 2.3.0 released 2011-12-05
44
+
45
+ * Any objects with _asdict() methods are now considered for
46
+ namedtuple_as_object.
47
+ https://github.com/simplejson/simplejson/pull/22
48
+
49
+ Version 2.2.1 released 2011-09-06
50
+
51
+ * Fix MANIFEST.in issue when building a sdist from a sdist.
52
+ https://github.com/simplejson/simplejson/issues/16
53
+
54
+ Version 2.2.0 released 2011-09-04
55
+
56
+ * Remove setuptools requirement, reverted to pure distutils
57
+ * use_decimal default for encoding (dump, dumps, JSONEncoder) is now True
58
+ * tuple encoding as JSON objects can be turned off with new
59
+ tuple_as_array=False option.
60
+ https://github.com/simplejson/simplejson/pull/6
61
+ * namedtuple (or other tuple subclasses with _asdict methods) are now
62
+ encoded as JSON objects rather than arrays by default. Can be disabled
63
+ and treated as a tuple with the new namedtuple_as_object=False option.
64
+ https://github.com/simplejson/simplejson/pull/6
65
+ * JSONDecodeError is now raised instead of ValueError when a document
66
+ ends with an opening quote and the C speedups are in use.
67
+ https://github.com/simplejson/simplejson/issues/15
68
+ * Updated documentation with information about JSONDecodeError
69
+ * Force unicode linebreak characters to be escaped (U+2028 and U+2029)
70
+ http://timelessrepo.com/json-isnt-a-javascript-subset
71
+ * Moved documentation from a git submodule to
72
+ http://simplejson.readthedocs.org/
73
+
74
+ Version 2.1.6 released 2011-05-08
75
+
76
+ * Prevent segfaults with deeply nested JSON documents
77
+ https://github.com/simplejson/simplejson/issues/11
78
+ * Fix compatibility with Python 2.5
79
+ https://github.com/simplejson/simplejson/issues/5
80
+
81
+ Version 2.1.5 released 2011-04-17
82
+
83
+ * Built sdist tarball with setuptools_git installed. Argh.
84
+
85
+ Version 2.1.4 released 2011-04-17
86
+
87
+ * Does not try to build the extension when using PyPy
88
+ * Trailing whitespace after commas no longer emitted when indent is used
89
+ * Migrated to github http://github.com/simplejson/simplejson
90
+
91
+ Version 2.1.3 released 2011-01-17
92
+
93
+ * Support the sort_keys option in C encoding speedups
94
+ http://code.google.com/p/simplejson/issues/detail?id=86
95
+ * Allow use_decimal to work with dump()
96
+ http://code.google.com/p/simplejson/issues/detail?id=87
97
+
98
+ Version 2.1.2 released 2010-11-01
99
+
100
+ * Correct wrong end when object_pairs_hook is used
101
+ http://code.google.com/p/simplejson/issues/detail?id=85
102
+ * Correct output for indent=0
103
+ http://bugs.python.org/issue10019
104
+ * Correctly raise TypeError when non-string keys are used with speedups
105
+ http://code.google.com/p/simplejson/issues/detail?id=82
106
+ * Fix the endlineno, endcolno attributes of the JSONDecodeError exception.
107
+ http://code.google.com/p/simplejson/issues/detail?id=81
108
+
109
+ Version 2.1.1 released 2010-03-31
110
+
111
+ * Change how setup.py imports ez_setup.py to try and workaround old versions
112
+ of setuptools.
113
+ http://code.google.com/p/simplejson/issues/detail?id=75
114
+ * Fix compilation on Windows platform (and other platforms with very
115
+ picky compilers)
116
+ * Corrected simplejson.__version__ and other minor doc changes.
117
+ * Do not fail speedups tests if speedups could not be built.
118
+ http://code.google.com/p/simplejson/issues/detail?id=73
119
+
120
+ Version 2.1.0 released 2010-03-10
121
+
122
+ * Decimal serialization officially supported for encoding with
123
+ use_decimal=True. For encoding this encodes Decimal objects and
124
+ for decoding it implies parse_float=Decimal
125
+ * Python 2.4 no longer supported (may still work, but no longer tested)
126
+ * Decoding performance and memory utilization enhancements
127
+ http://bugs.python.org/issue7451
128
+ * JSONEncoderForHTML class for escaping &, <, >
129
+ http://code.google.com/p/simplejson/issues/detail?id=66
130
+ * Memoization of object keys during encoding (when using speedups)
131
+ * Encoder changed to use PyIter_Next for list iteration to avoid
132
+ potential threading issues
133
+ * Encoder changed to use iteritems rather than PyDict_Next in order to
134
+ support dict subclasses that have a well defined ordering
135
+ http://bugs.python.org/issue6105
136
+ * indent encoding parameter changed to be a string rather than an integer
137
+ (integer use still supported for backwards compatibility)
138
+ http://code.google.com/p/simplejson/issues/detail?id=56
139
+ * Test suite (python setup.py test) now automatically runs with and without
140
+ speedups
141
+ http://code.google.com/p/simplejson/issues/detail?id=55
142
+ * Fixed support for older versions of easy_install (e.g. stock Mac OS X config)
143
+ http://code.google.com/p/simplejson/issues/detail?id=54
144
+ * Fixed str/unicode mismatches when using ensure_ascii=False
145
+ http://code.google.com/p/simplejson/issues/detail?id=48
146
+ * Fixed error message when parsing an array with trailing comma with speedups
147
+ http://code.google.com/p/simplejson/issues/detail?id=46
148
+ * Refactor decoder errors to raise JSONDecodeError instead of ValueError
149
+ http://code.google.com/p/simplejson/issues/detail?id=45
150
+ * New ordered_pairs_hook feature in decoder which makes it possible to
151
+ preserve key order. http://bugs.python.org/issue5381
152
+ * Fixed containerless unicode float decoding (same bug as 2.0.4, oops!)
153
+ http://code.google.com/p/simplejson/issues/detail?id=43
154
+ * Share PosInf definition between encoder and decoder
155
+ * Minor reformatting to make it easier to backport simplejson changes
156
+ to Python 2.7/3.1 json module
157
+
158
+ Version 2.0.9 released 2009-02-18
159
+
160
+ * Adds cyclic GC to the Encoder and Scanner speedups, which could've
161
+ caused uncollectible cycles in some cases when using custom parser
162
+ or encoder functions
163
+
164
+ Version 2.0.8 released 2009-02-15
165
+
166
+ * Documentation fixes
167
+ * Fixes encoding True and False as keys
168
+ * Fixes checking for True and False by identity for several parameters
169
+
170
+ Version 2.0.7 released 2009-01-04
171
+
172
+ * Documentation fixes
173
+ * C extension now always returns unicode strings when the input string is
174
+ unicode, even for empty strings
175
+
176
+ Version 2.0.6 released 2008-12-19
177
+
178
+ * Windows build fixes
179
+
180
+ Version 2.0.5 released 2008-11-23
181
+
182
+ * Fixes a segfault in the C extension when using check_circular=False and
183
+ encoding an invalid document
184
+
185
+ Version 2.0.4 released 2008-10-24
186
+
187
+ * Fixes a parsing error in the C extension when the JSON document is (only)
188
+ a floating point number. It would consume one too few characters in that
189
+ case, and claim the document invalid.
190
+
191
+ Version 2.0.3 released 2008-10-11
192
+
193
+ * Fixes reference leaks in the encoding speedups (sorry about that!)
194
+ * Fixes doctest suite for Python 2.6
195
+ * More optimizations for the decoder
196
+
197
+ Version 2.0.2 released 2008-10-06
198
+
199
+ * Fixes MSVC2003 build regression
200
+ * Fixes Python 2.4 compatibility in _speedups.c
201
+
202
+ Version 2.0.1 released 2008-09-29
203
+
204
+ * Fixes long encoding regression introduced in 2.0.0
205
+ * Fixes MinGW build regression introduced in 2.0.0
206
+
207
+ Version 2.0.0 released 2008-09-27
208
+
209
+ * optimized Python encoding path
210
+ * optimized Python decoding path
211
+ * optimized C encoding path
212
+ * optimized C decoding path
213
+ * switched to sphinx docs (nearly the same as the json module in python 2.6)
214
+
215
+ Version 1.9.3 released 2008-09-23
216
+
217
+ * Decoding is significantly faster (for our internal benchmarks)
218
+ * Pretty-printing tool changed from simplejson to simplejson.tool for better
219
+ Python 2.6 comaptibility
220
+ * Misc. bug fixes
221
+
222
+ Version 1.9 released 2008-05-03
223
+
224
+ * Rewrote test suite with unittest and doctest (no more nosetest dependency)
225
+ * Better PEP 7 and PEP 8 source compliance
226
+ * Removed simplejson.jsonfilter demo module
227
+ * simplejson.jsonfilter is no longer included
228
+
229
+ Version 1.8.1 released 2008-03-24
230
+
231
+ * Optional C extension for accelerating the decoding of JSON strings
232
+ * Command line interface for pretty-printing JSON (via python -msimplejson)
233
+ * Decoding of integers and floats is now extensible (e.g. to use Decimal) via
234
+ parse_int, parse_float options.
235
+ * Subversion and issue tracker moved to google code:
236
+ http://code.google.com/p/simplejson/
237
+ * "/" is no longer escaped, so if you're embedding JSON directly in HTML
238
+ you'll want to use .replace("/", "\\/") to prevent a close-tag attack.
239
+
240
+ Version 1.7 released 2007-03-18
241
+
242
+ * Improves encoding performance with an optional C extension to speed up
243
+ str/unicode encoding (by 10-150x or so), which yields an overall speed
244
+ boost of 2x+ (JSON is string-heavy).
245
+ * Support for encoding unicode code points outside the BMP to UTF-16
246
+ surrogate code pairs (specified by the Strings section of RFC 4627).
247
+
248
+ Version 1.6 released 2007-03-03
249
+
250
+ * Improved str support for encoding. Previous versions of simplejson
251
+ integrated strings directly into the output stream, this version ensures
252
+ they're of a particular encoding (default is UTF-8) so that the output
253
+ stream is valid.
254
+
255
+ Version 1.5 released 2007-01-18
256
+
257
+ * Better Python 2.5 compatibility
258
+ * Better Windows compatibility
259
+ * indent encoding parameter for pretty printing
260
+ * separators encoding parameter for generating optimally compact JSON
261
+
262
+ Version 1.3 released 2006-04-01
263
+
264
+ * The optional object_hook function is called upon decoding of any JSON
265
+ object literal, and its return value is used instead of the dict that
266
+ would normally be used. This can be used to efficiently implement
267
+ features such as JSON-RPC class hinting, or other custom decodings of
268
+ JSON. See the documentation for more information.
269
+
270
+ Version 1.1 released 2005-12-31
271
+
272
+ * Renamed from simple_json to simplejson to comply with PEP 8 module naming
273
+ guidelines
274
+ * Full set of documentation
275
+ * More tests
276
+ * The encoder and decoder have been extended to understand NaN, Infinity, and
277
+ -Infinity (but this can be turned off via allow_nan=False for strict JSON
278
+ compliance)
279
+ * The decoder's scanner has been fixed so that it no longer accepts invalid
280
+ JSON documents
281
+ * The decoder now reports line and column information as well as character
282
+ numbers for easier debugging
283
+ * The encoder now has a circular reference checker, which can be optionally
284
+ disabled with check_circular=False
285
+ * dump, dumps, load, loads now accept an optional cls kwarg to use an
286
+ alternate JSONEncoder or JSONDecoder class for convenience.
287
+ * The read/write compatibility shim for json-py now have deprecation warnings
288
+
289
+ Version 1.0 released 2005-12-25
290
+
291
+ * Initial release