summaryrefslogtreecommitdiff
path: root/jsonpointer.py
diff options
context:
space:
mode:
authorkafkaf- <thekafkaf@gmail.com>2014-11-10 22:11:20 +0200
committerkafkaf- <thekafkaf@gmail.com>2014-11-10 22:11:20 +0200
commit6e64a22dc7d8564ceaa399bb2e97765e2e70d270 (patch)
treeb63d491cbf69cabd330cbe6523bba2e4895edca1 /jsonpointer.py
parent165004e2396419653b838cc0f23f40ef0f371ecb (diff)
downloadpython-json-pointer-6e64a22dc7d8564ceaa399bb2e97765e2e70d270.tar.gz
Removed redundent conts, reverted the version number, reverted formatting of a part
Diffstat (limited to 'jsonpointer.py')
-rw-r--r--jsonpointer.py11
1 files changed, 4 insertions, 7 deletions
diff --git a/jsonpointer.py b/jsonpointer.py
index cfd0698..7e94705 100644
--- a/jsonpointer.py
+++ b/jsonpointer.py
@@ -36,7 +36,7 @@ from __future__ import unicode_literals
# Will be parsed by setup.py to determine package metadata
__author__ = 'Stefan Kögl <stefan@skoegl.net>'
-__version__ = '1.4'
+__version__ = '1.5'
__website__ = 'https://github.com/stefankoegl/python-json-pointer'
__license__ = 'Modified BSD License'
@@ -148,10 +148,6 @@ class EndOfList(object):
class JsonPointer(object):
"""A JSON Pointer that can reference parts of an JSON document"""
- _GETITEM_SUPPORT_ERROR = """document '%s' does not support indexing,
- must be mapping/sequence
- or support __getitem__"""
-
# Array indices must not contain:
# leading zeros, signs, spaces, decimals, etc
_RE_ARRAY_INDEX = re.compile('0|[1-9][0-9]*$')
@@ -232,7 +228,8 @@ class JsonPointer(object):
return part
else:
- raise JsonPointerException(self._GETITEM_SUPPORT_ERROR % type(doc))
+ raise JsonPointerException("document '%s' does not support indexing, "
+ "must be mapping/sequence or support __getitem__" % type(doc))
def walk(self, doc, part):
"""Walks one step in doc and returns the referenced part"""
@@ -258,7 +255,7 @@ class JsonPointer(object):
return doc[part]
except IndexError:
- raise JsonPointerException("index '%s' is out of bounds" % part)
+ raise JsonPointerException("index '%s' is out of bounds" % (part, ))
else:
# Object supports __getitem__, assume custom indexing