Run of fresh-releases for python-commentjson

Try this locally (using silver-platter):

debian-svp new-upstream python-commentjson 

Merge these changes:

git pull https://janitor.debian.net/git/python-commentjson fresh-releases/main
git pull https://janitor.debian.net/git/python-commentjson fresh-releases/pristine-tar
git pull https://janitor.debian.net/git/python-commentjson fresh-releases/upstream

Summary

Merged new upstream version: 0.9.0 (was: 0.8.3).

Diff

Branch: main

Diff is too long (more than 200 lines). Download the raw diff.

Branch: pristine-tar

diff --git a/python-commentjson_0.9.0.orig.tar.gz.delta b/python-commentjson_0.9.0.orig.tar.gz.delta
new file mode 100644
index 0000000..d810da9
Binary files /dev/null and b/python-commentjson_0.9.0.orig.tar.gz.delta differ
diff --git a/python-commentjson_0.9.0.orig.tar.gz.id b/python-commentjson_0.9.0.orig.tar.gz.id
new file mode 100644
index 0000000..ca1b2a6
--- /dev/null
+++ b/python-commentjson_0.9.0.orig.tar.gz.id
@@ -0,0 +1 @@
+71ba113006f09277ab63125c6d4b7e5cbff817c9

Branch: upstream

Tag: upstream/0.9.0
diff --git a/LICENSE.rst b/LICENSE.rst
new file mode 100644
index 0000000..87acd04
--- /dev/null
+++ b/LICENSE.rst
@@ -0,0 +1,20 @@
+The MIT License (MIT)
+
+Copyright (c) 2014 Vaidik Kapoor
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644
index 0000000..bb37a27
--- /dev/null
+++ b/MANIFEST.in
@@ -0,0 +1 @@
+include *.rst
diff --git a/PKG-INFO b/PKG-INFO
index 6bd515e..274dbf6 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: commentjson
-Version: 0.8.3
+Version: 0.9.0
 Summary: Add Python and JavaScript style comments in your JSON files.
 Home-page: https://github.com/vaidik/commentjson
 Author: Vaidik Kapoor
diff --git a/commentjson.egg-info/PKG-INFO b/commentjson.egg-info/PKG-INFO
old mode 100755
new mode 100644
index 6bd515e..274dbf6
--- a/commentjson.egg-info/PKG-INFO
+++ b/commentjson.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: commentjson
-Version: 0.8.3
+Version: 0.9.0
 Summary: Add Python and JavaScript style comments in your JSON files.
 Home-page: https://github.com/vaidik/commentjson
 Author: Vaidik Kapoor
diff --git a/commentjson.egg-info/SOURCES.txt b/commentjson.egg-info/SOURCES.txt
old mode 100755
new mode 100644
index 6e96d63..c88ab20
--- a/commentjson.egg-info/SOURCES.txt
+++ b/commentjson.egg-info/SOURCES.txt
@@ -1,3 +1,5 @@
+LICENSE.rst
+MANIFEST.in
 README.rst
 setup.py
 commentjson/__init__.py
diff --git a/commentjson.egg-info/dependency_links.txt b/commentjson.egg-info/dependency_links.txt
old mode 100755
new mode 100644
diff --git a/commentjson.egg-info/not-zip-safe b/commentjson.egg-info/not-zip-safe
old mode 100755
new mode 100644
diff --git a/commentjson.egg-info/requires.txt b/commentjson.egg-info/requires.txt
index 1db61a6..b02dc29 100644
--- a/commentjson.egg-info/requires.txt
+++ b/commentjson.egg-info/requires.txt
@@ -1 +1 @@
-lark-parser>=0.7.1,<0.8.0
+lark-parser<0.8.0,>=0.7.1
diff --git a/commentjson.egg-info/top_level.txt b/commentjson.egg-info/top_level.txt
old mode 100755
new mode 100644
diff --git a/commentjson/commentjson.py b/commentjson/commentjson.py
index 52aceef..63f1081 100755
--- a/commentjson/commentjson.py
+++ b/commentjson/commentjson.py
@@ -26,7 +26,9 @@ except ImportError:
 import lark
 
 from lark import Lark
+from lark.lexer import Token
 from lark.reconstruct import Reconstructor
