jsonpointer 2.4__tar.gz → 3.1.0__tar.gz

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.
@@ -1,41 +1,46 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: jsonpointer
3
- Version: 2.4
3
+ Version: 3.1.0
4
4
  Summary: Identify specific nodes in a JSON document (RFC 6901)
5
5
  Home-page: https://github.com/stefankoegl/python-json-pointer
6
6
  Author: Stefan Kögl
7
7
  Author-email: stefan@skoegl.net
8
8
  License: Modified BSD License
9
- Platform: UNKNOWN
10
9
  Classifier: Development Status :: 5 - Production/Stable
11
10
  Classifier: Environment :: Console
12
11
  Classifier: Intended Audience :: Developers
13
12
  Classifier: License :: OSI Approved :: BSD License
14
13
  Classifier: Operating System :: OS Independent
15
14
  Classifier: Programming Language :: Python
16
- Classifier: Programming Language :: Python :: 2
17
- Classifier: Programming Language :: Python :: 2.7
18
15
  Classifier: Programming Language :: Python :: 3
19
- Classifier: Programming Language :: Python :: 3.7
20
- Classifier: Programming Language :: Python :: 3.8
21
- Classifier: Programming Language :: Python :: 3.9
22
16
  Classifier: Programming Language :: Python :: 3.10
23
17
  Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
24
20
  Classifier: Programming Language :: Python :: Implementation :: CPython
25
21
  Classifier: Programming Language :: Python :: Implementation :: PyPy
26
22
  Classifier: Topic :: Software Development :: Libraries
27
23
  Classifier: Topic :: Utilities
28
- Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, !=3.6.*
24
+ Requires-Python: >=3.10
29
25
  Description-Content-Type: text/markdown
30
26
  License-File: LICENSE.txt
31
27
  License-File: AUTHORS
28
+ Dynamic: author
29
+ Dynamic: author-email
30
+ Dynamic: classifier
31
+ Dynamic: description
32
+ Dynamic: description-content-type
33
+ Dynamic: home-page
34
+ Dynamic: license
35
+ Dynamic: license-file
36
+ Dynamic: requires-python
37
+ Dynamic: summary
32
38
 
33
39
  python-json-pointer
34
40
  ===================
35
41
 
