Skip to content

Commit 6e64a22

Browse files
committed
Removed redundent conts, reverted the version number, reverted formatting of a part
1 parent 165004e commit 6e64a22

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

jsonpointer.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
# Will be parsed by setup.py to determine package metadata
3838
__author__ = 'Stefan Kögl <[email protected]>'
39-
__version__ = '1.4'
39+
__version__ = '1.5'
4040
__website__ = 'https://github.com/stefankoegl/python-json-pointer'
4141
__license__ = 'Modified BSD License'
4242

@@ -148,10 +148,6 @@ def __repr__(self):
148148
class JsonPointer(object):
149149
"""A JSON Pointer that can reference parts of an JSON document"""
150150

151-
_GETITEM_SUPPORT_ERROR = """document '%s' does not support indexing,
152-
must be mapping/sequence
153-
or support __getitem__"""
154-
155151
# Array indices must not contain:
156152
# leading zeros, signs, spaces, decimals, etc
157153
_RE_ARRAY_INDEX = re.compile('0|[1-9][0-9]*$')
@@ -232,7 +228,8 @@ def get_part(self, doc, part):
232228
return part
233229

234230
else:
235-
raise JsonPointerException(self._GETITEM_SUPPORT_ERROR % type(doc))
231+
raise JsonPointerException("document '%s' does not support indexing, "
232+
"must be mapping/sequence or support __getitem__" % type(doc))
236233

237234
def walk(self, doc, part):
238235
"""Walks one step in doc and returns the referenced part"""
@@ -258,7 +255,7 @@ def walk(self, doc, part):
258255
return doc[part]
259256

260257
except IndexError:
261-
raise JsonPointerException("index '%s' is out of bounds" % part)
258+
raise JsonPointerException("index '%s' is out of bounds" % (part, ))
262259

263260
else:
264261
# Object supports __getitem__, assume custom indexing

0 commit comments

Comments
 (0)