36
36
37
37
# Will be parsed by setup.py to determine package metadata
38
38
__author__ = 'Stefan Kögl <[email protected] >'
39
- __version__ = '1.4 '
39
+ __version__ = '1.5 '
40
40
__website__ = 'https://github.com/stefankoegl/python-json-pointer'
41
41
__license__ = 'Modified BSD License'
42
42
@@ -148,10 +148,6 @@ def __repr__(self):
148
148
class JsonPointer (object ):
149
149
"""A JSON Pointer that can reference parts of an JSON document"""
150
150
151
- _GETITEM_SUPPORT_ERROR = """document '%s' does not support indexing,
152
- must be mapping/sequence
153
- or support __getitem__"""
154
-
155
151
# Array indices must not contain:
156
152
# leading zeros, signs, spaces, decimals, etc
157
153
_RE_ARRAY_INDEX = re .compile ('0|[1-9][0-9]*$' )
@@ -232,7 +228,8 @@ def get_part(self, doc, part):
232
228
return part
233
229
234
230
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 ))
236
233
237
234
def walk (self , doc , part ):
238
235
"""Walks one step in doc and returns the referenced part"""
@@ -258,7 +255,7 @@ def walk(self, doc, part):
258
255
return doc [part ]
259
256
260
257
except IndexError :
261
- raise JsonPointerException ("index '%s' is out of bounds" % part )
258
+ raise JsonPointerException ("index '%s' is out of bounds" % ( part , ) )
262
259
263
260
else :
264
261
# Object supports __getitem__, assume custom indexing
0 commit comments