36
42
  [![PyPI version](https://img.shields.io/pypi/v/jsonpointer.svg)](https://pypi.python.org/pypi/jsonpointer/)
37
43
  [![Supported Python versions](https://img.shields.io/pypi/pyversions/jsonpointer.svg)](https://pypi.python.org/pypi/jsonpointer/)
38
- [![Build Status](https://travis-ci.org/stefankoegl/python-json-pointer.svg?branch=master)](https://travis-ci.org/stefankoegl/python-json-pointer)
39
44
  [![Coverage Status](https://coveralls.io/repos/stefankoegl/python-json-pointer/badge.svg?branch=master)](https://coveralls.io/r/stefankoegl/python-json-pointer?branch=master)
40
45
 
41
46
 
@@ -52,5 +57,3 @@ See source code for examples
52
57
  * PyPI: https://pypi.python.org/pypi/jsonpointer
53
58
  * Travis CI: https://travis-ci.org/stefankoegl/python-json-pointer
54
59
  * Coveralls: https://coveralls.io/r/stefankoegl/python-json-pointer
55
-
56
-
@@ -3,7 +3,6 @@ python-json-pointer
3
3
 
4
4
  [![PyPI version](https://img.shields.io/pypi/v/jsonpointer.svg)](https://pypi.python.org/pypi/jsonpointer/)
5
5
  [![Supported Python versions](https://img.shields.io/pypi/pyversions/jsonpointer.svg)](https://pypi.python.org/pypi/jsonpointer/)
6
- [![Build Status](https://travis-ci.org/stefankoegl/python-json-pointer.svg?branch=master)](https://travis-ci.org/stefankoegl/python-json-pointer)
7
6
  [![Coverage Status](https://coveralls.io/repos/stefankoegl/python-json-pointer/badge.svg?branch=master)](https://coveralls.io/r/stefankoegl/python-json-pointer?branch=master)
8
7
 
9
8
 
@@ -1,14 +1,11 @@
1
- #!/usr/bin/env python
2
- # -*- coding: utf-8 -*-
1
+ #!/usr/bin/env python3
3
2
 
4
- from __future__ import print_function
5
3
 
6
- import sys
7
- import os.path
8
- import json
9
- import jsonpointer
10
4
  import argparse
5
+ import json
6
+ import sys
11
7
 
8
+ import jsonpointer
12
9
 
13
10
  parser = argparse.ArgumentParser(
14
11
  description='Resolve a JSON pointer on JSON files')
@@ -20,7 +17,7 @@ ptr_group.add_argument('-f', '--pointer-file', type=argparse.FileType('r'),
20
17
  nargs='?',
21
18
  help='File containing a JSON pointer expression')
22
19
 
23
- ptr_group.add_argument('POINTER', type=str, nargs='?',
20
+ ptr_group.add_argument('POINTER', type=str, nargs='?',
24
21
  help='A JSON pointer expression')
25
22
 
26
23
  parser.add_argument('FILE', type=argparse.FileType('r'), nargs='+',
@@ -1,41 +1,46 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: jsonpointer
3
- Version: 2.4
3
+ Version: 3.1.0
4
4
  Summary: Identify specific nodes in a JSON document (RFC 6901)
5
5
  Home-page: https://github.com/stefankoegl/python-json-pointer
6
6
  Author: Stefan Kögl
7
7
  Author-email: stefan@skoegl.net
8
8
  License: Modified BSD License
9
- Platform: UNKNOWN
10
9
  Classifier: Development Status :: 5 - Production/Stable
11
10
  Classifier: Environment :: Console
12
11
  Classifier: Intended Audience :: Developers
13
12
  Classifier: License :: OSI Approved :: BSD License
14
13
  Classifier: Operating System :: OS Independent
15
14
  Classifier: Programming Language :: Python
16
- Classifier: Programming Language :: Python :: 2
17
- Classifier: Programming Language :: Python :: 2.7
18
15
  Classifier: Programming Language :: Python :: 3
19
- Classifier: Programming Language :: Python :: 3.7
20
- Classifier: Programming Language :: Python :: 3.8
21
- Classifier: Programming Language :: Python :: 3.9
22
16
  Classifier: Programming Language :: Python :: 3.10
23
17
  Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
24
20
  Classifier: Programming Language :: Python :: Implementation :: CPython
25
21
  Classifier: Programming Language :: Python :: Implementation :: PyPy
26
22
  Classifier: Topic :: Software Development :: Libraries
27
23
  Classifier: Topic :: Utilities
28
- Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, !=3.6.*
24
+ Requires-Python: >=3.10
29
25
  Description-Content-Type: text/markdown
30
26
  License-File: LICENSE.txt
31
27
  License-File: AUTHORS
28
+ Dynamic: author
29
+ Dynamic: author-email
30
+ Dynamic: classifier
31
+ Dynamic: description
32
+ Dynamic: description-content-type
33
+ Dynamic: home-page
34
+ Dynamic: license
35
+ Dynamic: license-file
36
+ Dynamic: requires-python
37
+ Dynamic: summary
32
38
 
33
39
  python-json-pointer
34
40
  ===================
35
41
 
36
42
  [![PyPI version](https://img.shields.io/pypi/v/jsonpointer.svg)](https://pypi.python.org/pypi/jsonpointer/)
37
43
  [![Supported Python versions](https://img.shields.io/pypi/pyversions/jsonpointer.svg)](https://pypi.python.org/pypi/jsonpointer/)
38
- [![Build Status](https://travis-ci.org/stefankoegl/python-json-pointer.svg?branch=master)](https://travis-ci.org/stefankoegl/python-json-pointer)
39
44
  [![Coverage Status](https://coveralls.io/repos/stefankoegl/python-json-pointer/badge.svg?branch=master)](https://coveralls.io/r/stefankoegl/python-json-pointer?branch=master)
40
45
 
41
46
 
@@ -52,5 +57,3 @@ See source code for examples
52
57
  * PyPI: https://pypi.python.org/pypi/jsonpointer
53
58
  * Travis CI: https://travis-ci.org/stefankoegl/python-json-pointer
54
59
  * Coveralls: https://coveralls.io/r/stefankoegl/python-json-pointer
55
-
56
-
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
- #
3
1
  # python-json-pointer - An implementation of the JSON Pointer syntax
4
2
  # https://github.com/stefankoegl/python-json-pointer
5
3
  #
@@ -32,38 +30,22 @@
32
30
 
33
31
  """ Identify specific nodes in a JSON document (RFC 6901) """
34
32
 
35
- from __future__ import unicode_literals
36
-
37
33
  # Will be parsed by setup.py to determine package metadata
38
34
  __author__ = 'Stefan Kögl <stefan@skoegl.net>'
39
- __version__ = '2.4'
35
+ __version__ = '3.1.0'
40
36
  __website__ = 'https://github.com/stefankoegl/python-json-pointer'
41
37
  __license__ = 'Modified BSD License'
42
38
 
43
-
44
- try:
45
- from itertools import izip
46
- str = unicode
47
- encode_str = lambda u: u.encode("raw_unicode_escape")
48
- except ImportError: # Python 3
49
- izip = zip
50
- encode_str = lambda u: u
51
-
52
- try:
53
- from collections.abc import Mapping, Sequence
54
- except ImportError: # Python 3
55
- from collections import Mapping, Sequence
56
-
57
- from itertools import tee, chain
58
- import re
59
39
  import copy
60
-
40
+ import re
41
+ from collections.abc import Mapping, Sequence
42
+ from itertools import tee, chain
61
43
 
62
44
  _nothing = object()
63
45
 
64
46
 
65
47
  def set_pointer(doc, pointer, value, inplace=True):
66
- """Resolves pointer against doc and sets the value of the target within doc.
48
+ """Resolves a pointer against doc and sets the value of the target within doc.
67
49
 
68
50
  With inplace set to true, doc is modified as long as pointer is not the
69
51
  root.
@@ -145,14 +127,14 @@ def pairwise(iterable):
145
127
  a, b = tee(iterable)
146
128
  for _ in b:
147
129
  break
148
- return izip(a, b)
130
+ return zip(a, b)
149
131
 
150
132
 
151
133
  class JsonPointerException(Exception):
152
134
  pass
153
135
 
154
136
 
155
- class EndOfList(object):
137
+ class EndOfList:
156
138
  """Result of accessing element "-" of a list"""
157
139
 
158
140
  def __init__(self, list_):
@@ -163,7 +145,7 @@ class EndOfList(object):
163
145
  lst=repr(self.list_))
164
146
 
165
147
 
166
- class JsonPointer(object):
148
+ class JsonPointer:
167
149
  """A JSON Pointer that can reference parts of a JSON document"""
168
150
 
169
151
  # Array indices must not contain:
@@ -259,12 +241,11 @@ class JsonPointer(object):
259
241
  else:
260
242
  raise JsonPointerException("Document '%s' does not support indexing, "
261
243
  "must be mapping/sequence or support __getitem__" % type(doc))
262
-
244
+
263
245
  def get_parts(self):
264
246
  """Returns the list of the parts. For example, JsonPointer('/a/b').get_parts() == ['a', 'b']"""
265
-
266
- return self.parts
267
247
 
248
+ return self.parts
268
249
 
269
250
  def walk(self, doc, part):
270
251
  """ Walks one step in doc and returns the referenced part """
@@ -281,7 +262,7 @@ class JsonPointer(object):
281
262
  return doc[part]
282
263
 
283
264
  except IndexError:
284
- raise JsonPointerException("index '%s' is out of bounds" % (part, ))
265
+ raise JsonPointerException("index '%s' is out of bounds" % (part,))
285
266
 
286
267
  # Else the object is a mapping or supports __getitem__(so assume custom indexing)
287
268
  try:
@@ -290,7 +271,6 @@ class JsonPointer(object):
290
271
  except KeyError:
291
272
  raise JsonPointerException("member '%s' not found in %s" % (part, doc))
292
273
 
293
-
294
274
  def contains(self, ptr):
295
275
  """ Returns True if self contains the given ptr """
296
276
  return self.parts[:len(ptr.parts)] == ptr.parts
@@ -309,12 +289,11 @@ class JsonPointer(object):
309
289
  suffix_parts = suffix
310
290
  try:
311
291
  return JsonPointer.from_parts(chain(self.parts, suffix_parts))
312
- except:
292
+ except: # noqa E722
313
293
  raise JsonPointerException("Invalid suffix")
314
294
 
315
- def __truediv__(self, suffix): # Python 3
295
+ def __truediv__(self, suffix):
316
296
  return self.join(suffix)
317
- __div__ = __truediv__ # Python 2
318
297
 
319
298
  @property
320
299
  def path(self):
@@ -342,10 +321,10 @@ class JsonPointer(object):
342
321
  return hash(tuple(self.parts))
343
322
 
344
323
  def __str__(self):
345
- return encode_str(self.path)
324
+ return self.path
346
325
 
347
326
  def __repr__(self):
348
- return "JsonPointer(" + repr(self.path) + ")"
327
+ return type(self).__name__ + "(" + repr(self.path) + ")"
349
328
 
350
329
  @classmethod
351
330
  def from_parts(cls, parts):
@@ -362,5 +341,6 @@ class JsonPointer(object):
362
341
  def escape(s):
363
342
  return s.replace('~', '~0').replace('/', '~1')
364
343
 
344
+
365
345
  def unescape(s):
366
346
  return s.replace('~1', '/').replace('~0', '~')
@@ -0,0 +1,8 @@
1
+ [flake8]
2
+ max-line-length = 120
3
+ exclude = .git,.tox,dist,doc,*egg,build,.venv
4
+
5
+ [egg_info]
6
+ tag_build =
7
+ tag_date = 0
8
+
@@ -1,9 +1,10 @@
1
1
  #!/usr/bin/env python
2
2
 
3
- from setuptools import setup
4
- import re
5
3
  import io
6
4
  import os.path
5
+ import re
6
+
7
+ from setuptools import setup
7
8
 
8
9
  dirname = os.path.dirname(os.path.abspath(__file__))
9
10
  filename = os.path.join(dirname, 'jsonpointer.py')
@@ -14,7 +15,7 @@ docstrings = re.findall('"""(.*)"""', src)
14
15
  PACKAGE = 'jsonpointer'
15
16
 
16
17
  MODULES = (
17
- 'jsonpointer',
18
+ 'jsonpointer',
18
19
  )
19
20
 
20
21
  AUTHOR_EMAIL = metadata['author']
@@ -26,10 +27,8 @@ DESCRIPTION = docstrings[0]
26
27
  # Extract name and e-mail ("Firstname Lastname <mail@example.org>")
27
28
  AUTHOR, EMAIL = re.match(r'(.*) <(.*)>', AUTHOR_EMAIL).groups()
28
29
 
29
-
30
30
  with open('README.md') as readme:
31
- long_description = readme.read()
32
-
31
+ long_description = readme.read()
33
32
 
34
33
  CLASSIFIERS = [
35
34
  'Development Status :: 5 - Production/Stable',
@@ -38,31 +37,29 @@ CLASSIFIERS = [
38
37
  'License :: OSI Approved :: BSD License',
39
38
  'Operating System :: OS Independent',
40
39
  'Programming Language :: Python',
41
- 'Programming Language :: Python :: 2',
42
- 'Programming Language :: Python :: 2.7',
43
40
  'Programming Language :: Python :: 3',
44
- 'Programming Language :: Python :: 3.7',
45
- 'Programming Language :: Python :: 3.8',
46
- 'Programming Language :: Python :: 3.9',
47
41
  'Programming Language :: Python :: 3.10',
48
42
  'Programming Language :: Python :: 3.11',
43
+ 'Programming Language :: Python :: 3.12',
44
+ 'Programming Language :: Python :: 3.13',
49
45
  'Programming Language :: Python :: Implementation :: CPython',
50
46
  'Programming Language :: Python :: Implementation :: PyPy',
51
47
  'Topic :: Software Development :: Libraries',
52
48
  'Topic :: Utilities',
53
49
  ]
54
50
 
55
- setup(name=PACKAGE,
56
- version=VERSION,
57
- description=DESCRIPTION,
58
- long_description=long_description,
59
- long_description_content_type="text/markdown",
60
- author=AUTHOR,
61
- author_email=EMAIL,
62
- license=LICENSE,
63
- url=WEBSITE,
64
- py_modules=MODULES,
65
- scripts=['bin/jsonpointer'],
66
- classifiers=CLASSIFIERS,
67
- python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, !=3.6.*',
51
+ setup(
52
+ name=PACKAGE,
53
+ version=VERSION,
54
+ description=DESCRIPTION,
55
+ long_description=long_description,
56
+ long_description_content_type="text/markdown",
57
+ author=AUTHOR,
58
+ author_email=EMAIL,
59
+ license=LICENSE,
60
+ url=WEBSITE,
61
+ py_modules=MODULES,
62
+ scripts=['bin/jsonpointer'],
63
+ classifiers=CLASSIFIERS,
64
+ python_requires='>=3.10',
68
65
  )
@@ -1,22 +1,19 @@
1
1
  #!/usr/bin/env python
2
- # -*- coding: utf-8 -*-
3
-
4
- from __future__ import unicode_literals
5
2
 
3
+ import copy
6
4
  import doctest
7
5
  import unittest
8
- import sys
9
- import copy
6
+
10
7
  import jsonpointer
11
8
  from jsonpointer import resolve_pointer, EndOfList, JsonPointerException, \
12
- JsonPointer, set_pointer
9
+ JsonPointer, set_pointer
13
10
 
14
11
 
15
12
  class SpecificationTests(unittest.TestCase):
16
13
  """ Tests all examples from the JSON Pointer specification """
17
14
 
18
15
  def test_example(self):
19
- doc = {
16
+ doc = {
20
17
  "foo": ["bar", "baz"],
21
18
  "": 0,
22
19
  "a/b": 1,
@@ -42,7 +39,6 @@ class SpecificationTests(unittest.TestCase):
42
39
  self.assertEqual(resolve_pointer(doc, "/ "), 7)
43
40
  self.assertEqual(resolve_pointer(doc, "/m~0n"), 8)
44
41
 
45
-
46
42
  def test_eol(self):
47
43
  doc = {
48
44
  "foo": ["bar", "baz"]
@@ -78,45 +74,33 @@ class SpecificationTests(unittest.TestCase):
78
74
 
79
75
  def test_str_and_repr(self):
80
76
  paths = [
81
- ("", "", "JsonPointer({u}'')"),
82
- ("/foo", "/foo", "JsonPointer({u}'/foo')"),
83
- ("/foo/0", "/foo/0", "JsonPointer({u}'/foo/0')"),
84
- ("/", "/", "JsonPointer({u}'/')"),
85
- ("/a~1b", "/a~1b", "JsonPointer({u}'/a~1b')"),
86
- ("/c%d", "/c%d", "JsonPointer({u}'/c%d')"),
87
- ("/e^f", "/e^f", "JsonPointer({u}'/e^f')"),
88
- ("/g|h", "/g|h", "JsonPointer({u}'/g|h')"),
89
- ("/i\\j", "/i\\j", "JsonPointer({u}'/i\\\\j')"),
90
- ("/k\"l", "/k\"l", "JsonPointer({u}'/k\"l')"),
91
- ("/ ", "/ ", "JsonPointer({u}'/ ')"),
92
- ("/m~0n", "/m~0n", "JsonPointer({u}'/m~0n')"),
77
+ ("", "", "JsonPointer('')"),
78
+ ("/foo", "/foo", "JsonPointer('/foo')"),
79
+ ("/foo/0", "/foo/0", "JsonPointer('/foo/0')"),
80
+ ("/", "/", "JsonPointer('/')"),
81
+ ("/a~1b", "/a~1b", "JsonPointer('/a~1b')"),
82
+ ("/c%d", "/c%d", "JsonPointer('/c%d')"),
83
+ ("/e^f", "/e^f", "JsonPointer('/e^f')"),
84
+ ("/g|h", "/g|h", "JsonPointer('/g|h')"),
85
+ ("/i\\j", "/i\\j", "JsonPointer('/i\\\\j')"),
86
+ ("/k\"l", "/k\"l", "JsonPointer('/k\"l')"),
87
+ ("/ ", "/ ", "JsonPointer('/ ')"),
88
+ ("/m~0n", "/m~0n", "JsonPointer('/m~0n')"),
93
89
  ]
94
90
  for path, ptr_str, ptr_repr in paths:
95
91
  ptr = JsonPointer(path)
96
92
  self.assertEqual(path, ptr.path)
97
-
98
- if sys.version_info[0] == 2:
99
- u_str = "u"
100
- else:
101
- u_str = ""
102
93
  self.assertEqual(ptr_str, str(ptr))
103
- self.assertEqual(ptr_repr.format(u=u_str), repr(ptr))
104
-
105
- if sys.version_info[0] == 2:
106
- path = "/\xee"
107
- ptr_str = b"/\xee"
108
- ptr_repr = "JsonPointer(u'/\\xee')"
109
- else:
110
- path = "/\xee"
111
- ptr_str = "/\xee"
112
- ptr_repr = "JsonPointer('/\xee')"
94
+ self.assertEqual(ptr_repr, repr(ptr))
95
+
96
+ path = "/\xee"
97
+ ptr_str = "/\xee"
98
+ ptr_repr = "JsonPointer('/\xee')"
113
99
  ptr = JsonPointer(path)
114
100
  self.assertEqual(path, ptr.path)
115
-
116
101
  self.assertEqual(ptr_str, str(ptr))
117
102
  self.assertEqual(ptr_repr, repr(ptr))
118
103
 
119
- # should not be unicode in Python 2
120
104
  self.assertIsInstance(str(ptr), str)
121
105
  self.assertIsInstance(repr(ptr), str)
122
106
 
@@ -165,19 +149,16 @@ class ComparisonTests(unittest.TestCase):
165
149
  self.assertFalse(p1 == "/something/1/b")
166
150
 
167
151
  def test_contains(self):
168
-
169
152
  self.assertTrue(self.ptr1.contains(self.ptr2))
170
153
  self.assertTrue(self.ptr1.contains(self.ptr1))
171
154
  self.assertFalse(self.ptr1.contains(self.ptr3))
172
155
 
173
156
  def test_contains_magic(self):
174
-
175
157
  self.assertTrue(self.ptr2 in self.ptr1)
176
158
  self.assertTrue(self.ptr1 in self.ptr1)
177
159
  self.assertFalse(self.ptr3 in self.ptr1)
178
160
 
179
161
  def test_join(self):
180
-
181
162
  ptr12a = self.ptr1.join(self.ptr2)
182
163
  self.assertEqual(ptr12a.path, "/a/b/c/a/b")
183
164
 
@@ -196,7 +177,6 @@ class ComparisonTests(unittest.TestCase):
196
177
  self.assertRaises(JsonPointerException, self.ptr1.join, 0)
197
178
 
198
179
  def test_join_magic(self):
199
-
200
180
  ptr12a = self.ptr1 / self.ptr2
201
181
  self.assertEqual(ptr12a.path, "/a/b/c/a/b")
202
182
 
@@ -212,6 +192,7 @@ class ComparisonTests(unittest.TestCase):
212
192
  ptr12e = self.ptr1 / ["a", "b"]
213
193
  self.assertEqual(ptr12e.path, "/a/b/c/a/b")
214
194
 
195
+
215
196
  class WrongInputTests(unittest.TestCase):
216
197
 
217
198
  def test_no_start_slash(self):
@@ -244,7 +225,6 @@ class ToLastTests(unittest.TestCase):
244
225
  self.assertEqual(doc, last)
245
226
  self.assertTrue(nxt is None)
246
227
 
247
-
248
228
  def test_path(self):
249
229
  doc = {'a': [{'b': 1, 'c': 2}, 5]}
250
230
  ptr = JsonPointer('/a/0/b')
@@ -256,7 +236,7 @@ class ToLastTests(unittest.TestCase):
256
236
  class SetTests(unittest.TestCase):
257
237
 
258
238
  def test_set(self):
259
- doc = {
239
+ doc = {
260
240
  "foo": ["bar", "baz"],
261
241
  "": 0,
262
242
  "a/b": 1,
@@ -285,7 +265,7 @@ class SetTests(unittest.TestCase):
285
265
 
286
266
  newdoc = set_pointer(doc, "/fud", {}, inplace=False)
287
267
  newdoc = set_pointer(newdoc, "/fud/gaw", [1, 2, 3], inplace=False)
288
- self.assertEqual(resolve_pointer(newdoc, "/fud"), {'gaw' : [1, 2, 3]})
268
+ self.assertEqual(resolve_pointer(newdoc, "/fud"), {'gaw': [1, 2, 3]})
289
269
 
290
270
  newdoc = set_pointer(doc, "", 9, inplace=False)
291
271
  self.assertEqual(newdoc, 9)
@@ -307,14 +287,13 @@ class SetTests(unittest.TestCase):
307
287
  self.assertRaises(JsonPointerException, set_pointer, doc, "/fud/gaw", 9)
308
288
 
309
289
  set_pointer(doc, "/fud", {})
310
- set_pointer(doc, "/fud/gaw", [1, 2, 3] )
311
- self.assertEqual(resolve_pointer(doc, "/fud"), {'gaw' : [1, 2, 3]})
290
+ set_pointer(doc, "/fud/gaw", [1, 2, 3])
291
+ self.assertEqual(resolve_pointer(doc, "/fud"), {'gaw': [1, 2, 3]})
312
292
 
313
293
  self.assertRaises(JsonPointerException, set_pointer, doc, "", 9)
314
294
 
315
295
 
316
296
  class AltTypesTests(unittest.TestCase):
317
-
318
297
  class Node(object):
319
298
  def __init__(self, name, parent=None):
320
299
  self.name = name
@@ -349,13 +328,13 @@ class AltTypesTests(unittest.TestCase):
349
328
  class mdict(object):
350
329
  def __init__(self, d):
351
330
  self._d = d
331
+
352
332
  def __getitem__(self, item):
353
333
  return self._d[item]
354
334
 
355
335
  mdict = mdict({'root': {'1': {'2': '3'}}})
356
336
  Node = Node
357
337
 
358
-
359
338
  def test_alttypes(self):
360
339
  Node = self.Node
361
340
 
@@ -390,7 +369,7 @@ class AltTypesTests(unittest.TestCase):
390
369
  '/root/1/2': '3',
391
370
  }
392
371
 
393
- for path, expected_value in iter(path_to_expected_value.items()):
372
+ for path, expected_value in path_to_expected_value.items():
394
373
  self.assertEqual(resolve_pointer(doc, path, default), expected_value)
395
374
 
396
375
  def test_mock_dict_returns_default(self):
@@ -402,7 +381,7 @@ class AltTypesTests(unittest.TestCase):
402
381
  '/x/y/z/d': default
403
382
  }
404
383
 
405
- for path, expected_value in iter(path_to_expected_value.items()):
384
+ for path, expected_value in path_to_expected_value.items():
406
385
  self.assertEqual(resolve_pointer(doc, path, default), expected_value)
407
386
 
408
387
  def test_mock_dict_raises_key_error(self):
jsonpointer-2.4/setup.cfg DELETED
@@ -1,7 +0,0 @@
1
- [bdist_wheel]
2
- universal = 1
3
-
4
- [egg_info]
5
- tag_build =
6
- tag_date = 0
7
-
File without changes
File without changes
File without changes