jsonpointer 3.5__py3-none-any.whl → 3.7__py3-none-any.whl

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.
@@ -58,7 +58,13 @@ def parse_pointer(args):
58
58
  ptr = args.pointer
59
59
  else:
60
60
  # 2026-10-11: Trim file line endings without changing member names.
61
- ptr = args.pointer_file.read().rstrip("\r\n")
61
+ try:
62
+ ptr = args.pointer_file.read().rstrip("\r\n")
63
+ except UnicodeDecodeError as e:
64
+ parser.error('could not decode pointer file: %s' % e)
65
+ finally:
66
+ if args.pointer_file is not sys.stdin:
67
+ args.pointer_file.close()
62
68
 
63
69
  elif args.POINTER is not None:
64
70
  ptr = args.POINTER
@@ -101,6 +107,9 @@ def resolve_files():
101
107
  file=sys.stderr)
102
108
  ok = False
103
109
  continue
110
+ finally:
111
+ if f is not sys.stdin:
112
+ f.close()
104
113
 
105
114
  try:
106
115
  result = jsonpointer.resolve_pointer(doc, ptr)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: jsonpointer
3
- Version: 3.5
3
+ Version: 3.7
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
@@ -0,0 +1,8 @@
1
+ jsonpointer.py,sha256=4TOqZJXwWYuWlVzJZXjMn2Uss7lJVMVtIf0DozdsOYE,14476
2
+ jsonpointer-3.7.data/scripts/jsonpointer,sha256=XYDDaXnhkb3nANXqdn9OUKtVwSqsOZ8TDgXeawe_O7Y,4102
3
+ jsonpointer-3.7.dist-info/licenses/AUTHORS,sha256=TVgxnQ9ZyHvvWwez_k2w8ZwtfVVFsDTGv3tXyJu-9X8,113
4
+ jsonpointer-3.7.dist-info/licenses/LICENSE.txt,sha256=2LJPFdRyiF94ii1umFhQ8mRie4YBKhe7JCyD8xDZB-U,1413
5
+ jsonpointer-3.7.dist-info/METADATA,sha256=WIVhLh9Vp1aquJuk449r0ydERhPbLNCoTvuv2qeSKX4,2638
6
+ jsonpointer-3.7.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
7
+ jsonpointer-3.7.dist-info/top_level.txt,sha256=BsUcar_C0nZzPGV2ackrJ9CpVU8_0W_pHYKwpdnWddM,12
8
+ jsonpointer-3.7.dist-info/RECORD,,
jsonpointer.py CHANGED
@@ -32,7 +32,7 @@
32
32
 
33
33
  # Will be parsed by setup.py to determine package metadata
34
34
  __author__ = 'Stefan Kögl <stefan@skoegl.net>'
35
- __version__ = '3.5'
35
+ __version__ = '3.7'
36
36
  __website__ = 'https://github.com/stefankoegl/python-json-pointer'
37
37
  __license__ = 'Modified BSD License'
38
38
 
@@ -349,11 +349,34 @@ class JsonPointer:
349
349
  raise JsonPointerException("member '%s' not found" % (part,))
350
350
 
351
351
  def contains(self, ptr):
352
- """ Returns True if self contains the given ptr """
352
+ """Returns True if ptr's parts are a prefix of this pointer's parts.
353
+
354
+ Equal pointers and the root pointer are also prefixes. For example,
355
+ the longer pointer calls contains() with its parent:
356
+
357
+ >>> child = JsonPointer('/foo/bar')
358
+ >>> parent = JsonPointer('/foo')
359
+ >>> child.contains(parent)
360
+ True
361
+ >>> parent.contains(child)
362
+ False
363
+ >>> child.contains(child)
364
+ True
365
+ >>> child.contains(JsonPointer(''))
366
+ True
367
+ >>> child.contains(JsonPointer('/foo/b'))
368
+ False
369
+ """
353
370
  return self.parts[:len(ptr.parts)] == ptr.parts
354
371
 
355
372
  def __contains__(self, item):
356
- """ Returns True if self contains the given ptr """
373
+ """Equivalent to contains(): item must be a prefix of self.
374
+
375
+ >>> JsonPointer('/foo') in JsonPointer('/foo/bar')
376
+ True
377
+ >>> JsonPointer('/foo/bar') in JsonPointer('/foo')
378
+ False
379
+ """
357
380
  return self.contains(item)
358
381
 
359
382
  def join(self, suffix):
@@ -1,8 +0,0 @@
1
- jsonpointer.py,sha256=dFHxeOtzfd-YxA3XWqxlXu1B4Wwyuw_I1N5-mw6MyrQ,13792
2
- jsonpointer-3.5.data/scripts/jsonpointer,sha256=0P7f_Zh8LYchFYM-rucHmwJdWCfB-mMVBx_bh6DrA_E,3767
3
- jsonpointer-3.5.dist-info/licenses/AUTHORS,sha256=TVgxnQ9ZyHvvWwez_k2w8ZwtfVVFsDTGv3tXyJu-9X8,113
4
- jsonpointer-3.5.dist-info/licenses/LICENSE.txt,sha256=2LJPFdRyiF94ii1umFhQ8mRie4YBKhe7JCyD8xDZB-U,1413
5
- jsonpointer-3.5.dist-info/METADATA,sha256=8WPgQnSCa23SU-kWBz4SWfXW5zX1nyv7DItJ_SkVdGQ,2638
6
- jsonpointer-3.5.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
7
- jsonpointer-3.5.dist-info/top_level.txt,sha256=BsUcar_C0nZzPGV2ackrJ9CpVU8_0W_pHYKwpdnWddM,12
8
- jsonpointer-3.5.dist-info/RECORD,,