+from lark.tree import Tree
 
 
 parser = Lark('''
@@ -38,19 +40,20 @@ parser = Lark('''
           | "true"             -> true
           | "false"            -> false
           | "null"             -> null
-    array  : "[" [value ("," value)*] "]"
-    object : "{" [pair ("," pair)*] "}"
+    array  : "[" [value ("," value)*] TRAILING_COMMA? "]"
+    object : "{" [pair ("," pair)*]  TRAILING_COMMA? "}"
     pair   : string ":" value
     string : ESCAPED_STRING
 
-    COMMENT: /(#|\/\/)[^\\n]*/
+    COMMENT: /(#|\\/\\/)[^\\n]*/
+    TRAILING_COMMA: ","
 
     %import common.ESCAPED_STRING
     %import common.SIGNED_NUMBER
     %import common.WS
     %ignore WS
     %ignore COMMENT
-''', maybe_placeholders=False)
+''', maybe_placeholders=False, parser='lalr')
 
 serializer = Reconstructor(parser)
 
@@ -151,6 +154,15 @@ class JSONLibraryException(BaseException):
     library = 'json'
 
 
+def _remove_trailing_commas(tree):
+    if isinstance(tree, Tree):
+        tree.children = [
+            _remove_trailing_commas(ch) for ch in tree.children
+                if not (isinstance(ch, Token) and ch.type == 'TRAILING_COMMA')
+        ]
+    return tree
+
+
 def loads(text, *args, **kwargs):
     ''' Deserialize `text` (a `str` or `unicode` instance containing a JSON
     document with Python or JavaScript like comments) to a Python object.
@@ -165,7 +177,7 @@ def loads(text, *args, **kwargs):
         text = text.decode(detect_encoding(text), 'surrogatepass')
 
     try:
-        parsed = parser.parse(text)
+        parsed = _remove_trailing_commas(parser.parse(text))
         final_text = serializer.reconstruct(parsed)
     except lark.exceptions.UnexpectedCharacters:
         raise ValueError('Unable to parse text', text)
diff --git a/commentjson/tests/test_commentjson.py b/commentjson/tests/test_commentjson.py
index feca95b..accb45b 100755
--- a/commentjson/tests/test_commentjson.py
+++ b/commentjson/tests/test_commentjson.py
@@ -20,7 +20,8 @@ class TestCommentJson(unittest.TestCase):
                       'string_with_inline_comment',
                       'inline_has_special_characters',
                       'array_with_hash',
-                      'inline_last_quote')
+                      'inline_last_quote',
+                      'trailing_comma')
 
         for file_ in self.files:
             fpath = os.path.join(self.path, file_)
diff --git a/setup.cfg b/setup.cfg
index 861a9f5..8bfd5a1 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,5 +1,4 @@
 [egg_info]
 tag_build = 
 tag_date = 0
-tag_svn_revision = 0
 
diff --git a/setup.py b/setup.py
index f6cfe2c..04a1370 100644
--- a/setup.py
+++ b/setup.py
@@ -6,7 +6,7 @@ import sys
 from setuptools import setup, find_packages
 
 
-__version__ = '.'.join(map(str, (0, 8, 3)))
+__version__ = '0.9.0'
 
 install_requires = [
     'lark-parser>=0.7.1,<0.8.0'

Debdiff

[The following lists of changes regard files as different if they have different names, permissions or owners.]

Files in second set of .debs but not in first

-rw-r--r--  root/root   /usr/lib/python3/dist-packages/commentjson-0.9.0.egg-info/PKG-INFO
-rw-r--r--  root/root   /usr/lib/python3/dist-packages/commentjson-0.9.0.egg-info/dependency_links.txt
-rw-r--r--  root/root   /usr/lib/python3/dist-packages/commentjson-0.9.0.egg-info/not-zip-safe
-rw-r--r--  root/root   /usr/lib/python3/dist-packages/commentjson-0.9.0.egg-info/requires.txt
-rw-r--r--  root/root   /usr/lib/python3/dist-packages/commentjson-0.9.0.egg-info/top_level.txt

Files in first set of .debs but not in second

-rw-r--r--  root/root   /usr/lib/python3/dist-packages/commentjson-0.8.3.egg-info/requires.txt
-rwxr-xr-x  root/root   /usr/lib/python3/dist-packages/commentjson-0.8.3.egg-info/PKG-INFO
-rwxr-xr-x  root/root   /usr/lib/python3/dist-packages/commentjson-0.8.3.egg-info/dependency_links.txt
-rwxr-xr-x  root/root   /usr/lib/python3/dist-packages/commentjson-0.8.3.egg-info/not-zip-safe
-rwxr-xr-x  root/root   /usr/lib/python3/dist-packages/commentjson-0.8.3.egg-info/top_level.txt

No differences were encountered in the control files

Lintian Result

Full worker log Full build log