jsonpointer 3.10__tar.gz → 3.12__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.
- jsonpointer-3.12/.coveragerc +12 -0
- jsonpointer-3.12/MANIFEST.in +11 -0
- {jsonpointer-3.10/jsonpointer.egg-info → jsonpointer-3.12}/PKG-INFO +11 -10
- {jsonpointer-3.10 → jsonpointer-3.12}/README.md +7 -6
- {jsonpointer-3.10 → jsonpointer-3.12}/bin/jsonpointer +28 -15
- jsonpointer-3.12/doc/Makefile +153 -0
- {jsonpointer-3.10 → jsonpointer-3.12}/doc/commandline.rst +5 -5
- jsonpointer-3.12/doc/conf.py +47 -0
- {jsonpointer-3.10 → jsonpointer-3.12}/doc/index.rst +2 -2
- {jsonpointer-3.10 → jsonpointer-3.12}/doc/mod-jsonpointer.rst +2 -2
- jsonpointer-3.12/doc/requirements.txt +1 -0
- {jsonpointer-3.10 → jsonpointer-3.12}/doc/tutorial.rst +4 -4
- {jsonpointer-3.10 → jsonpointer-3.12}/jsonpointer-stubs/__init__.pyi +2 -1
- {jsonpointer-3.10 → jsonpointer-3.12/jsonpointer.egg-info}/PKG-INFO +11 -10
- {jsonpointer-3.10 → jsonpointer-3.12}/jsonpointer.egg-info/SOURCES.txt +7 -0
- {jsonpointer-3.10 → jsonpointer-3.12}/jsonpointer.py +20 -25
- jsonpointer-3.12/makefile +17 -0
- jsonpointer-3.12/pyproject.toml +3 -0
- jsonpointer-3.12/requirements-dev.txt +2 -0
- {jsonpointer-3.10 → jsonpointer-3.12}/setup.py +5 -6
- {jsonpointer-3.10 → jsonpointer-3.12}/tests.py +48 -0
- jsonpointer-3.10/MANIFEST.in +0 -6
- {jsonpointer-3.10 → jsonpointer-3.12}/AUTHORS +0 -0
- {jsonpointer-3.10 → jsonpointer-3.12}/LICENSE.txt +0 -0
- {jsonpointer-3.10 → jsonpointer-3.12}/jsonpointer.egg-info/dependency_links.txt +0 -0
- {jsonpointer-3.10 → jsonpointer-3.12}/jsonpointer.egg-info/top_level.txt +0 -0
- {jsonpointer-3.10 → jsonpointer-3.12}/setup.cfg +0 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
include AUTHORS
|
|
2
|
+
include LICENSE.txt
|
|
3
|
+
include makefile
|
|
4
|
+
include requirements-dev.txt
|
|
5
|
+
include .coveragerc
|
|
6
|
+
include tests.py
|
|
7
|
+
include doc/*.rst
|
|
8
|
+
include doc/conf.py
|
|
9
|
+
include doc/Makefile
|
|
10
|
+
include doc/requirements.txt
|
|
11
|
+
recursive-include jsonpointer-stubs *.pyi
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: jsonpointer
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.12
|
|
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
|
-
License:
|
|
8
|
+
License-Expression: BSD-3-Clause
|
|
9
9
|
Classifier: Development Status :: 5 - Production/Stable
|
|
10
10
|
Classifier: Environment :: Console
|
|
11
11
|
Classifier: Intended Audience :: Developers
|
|
12
|
-
Classifier: License :: OSI Approved :: BSD License
|
|
13
12
|
Classifier: Operating System :: OS Independent
|
|
14
13
|
Classifier: Programming Language :: Python
|
|
15
14
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -18,6 +17,7 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
18
17
|
Classifier: Programming Language :: Python :: 3.12
|
|
19
18
|
Classifier: Programming Language :: Python :: 3.13
|
|
20
19
|
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
21
21
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
22
22
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
23
23
|
Classifier: Topic :: Software Development :: Libraries
|
|
@@ -33,16 +33,16 @@ Dynamic: classifier
|
|
|
33
33
|
Dynamic: description
|
|
34
34
|
Dynamic: description-content-type
|
|
35
35
|
Dynamic: home-page
|
|
36
|
-
Dynamic: license
|
|
37
36
|
Dynamic: license-file
|
|
37
|
+
Dynamic: license-expression
|
|
38
38
|
Dynamic: requires-python
|
|
39
39
|
Dynamic: summary
|
|
40
40
|
|
|
41
41
|
python-json-pointer
|
|
42
42
|
===================
|
|
43
43
|
|
|
44
|
-
[](https://pypi.
|
|
45
|
-
[](https://pypi.
|
|
44
|
+
[](https://pypi.org/project/jsonpointer/)
|
|
45
|
+
[](https://pypi.org/project/jsonpointer/)
|
|
46
46
|
[](https://github.com/stefankoegl/python-json-pointer/actions/workflows/test.yaml)
|
|
47
47
|
[](https://coveralls.io/github/stefankoegl/python-json-pointer?branch=master)
|
|
48
48
|
|
|
@@ -51,12 +51,13 @@ Resolve JSON Pointers in Python
|
|
|
51
51
|
-------------------------------
|
|
52
52
|
|
|
53
53
|
Library to resolve JSON Pointers according to
|
|
54
|
-
[RFC 6901](
|
|
54
|
+
[RFC 6901](https://datatracker.ietf.org/doc/html/rfc6901)
|
|
55
|
+
|
|
56
|
+
See the documentation for examples.
|
|
55
57
|
|
|
56
|
-
See source code for examples
|
|
57
58
|
* Website: https://github.com/stefankoegl/python-json-pointer
|
|
58
59
|
* Repository: https://github.com/stefankoegl/python-json-pointer.git
|
|
59
|
-
* Documentation: https://python-json-pointer.readthedocs.
|
|
60
|
-
* PyPI: https://pypi.
|
|
60
|
+
* Documentation: https://python-json-pointer.readthedocs.io/
|
|
61
|
+
* PyPI: https://pypi.org/project/jsonpointer/
|
|
61
62
|
* GitHub Actions: https://github.com/stefankoegl/python-json-pointer/actions
|
|
62
63
|
* Coveralls: https://coveralls.io/github/stefankoegl/python-json-pointer
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
python-json-pointer
|
|
2
2
|
===================
|
|
3
3
|
|
|
4
|
-
[](https://pypi.
|
|
5
|
-
[](https://pypi.
|
|
4
|
+
[](https://pypi.org/project/jsonpointer/)
|
|
5
|
+
[](https://pypi.org/project/jsonpointer/)
|
|
6
6
|
[](https://github.com/stefankoegl/python-json-pointer/actions/workflows/test.yaml)
|
|
7
7
|
[](https://coveralls.io/github/stefankoegl/python-json-pointer?branch=master)
|
|
8
8
|
|
|
@@ -11,12 +11,13 @@ Resolve JSON Pointers in Python
|
|
|
11
11
|
-------------------------------
|
|
12
12
|
|
|
13
13
|
Library to resolve JSON Pointers according to
|
|
14
|
-
[RFC 6901](
|
|
14
|
+
[RFC 6901](https://datatracker.ietf.org/doc/html/rfc6901)
|
|
15
|
+
|
|
16
|
+
See the documentation for examples.
|
|
15
17
|
|
|
16
|
-
See source code for examples
|
|
17
18
|
* Website: https://github.com/stefankoegl/python-json-pointer
|
|
18
19
|
* Repository: https://github.com/stefankoegl/python-json-pointer.git
|
|
19
|
-
* Documentation: https://python-json-pointer.readthedocs.
|
|
20
|
-
* PyPI: https://pypi.
|
|
20
|
+
* Documentation: https://python-json-pointer.readthedocs.io/
|
|
21
|
+
* PyPI: https://pypi.org/project/jsonpointer/
|
|
21
22
|
* GitHub Actions: https://github.com/stefankoegl/python-json-pointer/actions
|
|
22
23
|
* Coveralls: https://coveralls.io/github/stefankoegl/python-json-pointer
|
|
@@ -13,7 +13,7 @@ parser = argparse.ArgumentParser(
|
|
|
13
13
|
# Accept pointer as option, as file or as first positional argument
|
|
14
14
|
ptr_group = parser.add_mutually_exclusive_group()
|
|
15
15
|
|
|
16
|
-
ptr_group.add_argument('-f', '--pointer-file', type=
|
|
16
|
+
ptr_group.add_argument('-f', '--pointer-file', type=str,
|
|
17
17
|
help='File containing a JSON pointer expression')
|
|
18
18
|
|
|
19
19
|
ptr_group.add_argument('-p', '--pointer', type=str,
|
|
@@ -37,14 +37,28 @@ def main():
|
|
|
37
37
|
try:
|
|
38
38
|
ok = resolve_files()
|
|
39
39
|
except KeyboardInterrupt:
|
|
40
|
-
|
|
40
|
+
# Conventional status for termination by SIGINT (128 + 2)
|
|
41
|
+
sys.exit(130)
|
|
41
42
|
|
|
42
43
|
if not ok:
|
|
43
44
|
sys.exit(1)
|
|
44
45
|
|
|
45
46
|
|
|
47
|
+
def open_input(name):
|
|
48
|
+
""" Open a UTF-8 input file, or return stdin for "-"
|
|
49
|
+
|
|
50
|
+
Exits with a usage error if the file cannot be opened. """
|
|
51
|
+
if name == '-':
|
|
52
|
+
return sys.stdin
|
|
53
|
+
|
|
54
|
+
try:
|
|
55
|
+
return open(name, encoding='utf-8')
|
|
56
|
+
except OSError as e:
|
|
57
|
+
parser.error("can't open '%s': %s" % (name, e))
|
|
58
|
+
|
|
59
|
+
|
|
46
60
|
def parse_pointer(args):
|
|
47
|
-
""" Return the pointer and the list of files to resolve it on
|
|
61
|
+
""" Return the parsed pointer and the list of files to resolve it on
|
|
48
62
|
|
|
49
63
|
If the pointer is given via -f or -p, a POINTER positional argument is
|
|
50
64
|
actually the first file. """
|
|
@@ -57,14 +71,16 @@ def parse_pointer(args):
|
|
|
57
71
|
if args.pointer is not None:
|
|
58
72
|
ptr = args.pointer
|
|
59
73
|
else:
|
|
60
|
-
#
|
|
74
|
+
# Strip only the trailing line ending; other whitespace may be
|
|
75
|
+
# part of a member name.
|
|
76
|
+
pointer_file = open_input(args.pointer_file)
|
|
61
77
|
try:
|
|
62
|
-
ptr =
|
|
78
|
+
ptr = pointer_file.read().rstrip("\r\n")
|
|
63
79
|
except UnicodeDecodeError as e:
|
|
64
80
|
parser.error('could not decode pointer file: %s' % e)
|
|
65
81
|
finally:
|
|
66
|
-
if
|
|
67
|
-
|
|
82
|
+
if pointer_file is not sys.stdin:
|
|
83
|
+
pointer_file.close()
|
|
68
84
|
|
|
69
85
|
elif args.POINTER is not None:
|
|
70
86
|
ptr = args.POINTER
|
|
@@ -75,11 +91,11 @@ def parse_pointer(args):
|
|
|
75
91
|
# Catches e.g. `jsonpointer a.json b.json`, where the pointer was omitted
|
|
76
92
|
# and the first file would otherwise be used as the pointer
|
|
77
93
|
try:
|
|
78
|
-
jsonpointer.JsonPointer(ptr)
|
|
94
|
+
pointer = jsonpointer.JsonPointer(ptr)
|
|
79
95
|
except jsonpointer.JsonPointerException as e:
|
|
80
96
|
parser.error('invalid JSON pointer %r: %s' % (ptr, e))
|
|
81
97
|
|
|
82
|
-
return
|
|
98
|
+
return pointer, files
|
|
83
99
|
|
|
84
100
|
|
|
85
101
|
def resolve_files():
|
|
@@ -89,14 +105,11 @@ def resolve_files():
|
|
|
89
105
|
or if --continue-on-error skipped a JSON or text decoding error. """
|
|
90
106
|
args = parser.parse_args()
|
|
91
107
|
|
|
92
|
-
|
|
108
|
+
pointer, files = parse_pointer(args)
|
|
93
109
|
ok = True
|
|
94
110
|
|
|
95
111
|
for name in files:
|
|
96
|
-
|
|
97
|
-
f = argparse.FileType('r', encoding='utf-8')(name)
|
|
98
|
-
except argparse.ArgumentTypeError as e:
|
|
99
|
-
parser.error(str(e))
|
|
112
|
+
f = open_input(name)
|
|
100
113
|
|
|
101
114
|
try:
|
|
102
115
|
doc = json.load(f)
|
|
@@ -112,7 +125,7 @@ def resolve_files():
|
|
|
112
125
|
f.close()
|
|
113
126
|
|
|
114
127
|
try:
|
|
115
|
-
result =
|
|
128
|
+
result = pointer.resolve(doc)
|
|
116
129
|
if isinstance(result, jsonpointer.EndOfList):
|
|
117
130
|
raise jsonpointer.JsonPointerException(
|
|
118
131
|
"'-' does not reference an existing array element")
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
# Makefile for Sphinx documentation
|
|
2
|
+
#
|
|
3
|
+
|
|
4
|
+
# You can set these variables from the command line.
|
|
5
|
+
SPHINXOPTS =
|
|
6
|
+
SPHINXBUILD = sphinx-build
|
|
7
|
+
PAPER =
|
|
8
|
+
BUILDDIR = _build
|
|
9
|
+
|
|
10
|
+
# Internal variables.
|
|
11
|
+
PAPEROPT_a4 = -D latex_paper_size=a4
|
|
12
|
+
PAPEROPT_letter = -D latex_paper_size=letter
|
|
13
|
+
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
|
|
14
|
+
# the i18n builder cannot share the environment and doctrees with the others
|
|
15
|
+
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
|
|
16
|
+
|
|
17
|
+
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
|
|
18
|
+
|
|
19
|
+
help:
|
|
20
|
+
@echo "Please use \`make <target>' where <target> is one of"
|
|
21
|
+
@echo " html to make standalone HTML files"
|
|
22
|
+
@echo " dirhtml to make HTML files named index.html in directories"
|
|
23
|
+
@echo " singlehtml to make a single large HTML file"
|
|
24
|
+
@echo " pickle to make pickle files"
|
|
25
|
+
@echo " json to make JSON files"
|
|
26
|
+
@echo " htmlhelp to make HTML files and a HTML help project"
|
|
27
|
+
@echo " qthelp to make HTML files and a qthelp project"
|
|
28
|
+
@echo " devhelp to make HTML files and a Devhelp project"
|
|
29
|
+
@echo " epub to make an epub"
|
|
30
|
+
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
|
|
31
|
+
@echo " latexpdf to make LaTeX files and run them through pdflatex"
|
|
32
|
+
@echo " text to make text files"
|
|
33
|
+
@echo " man to make manual pages"
|
|
34
|
+
@echo " texinfo to make Texinfo files"
|
|
35
|
+
@echo " info to make Texinfo files and run them through makeinfo"
|
|
36
|
+
@echo " gettext to make PO message catalogs"
|
|
37
|
+
@echo " changes to make an overview of all changed/added/deprecated items"
|
|
38
|
+
@echo " linkcheck to check all external links for integrity"
|
|
39
|
+
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
|
|
40
|
+
|
|
41
|
+
clean:
|
|
42
|
+
-rm -rf $(BUILDDIR)/*
|
|
43
|
+
|
|
44
|
+
html:
|
|
45
|
+
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
|
|
46
|
+
@echo
|
|
47
|
+
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
|
|
48
|
+
|
|
49
|
+
dirhtml:
|
|
50
|
+
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
|
|
51
|
+
@echo
|
|
52
|
+
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
|
|
53
|
+
|
|
54
|
+
singlehtml:
|
|
55
|
+
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
|
|
56
|
+
@echo
|
|
57
|
+
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
|
|
58
|
+
|
|
59
|
+
pickle:
|
|
60
|
+
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
|
|
61
|
+
@echo
|
|
62
|
+
@echo "Build finished; now you can process the pickle files."
|
|
63
|
+
|
|
64
|
+
json:
|
|
65
|
+
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
|
|
66
|
+
@echo
|
|
67
|
+
@echo "Build finished; now you can process the JSON files."
|
|
68
|
+
|
|
69
|
+
htmlhelp:
|
|
70
|
+
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
|
|
71
|
+
@echo
|
|
72
|
+
@echo "Build finished; now you can run HTML Help Workshop with the" \
|
|
73
|
+
".hhp project file in $(BUILDDIR)/htmlhelp."
|
|
74
|
+
|
|
75
|
+
qthelp:
|
|
76
|
+
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
|
|
77
|
+
@echo
|
|
78
|
+
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
|
|
79
|
+
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
|
|
80
|
+
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/python-json-pointer.qhcp"
|
|
81
|
+
@echo "To view the help file:"
|
|
82
|
+
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/python-json-pointer.qhc"
|
|
83
|
+
|
|
84
|
+
devhelp:
|
|
85
|
+
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
|
|
86
|
+
@echo
|
|
87
|
+
@echo "Build finished."
|
|
88
|
+
@echo "To view the help file:"
|
|
89
|
+
@echo "# mkdir -p $$HOME/.local/share/devhelp/python-json-pointer"
|
|
90
|
+
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/python-json-pointer"
|
|
91
|
+
@echo "# devhelp"
|
|
92
|
+
|
|
93
|
+
epub:
|
|
94
|
+
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
|
|
95
|
+
@echo
|
|
96
|
+
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
|
|
97
|
+
|
|
98
|
+
latex:
|
|
99
|
+
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
|
100
|
+
@echo
|
|
101
|
+
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
|
|
102
|
+
@echo "Run \`make' in that directory to run these through (pdf)latex" \
|
|
103
|
+
"(use \`make latexpdf' here to do that automatically)."
|
|
104
|
+
|
|
105
|
+
latexpdf:
|
|
106
|
+
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
|
107
|
+
@echo "Running LaTeX files through pdflatex..."
|
|
108
|
+
$(MAKE) -C $(BUILDDIR)/latex all-pdf
|
|
109
|
+
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
|
|
110
|
+
|
|
111
|
+
text:
|
|
112
|
+
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
|
|
113
|
+
@echo
|
|
114
|
+
@echo "Build finished. The text files are in $(BUILDDIR)/text."
|
|
115
|
+
|
|
116
|
+
man:
|
|
117
|
+
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
|
|
118
|
+
@echo
|
|
119
|
+
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
|
|
120
|
+
|
|
121
|
+
texinfo:
|
|
122
|
+
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
|
123
|
+
@echo
|
|
124
|
+
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
|
|
125
|
+
@echo "Run \`make' in that directory to run these through makeinfo" \
|
|
126
|
+
"(use \`make info' here to do that automatically)."
|
|
127
|
+
|
|
128
|
+
info:
|
|
129
|
+
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
|
130
|
+
@echo "Running Texinfo files through makeinfo..."
|
|
131
|
+
make -C $(BUILDDIR)/texinfo info
|
|
132
|
+
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
|
|
133
|
+
|
|
134
|
+
gettext:
|
|
135
|
+
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
|
|
136
|
+
@echo
|
|
137
|
+
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
|
|
138
|
+
|
|
139
|
+
changes:
|
|
140
|
+
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
|
|
141
|
+
@echo
|
|
142
|
+
@echo "The overview file is in $(BUILDDIR)/changes."
|
|
143
|
+
|
|
144
|
+
linkcheck:
|
|
145
|
+
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
|
|
146
|
+
@echo
|
|
147
|
+
@echo "Link check complete; look for any errors in the above output " \
|
|
148
|
+
"or in $(BUILDDIR)/linkcheck/output.txt."
|
|
149
|
+
|
|
150
|
+
doctest:
|
|
151
|
+
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
|
|
152
|
+
@echo "Testing of doctests in the sources finished, look at the " \
|
|
153
|
+
"results in $(BUILDDIR)/doctest/output.txt."
|
|
@@ -2,7 +2,7 @@ The ``jsonpointer`` commandline utility
|
|
|
2
2
|
=======================================
|
|
3
3
|
|
|
4
4
|
The JSON pointer package also installs a ``jsonpointer`` commandline utility
|
|
5
|
-
that can be used to resolve a JSON
|
|
5
|
+
that can be used to resolve a JSON pointer on JSON files.
|
|
6
6
|
|
|
7
7
|
The program has the following usage ::
|
|
8
8
|
|
|
@@ -19,9 +19,9 @@ The program has the following usage ::
|
|
|
19
19
|
|
|
20
20
|
options:
|
|
21
21
|
-h, --help show this help message and exit
|
|
22
|
-
-f
|
|
22
|
+
-f, --pointer-file POINTER_FILE
|
|
23
23
|
File containing a JSON pointer expression
|
|
24
|
-
-p
|
|
24
|
+
-p, --pointer POINTER
|
|
25
25
|
A JSON pointer expression
|
|
26
26
|
--indent INDENT Indent output by n spaces
|
|
27
27
|
--continue-on-error Continue with remaining files after JSON or text
|
|
@@ -35,8 +35,8 @@ JSON input files and pointer files are read as UTF-8.
|
|
|
35
35
|
|
|
36
36
|
The exit status is 0 if the pointer could be resolved on all files, 1 if it
|
|
37
37
|
could not be resolved on at least one file (the remaining files are still
|
|
38
|
-
processed)
|
|
39
|
-
file.
|
|
38
|
+
processed), 2 on usage errors, such as an invalid pointer or a missing
|
|
39
|
+
file, and 130 if interrupted with Ctrl-C.
|
|
40
40
|
|
|
41
41
|
By default, invalid JSON or a text decoding error stops processing. With
|
|
42
42
|
``--continue-on-error``, these errors are reported on standard error with
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Sphinx configuration for the python-json-pointer documentation.
|
|
2
|
+
# See https://www.sphinx-doc.org/en/master/usage/configuration.html
|
|
3
|
+
|
|
4
|
+
import os
|
|
5
|
+
import sys
|
|
6
|
+
|
|
7
|
+
# Document the jsonpointer module from this checkout
|
|
8
|
+
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), '..'))
|
|
9
|
+
|
|
10
|
+
import jsonpointer # noqa: E402
|
|
11
|
+
|
|
12
|
+
# -- Project information -------------------------------------------------------
|
|
13
|
+
|
|
14
|
+
project = 'python-json-pointer'
|
|
15
|
+
author = 'Stefan Kögl'
|
|
16
|
+
copyright = jsonpointer.__author__
|
|
17
|
+
version = jsonpointer.__version__
|
|
18
|
+
release = jsonpointer.__version__
|
|
19
|
+
|
|
20
|
+
# -- General configuration -----------------------------------------------------
|
|
21
|
+
|
|
22
|
+
extensions = ['sphinx.ext.autodoc']
|
|
23
|
+
exclude_patterns = ['_build']
|
|
24
|
+
pygments_style = 'sphinx'
|
|
25
|
+
|
|
26
|
+
# -- Options for HTML output ---------------------------------------------------
|
|
27
|
+
|
|
28
|
+
html_theme = 'classic'
|
|
29
|
+
htmlhelp_basename = 'python-json-pointerdoc'
|
|
30
|
+
|
|
31
|
+
# -- Options for other output formats ------------------------------------------
|
|
32
|
+
|
|
33
|
+
latex_documents = [
|
|
34
|
+
('index', 'python-json-pointer.tex', 'python-json-pointer Documentation',
|
|
35
|
+
author, 'manual'),
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
man_pages = [
|
|
39
|
+
('index', 'python-json-pointer', 'python-json-pointer Documentation',
|
|
40
|
+
[author], 1),
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
texinfo_documents = [
|
|
44
|
+
('index', 'python-json-pointer', 'python-json-pointer Documentation',
|
|
45
|
+
author, 'python-json-pointer', jsonpointer.__doc__.strip(),
|
|
46
|
+
'Miscellaneous'),
|
|
47
|
+
]
|
|
@@ -7,7 +7,7 @@ python-json-pointer
|
|
|
7
7
|
===================
|
|
8
8
|
|
|
9
9
|
*python-json-pointer* is a Python library for resolving JSON pointers (`RFC
|
|
10
|
-
6901 <
|
|
10
|
+
6901 <https://datatracker.ietf.org/doc/html/rfc6901>`_). Python 3.10+
|
|
11
11
|
and PyPy are supported.
|
|
12
12
|
|
|
13
13
|
**Contents**
|
|
@@ -18,7 +18,7 @@ and PyPy are supported.
|
|
|
18
18
|
tutorial
|
|
19
19
|
mod-jsonpointer
|
|
20
20
|
commandline
|
|
21
|
-
RFC 6901 <
|
|
21
|
+
RFC 6901 <https://datatracker.ietf.org/doc/html/rfc6901>
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
Indices and tables
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
sphinx==9.2.0
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Tutorial
|
|
2
2
|
========
|
|
3
3
|
|
|
4
|
-
Please refer to `RFC 6901 <
|
|
5
|
-
pointer syntax.
|
|
6
|
-
|
|
4
|
+
Please refer to `RFC 6901 <https://datatracker.ietf.org/doc/html/rfc6901>`_ for the exact
|
|
5
|
+
pointer syntax. The ``resolve_pointer``
|
|
6
|
+
function is basically a deep ``get``.
|
|
7
7
|
|
|
8
8
|
.. code-block:: python
|
|
9
9
|
|
|
@@ -29,7 +29,7 @@ method is basically a deep ``get``.
|
|
|
29
29
|
True
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
The ``set_pointer``
|
|
32
|
+
The ``set_pointer`` function allows modifying a portion of an object using
|
|
33
33
|
JSON pointer notation:
|
|
34
34
|
|
|
35
35
|
.. code-block:: python
|
|
@@ -2,7 +2,7 @@ from collections.abc import Iterable, Iterator
|
|
|
2
2
|
from re import Pattern
|
|
3
3
|
from typing import Any, Final, TypeVar
|
|
4
4
|
|
|
5
|
-
from typing_extensions import Self
|
|
5
|
+
from typing_extensions import Self, deprecated
|
|
6
6
|
|
|
7
7
|
_T = TypeVar("_T")
|
|
8
8
|
|
|
@@ -21,6 +21,7 @@ def set_pointer(
|
|
|
21
21
|
create: bool = False,
|
|
22
22
|
) -> Any: ...
|
|
23
23
|
def resolve_pointer(doc: Any, pointer: str, default: Any = ...) -> Any: ...
|
|
24
|
+
@deprecated("Use itertools.pairwise() instead")
|
|
24
25
|
def pairwise(iterable: Iterable[_T]) -> Iterator[tuple[_T, _T]]: ...
|
|
25
26
|
|
|
26
27
|
class JsonPointerException(Exception): ...
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: jsonpointer
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.12
|
|
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
|
-
License:
|
|
8
|
+
License-Expression: BSD-3-Clause
|
|
9
9
|
Classifier: Development Status :: 5 - Production/Stable
|
|
10
10
|
Classifier: Environment :: Console
|
|
11
11
|
Classifier: Intended Audience :: Developers
|
|
12
|
-
Classifier: License :: OSI Approved :: BSD License
|
|
13
12
|
Classifier: Operating System :: OS Independent
|
|
14
13
|
Classifier: Programming Language :: Python
|
|
15
14
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -18,6 +17,7 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
18
17
|
Classifier: Programming Language :: Python :: 3.12
|
|
19
18
|
Classifier: Programming Language :: Python :: 3.13
|
|
20
19
|
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
21
21
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
22
22
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
23
23
|
Classifier: Topic :: Software Development :: Libraries
|
|
@@ -33,16 +33,16 @@ Dynamic: classifier
|
|
|
33
33
|
Dynamic: description
|
|
34
34
|
Dynamic: description-content-type
|
|
35
35
|
Dynamic: home-page
|
|
36
|
-
Dynamic: license
|
|
37
36
|
Dynamic: license-file
|
|
37
|
+
Dynamic: license-expression
|
|
38
38
|
Dynamic: requires-python
|
|
39
39
|
Dynamic: summary
|
|
40
40
|
|
|
41
41
|
python-json-pointer
|
|
42
42
|
===================
|
|
43
43
|
|
|
44
|
-
[](https://pypi.
|
|
45
|
-
[](https://pypi.
|
|
44
|
+
[](https://pypi.org/project/jsonpointer/)
|
|
45
|
+
[](https://pypi.org/project/jsonpointer/)
|
|
46
46
|
[](https://github.com/stefankoegl/python-json-pointer/actions/workflows/test.yaml)
|
|
47
47
|
[](https://coveralls.io/github/stefankoegl/python-json-pointer?branch=master)
|
|
48
48
|
|
|
@@ -51,12 +51,13 @@ Resolve JSON Pointers in Python
|
|
|
51
51
|
-------------------------------
|
|
52
52
|
|
|
53
53
|
Library to resolve JSON Pointers according to
|
|
54
|
-
[RFC 6901](
|
|
54
|
+
[RFC 6901](https://datatracker.ietf.org/doc/html/rfc6901)
|
|
55
|
+
|
|
56
|
+
See the documentation for examples.
|
|
55
57
|
|
|
56
|
-
See source code for examples
|
|
57
58
|
* Website: https://github.com/stefankoegl/python-json-pointer
|
|
58
59
|
* Repository: https://github.com/stefankoegl/python-json-pointer.git
|
|
59
|
-
* Documentation: https://python-json-pointer.readthedocs.
|
|
60
|
-
* PyPI: https://pypi.
|
|
60
|
+
* Documentation: https://python-json-pointer.readthedocs.io/
|
|
61
|
+
* PyPI: https://pypi.org/project/jsonpointer/
|
|
61
62
|
* GitHub Actions: https://github.com/stefankoegl/python-json-pointer/actions
|
|
62
63
|
* Coveralls: https://coveralls.io/github/stefankoegl/python-json-pointer
|
|
@@ -1,15 +1,22 @@
|
|
|
1
|
+
.coveragerc
|
|
1
2
|
AUTHORS
|
|
2
3
|
LICENSE.txt
|
|
3
4
|
MANIFEST.in
|
|
4
5
|
README.md
|
|
5
6
|
jsonpointer.py
|
|
7
|
+
makefile
|
|
8
|
+
pyproject.toml
|
|
9
|
+
requirements-dev.txt
|
|
6
10
|
setup.cfg
|
|
7
11
|
setup.py
|
|
8
12
|
tests.py
|
|
9
13
|
bin/jsonpointer
|
|
14
|
+
doc/Makefile
|
|
10
15
|
doc/commandline.rst
|
|
16
|
+
doc/conf.py
|
|
11
17
|
doc/index.rst
|
|
12
18
|
doc/mod-jsonpointer.rst
|
|
19
|
+
doc/requirements.txt
|
|
13
20
|
doc/tutorial.rst
|
|
14
21
|
jsonpointer-stubs/__init__.pyi
|
|
15
22
|
jsonpointer.egg-info/PKG-INFO
|
|
@@ -32,14 +32,16 @@
|
|
|
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.
|
|
35
|
+
__version__ = '3.12'
|
|
36
36
|
__website__ = 'https://github.com/stefankoegl/python-json-pointer'
|
|
37
|
-
__license__ = '
|
|
37
|
+
__license__ = 'BSD-3-Clause'
|
|
38
38
|
|
|
39
39
|
import copy
|
|
40
|
+
import itertools
|
|
40
41
|
import re
|
|
42
|
+
import warnings
|
|
41
43
|
from collections.abc import Mapping, Sequence
|
|
42
|
-
from itertools import
|
|
44
|
+
from itertools import chain
|
|
43
45
|
|
|
44
46
|
_nothing = object()
|
|
45
47
|
|
|
@@ -128,19 +130,13 @@ def pairwise(iterable):
|
|
|
128
130
|
|
|
129
131
|
s -> (s0,s1), (s1,s2), (s2, s3), ...
|
|
130
132
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
>>> list(pairwise([1]))
|
|
135
|
-
[]
|
|
136
|
-
|
|
137
|
-
>>> list(pairwise([1, 2, 3, 4]))
|
|
138
|
-
[(1, 2), (2, 3), (3, 4)]
|
|
133
|
+
.. deprecated:: 3.12
|
|
134
|
+
Use :func:`itertools.pairwise` instead.
|
|
139
135
|
"""
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
return
|
|
136
|
+
warnings.warn('jsonpointer.pairwise() is deprecated, '
|
|
137
|
+
'use itertools.pairwise() instead',
|
|
138
|
+
DeprecationWarning, stacklevel=2)
|
|
139
|
+
return itertools.pairwise(iterable)
|
|
144
140
|
|
|
145
141
|
|
|
146
142
|
class JsonPointerException(Exception):
|
|
@@ -163,7 +159,7 @@ class JsonPointer:
|
|
|
163
159
|
|
|
164
160
|
# Array indices must not contain:
|
|
165
161
|
# leading zeros, signs, spaces, decimals, etc
|
|
166
|
-
_RE_ARRAY_INDEX = re.compile('0|[1-9][0-9]
|
|
162
|
+
_RE_ARRAY_INDEX = re.compile('0|[1-9][0-9]*')
|
|
167
163
|
_RE_INVALID_ESCAPE = re.compile('(~[^01]|~$)')
|
|
168
164
|
|
|
169
165
|
def __init__(self, pointer):
|
|
@@ -327,8 +323,6 @@ class JsonPointer:
|
|
|
327
323
|
|
|
328
324
|
part = JsonPointer.get_part(doc, part)
|
|
329
325
|
|
|
330
|
-
assert hasattr(doc, '__getitem__'), "invalid document type %s" % (type(doc),)
|
|
331
|
-
|
|
332
326
|
if isinstance(doc, Sequence):
|
|
333
327
|
if part == '-':
|
|
334
328
|
return EndOfList(doc)
|
|
@@ -387,7 +381,7 @@ class JsonPointer:
|
|
|
387
381
|
return self.contains(item)
|
|
388
382
|
|
|
389
383
|
def join(self, suffix):
|
|
390
|
-
""" Returns a new JsonPointer with the given suffix
|
|
384
|
+
""" Returns a new JsonPointer with the given suffix appended to this ptr """
|
|
391
385
|
if isinstance(suffix, JsonPointer):
|
|
392
386
|
suffix_parts = suffix.parts
|
|
393
387
|
elif isinstance(suffix, str):
|
|
@@ -396,8 +390,8 @@ class JsonPointer:
|
|
|
396
390
|
suffix_parts = suffix
|
|
397
391
|
try:
|
|
398
392
|
return self.__class__.from_parts(chain(self.parts, suffix_parts))
|
|
399
|
-
except Exception:
|
|
400
|
-
raise JsonPointerException("Invalid suffix")
|
|
393
|
+
except Exception as e:
|
|
394
|
+
raise JsonPointerException("Invalid suffix") from e
|
|
401
395
|
|
|
402
396
|
def __truediv__(self, suffix):
|
|
403
397
|
return self.join(suffix)
|
|
@@ -406,7 +400,8 @@ class JsonPointer:
|
|
|
406
400
|
def path(self):
|
|
407
401
|
"""Returns the string representation of the pointer
|
|
408
402
|
|
|
409
|
-
>>>
|
|
403
|
+
>>> JsonPointer('/~0/0/~1').path == '/~0/0/~1'
|
|
404
|
+
True
|
|
410
405
|
"""
|
|
411
406
|
parts = [escape(part) for part in self.parts]
|
|
412
407
|
return ''.join('/' + part for part in parts)
|
|
@@ -414,13 +409,13 @@ class JsonPointer:
|
|
|
414
409
|
def __eq__(self, other):
|
|
415
410
|
"""Compares a pointer to another object
|
|
416
411
|
|
|
417
|
-
Pointers can be compared by comparing their strings (or
|
|
412
|
+
Pointers can be compared by comparing their strings (or split
|
|
418
413
|
strings), because no two different parts can point to the same
|
|
419
414
|
structure in an object (eg no different number representations)
|
|
420
415
|
"""
|
|
421
416
|
|
|
422
417
|
if not isinstance(other, JsonPointer):
|
|
423
|
-
return
|
|
418
|
+
return NotImplemented
|
|
424
419
|
|
|
425
420
|
return self.parts == other.parts
|
|
426
421
|
|
|
@@ -435,7 +430,7 @@ class JsonPointer:
|
|
|
435
430
|
|
|
436
431
|
@classmethod
|
|
437
432
|
def from_parts(cls, parts):
|
|
438
|
-
"""Constructs a JsonPointer from a list of (unescaped)
|
|
433
|
+
"""Constructs a JsonPointer from a list of (unescaped) parts
|
|
439
434
|
|
|
440
435
|
>>> JsonPointer.from_parts(['a', '~', '/', 0]).path == '/a/~0/~1/0'
|
|
441
436
|
True
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
help:
|
|
3
|
+
@echo "jsonpointer"
|
|
4
|
+
@echo "Makefile targets"
|
|
5
|
+
@echo " - test: run tests"
|
|
6
|
+
@echo " - coverage: run tests with coverage"
|
|
7
|
+
@echo
|
|
8
|
+
@echo "To install jsonpointer, type"
|
|
9
|
+
@echo " pip install ."
|
|
10
|
+
@echo
|
|
11
|
+
|
|
12
|
+
test:
|
|
13
|
+
python3 -munittest
|
|
14
|
+
|
|
15
|
+
coverage:
|
|
16
|
+
coverage run --source=jsonpointer -m unittest
|
|
17
|
+
coverage report -m
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
|
|
3
|
-
import io
|
|
4
3
|
import os.path
|
|
5
4
|
import re
|
|
6
5
|
|
|
@@ -8,7 +7,8 @@ from setuptools import setup
|
|
|
8
7
|
|
|
9
8
|
dirname = os.path.dirname(os.path.abspath(__file__))
|
|
10
9
|
filename = os.path.join(dirname, 'jsonpointer.py')
|
|
11
|
-
|
|
10
|
+
with open(filename, encoding='utf-8') as f:
|
|
11
|
+
src = f.read()
|
|
12
12
|
metadata = dict(re.findall("__([a-z]+)__ = '([^']+)'", src))
|
|
13
13
|
docstrings = re.findall('"""(.*)"""', src)
|
|
14
14
|
|
|
@@ -21,20 +21,18 @@ MODULES = (
|
|
|
21
21
|
AUTHOR_EMAIL = metadata['author']
|
|
22
22
|
VERSION = metadata['version']
|
|
23
23
|
WEBSITE = metadata['website']
|
|
24
|
-
LICENSE = metadata['license']
|
|
25
24
|
DESCRIPTION = docstrings[0]
|
|
26
25
|
|
|
27
26
|
# Extract name and e-mail ("Firstname Lastname <mail@example.org>")
|
|
28
27
|
AUTHOR, EMAIL = re.match(r'(.*) <(.*)>', AUTHOR_EMAIL).groups()
|
|
29
28
|
|
|
30
|
-
with open('README.md') as readme:
|
|
29
|
+
with open(os.path.join(dirname, 'README.md'), encoding='utf-8') as readme:
|
|
31
30
|
long_description = readme.read()
|
|
32
31
|
|
|
33
32
|
CLASSIFIERS = [
|
|
34
33
|
'Development Status :: 5 - Production/Stable',
|
|
35
34
|
'Environment :: Console',
|
|
36
35
|
'Intended Audience :: Developers',
|
|
37
|
-
'License :: OSI Approved :: BSD License',
|
|
38
36
|
'Operating System :: OS Independent',
|
|
39
37
|
'Programming Language :: Python',
|
|
40
38
|
'Programming Language :: Python :: 3',
|
|
@@ -43,6 +41,7 @@ CLASSIFIERS = [
|
|
|
43
41
|
'Programming Language :: Python :: 3.12',
|
|
44
42
|
'Programming Language :: Python :: 3.13',
|
|
45
43
|
'Programming Language :: Python :: 3.14',
|
|
44
|
+
'Programming Language :: Python :: 3.15',
|
|
46
45
|
'Programming Language :: Python :: Implementation :: CPython',
|
|
47
46
|
'Programming Language :: Python :: Implementation :: PyPy',
|
|
48
47
|
'Topic :: Software Development :: Libraries',
|
|
@@ -58,7 +57,7 @@ setup(
|
|
|
58
57
|
long_description_content_type="text/markdown",
|
|
59
58
|
author=AUTHOR,
|
|
60
59
|
author_email=EMAIL,
|
|
61
|
-
|
|
60
|
+
license_expression='BSD-3-Clause',
|
|
62
61
|
url=WEBSITE,
|
|
63
62
|
py_modules=MODULES,
|
|
64
63
|
# PEP 561 stub-only package, shipped in the same distribution
|
|
@@ -171,6 +171,23 @@ class ComparisonTests(unittest.TestCase):
|
|
|
171
171
|
# a pointer compares not-equal to objects of other types
|
|
172
172
|
self.assertFalse(p1 == "/something/1/b")
|
|
173
173
|
|
|
174
|
+
def test_other_types_remain_unequal(self):
|
|
175
|
+
for other in ["/a/b/c", None, 1, object()]:
|
|
176
|
+
for left, right in [(self.ptr1, other), (other, self.ptr1)]:
|
|
177
|
+
with self.subTest(left=left, right=right):
|
|
178
|
+
self.assertFalse(left == right)
|
|
179
|
+
self.assertTrue(left != right)
|
|
180
|
+
|
|
181
|
+
def test_reflected_equality(self):
|
|
182
|
+
for left, right in [(self.ptr1, mock.ANY), (mock.ANY, self.ptr1)]:
|
|
183
|
+
with self.subTest(left=left, right=right):
|
|
184
|
+
self.assertTrue(left == right)
|
|
185
|
+
|
|
186
|
+
def test_reflected_inequality(self):
|
|
187
|
+
for left, right in [(self.ptr1, mock.ANY), (mock.ANY, self.ptr1)]:
|
|
188
|
+
with self.subTest(left=left, right=right):
|
|
189
|
+
self.assertFalse(left != right)
|
|
190
|
+
|
|
174
191
|
def test_contains(self):
|
|
175
192
|
self.assertTrue(self.ptr1.contains(self.ptr2))
|
|
176
193
|
self.assertTrue(self.ptr1.contains(self.ptr1))
|
|
@@ -199,6 +216,11 @@ class ComparisonTests(unittest.TestCase):
|
|
|
199
216
|
|
|
200
217
|
self.assertRaises(JsonPointerException, self.ptr1.join, 0)
|
|
201
218
|
|
|
219
|
+
def test_join_chains_original_error(self):
|
|
220
|
+
with self.assertRaises(JsonPointerException) as caught:
|
|
221
|
+
self.ptr1.join(0)
|
|
222
|
+
self.assertIsInstance(caught.exception.__cause__, TypeError)
|
|
223
|
+
|
|
202
224
|
def test_join_magic(self):
|
|
203
225
|
ptr12a = self.ptr1 / self.ptr2
|
|
204
226
|
self.assertEqual(ptr12a.path, "/a/b/c/a/b")
|
|
@@ -290,6 +312,17 @@ class WrongInputTests(unittest.TestCase):
|
|
|
290
312
|
|
|
291
313
|
@unittest.skipUnless(hasattr(sys, 'get_int_max_str_digits'),
|
|
292
314
|
'Integer string conversion limits are not available')
|
|
315
|
+
class PairwiseTests(unittest.TestCase):
|
|
316
|
+
|
|
317
|
+
def test_pairwise_is_deprecated(self):
|
|
318
|
+
for items, expected in (([], []), ([1], []),
|
|
319
|
+
([1, 2, 3, 4], [(1, 2), (2, 3), (3, 4)])):
|
|
320
|
+
with self.subTest(items=items):
|
|
321
|
+
with self.assertWarns(DeprecationWarning):
|
|
322
|
+
result = jsonpointer.pairwise(items)
|
|
323
|
+
self.assertEqual(list(result), expected)
|
|
324
|
+
|
|
325
|
+
|
|
293
326
|
class LargeIndexTests(unittest.TestCase):
|
|
294
327
|
|
|
295
328
|
def setUp(self):
|
|
@@ -738,6 +771,15 @@ class CommandLineTests(unittest.TestCase):
|
|
|
738
771
|
self.assertTrue(cli['resolve_files']())
|
|
739
772
|
self.assertFalse(stdin.closed)
|
|
740
773
|
|
|
774
|
+
def test_keyboard_interrupt_exit_status(self):
|
|
775
|
+
cli = runpy.run_path(self.SCRIPT)
|
|
776
|
+
args = [self.SCRIPT, '/a', os.path.join(self.dir, 'a.json')]
|
|
777
|
+
with mock.patch.object(sys, 'argv', args), \
|
|
778
|
+
mock.patch('json.load', side_effect=KeyboardInterrupt):
|
|
779
|
+
with self.assertRaises(SystemExit) as caught:
|
|
780
|
+
cli['main']()
|
|
781
|
+
self.assertEqual(caught.exception.code, 130)
|
|
782
|
+
|
|
741
783
|
def test_utf8_json_file_without_utf8_mode(self):
|
|
742
784
|
self._write('unicode.json', '{"value": "🚀"}')
|
|
743
785
|
proc = self._run('/value', 'unicode.json', utf8=False)
|
|
@@ -954,6 +996,12 @@ class CommandLineTests(unittest.TestCase):
|
|
|
954
996
|
self.assertEqual(proc.stdout, self.A_OUT)
|
|
955
997
|
self.assertIn('missing.json', proc.stderr)
|
|
956
998
|
|
|
999
|
+
def test_missing_pointer_file(self):
|
|
1000
|
+
proc = self._run('-f', 'missing.txt', 'a.json')
|
|
1001
|
+
self.assertEqual(proc.returncode, 2)
|
|
1002
|
+
self.assertEqual(proc.stdout, '')
|
|
1003
|
+
self.assertIn("can't open 'missing.txt'", proc.stderr)
|
|
1004
|
+
|
|
957
1005
|
def test_pointer_file_requires_value(self):
|
|
958
1006
|
proc = self._run('-f', '-p', '/a', 'a.json')
|
|
959
1007
|
self.assertEqual(proc.returncode, 2)
|
jsonpointer-3.10/MANIFEST.in
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|