Skip to content

Commit e6844d7

Browse files
authored
Merge branch 'master' into test-py313and314
2 parents e0c4593 + 0e9ea50 commit e6844d7

File tree

10 files changed

+43
-46
lines changed

10 files changed

+43
-46
lines changed

.github/workflows/test.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ jobs:
1919
with:
2020
ref: ${{ github.ref }}
2121

22-
- name: Set up Python 3.12
22+
- name: Set up Python 3.13
2323
uses: actions/setup-python@v5
2424
with:
25-
python-version: 3.12
25+
python-version: 3.13
2626
allow-prereleases: true
2727
- name: Install dependencies
2828
run: |
@@ -39,7 +39,7 @@ jobs:
3939
strategy:
4040
fail-fast: false
4141
matrix:
42-
python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13", "3.14" ]
42+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14" ]
4343

4444
steps:
4545
- uses: actions/checkout@v4

.readthedocs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ version: 2
99
build:
1010
os: ubuntu-22.04
1111
tools:
12-
python: "3.11"
12+
python: "3.13"
1313

1414
# Build documentation in the docs/ directory with Sphinx
1515
sphinx:

bin/jsonpointer

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#!/usr/bin/env python
2-
# -*- coding: utf-8 -*-
1+
#!/usr/bin/env python3
32

43

54
import argparse

doc/conf.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
#
32
# python-json-pointer documentation build configuration file, created by
43
# sphinx-quickstart on Sat Apr 13 16:52:59 2013.
@@ -11,7 +10,8 @@
1110
# All configuration values have a default; values that are commented out
1211
# serve to show the default.
1312

14-
import sys, os
13+
import os
14+
import sys
1515

1616
# If extensions (or modules to document with autodoc) are in another directory,
1717
# add these directories to sys.path here. If the directory is relative to the
@@ -42,7 +42,7 @@
4242
master_doc = 'index'
4343

4444
# General information about the project.
45-
project = u'python-json-pointer'
45+
project = 'python-json-pointer'
4646
copyright = jsonpointer.__author__
4747

4848
# The version info for the project you're documenting, acts as replacement for
@@ -186,8 +186,8 @@
186186
# Grouping the document tree into LaTeX files. List of tuples
187187
# (source start file, target name, title, author, documentclass [howto/manual]).
188188
latex_documents = [
189-
('index', 'python-json-pointer.tex', u'python-json-pointer Documentation',
190-
u'Stefan Kögl', 'manual'),
189+
('index', 'python-json-pointer.tex', 'python-json-pointer Documentation',
190+
'Stefan Kögl', 'manual'),
191191
]
192192

193193
# The name of an image file (relative to this directory) to place at the top of
@@ -216,8 +216,8 @@
216216
# One entry per manual page. List of tuples
217217
# (source start file, name, description, authors, manual section).
218218
man_pages = [
219-
('index', 'python-json-pointer', u'python-json-pointer Documentation',
220-
[u'Stefan Kögl'], 1)
219+
('index', 'python-json-pointer', 'python-json-pointer Documentation',
220+
['Stefan Kögl'], 1)
221221
]
222222

223223
# If true, show URL addresses after external links.
@@ -230,8 +230,8 @@
230230
# (source start file, target name, title, author,
231231
# dir menu entry, description, category)
232232
texinfo_documents = [
233-
('index', 'python-json-pointer', u'python-json-pointer Documentation',
234-
u'Stefan Kögl', 'python-json-pointer', 'One line description of project.',
233+
('index', 'python-json-pointer', 'python-json-pointer Documentation',
234+
'Stefan Kögl', 'python-json-pointer', 'One line description of project.',
235235
'Miscellaneous'),
236236
]
237237

doc/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ python-json-pointer
77
===================
88

99
*python-json-pointer* is a Python library for resolving JSON pointers (`RFC
10-
6901 <http://tools.ietf.org/html/rfc6901>`_). Python 3.9+
10+
6901 <http://tools.ietf.org/html/rfc6901>`_). Python 3.10+
1111
and PyPy are supported.
1212

1313
**Contents**

jsonpointer.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
#
31
# python-json-pointer - An implementation of the JSON Pointer syntax
42
# https://github.com/stefankoegl/python-json-pointer
53
#
@@ -34,7 +32,7 @@
3432

3533
# Will be parsed by setup.py to determine package metadata
3634
__author__ = 'Stefan Kögl <stefan@skoegl.net>'
37-
__version__ = '3.0.0'
35+
__version__ = '3.1.0'
3836
__website__ = 'https://github.com/stefankoegl/python-json-pointer'
3937
__license__ = 'Modified BSD License'
4038

@@ -136,7 +134,7 @@ class JsonPointerException(Exception):
136134
pass
137135

138136

139-
class EndOfList(object):
137+
class EndOfList:
140138
"""Result of accessing element "-" of a list"""
141139

142140
def __init__(self, list_):
@@ -147,7 +145,7 @@ def __repr__(self):
147145
lst=repr(self.list_))
148146

149147

150-
class JsonPointer(object):
148+
class JsonPointer:
151149
"""A JSON Pointer that can reference parts of a JSON document"""
152150

153151
# Array indices must not contain:
@@ -230,7 +228,7 @@ def get_part(cls, doc, part):
230228
if part == '-':
231229
return part
232230

233-
if not JsonPointer._RE_ARRAY_INDEX.match(str(part)):
231+
if not JsonPointer._RE_ARRAY_INDEX.fullmatch(str(part)):
234232
raise JsonPointerException("'%s' is not a valid sequence index" % part)
235233

236234
return int(part)
@@ -294,7 +292,7 @@ def join(self, suffix):
294292
except: # noqa E722
295293
raise JsonPointerException("Invalid suffix")
296294

297-
def __truediv__(self, suffix): # Python 3
295+
def __truediv__(self, suffix):
298296
return self.join(suffix)
299297

300298
@property

makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ help:
66
@echo " - coverage: run tests with coverage"
77
@echo
88
@echo "To install jsonpointer, type"
9-
@echo " python setup.py install"
9+
@echo " python3 setup.py install"
1010
@echo
1111

1212
test:
13-
python -munittest
13+
python3 -munittest
1414

1515
coverage:
1616
coverage run --source=jsonpointer tests.py

setup.cfg

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
[bdist_wheel]
2-
universal = 1
3-
41
[flake8]
52
max-line-length = 120
63
exclude = .git,.tox,dist,doc,*egg,build,.venv

setup.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
'Operating System :: OS Independent',
3939
'Programming Language :: Python',
4040
'Programming Language :: Python :: 3',
41-
'Programming Language :: Python :: 3.9',
4241
'Programming Language :: Python :: 3.10',
4342
'Programming Language :: Python :: 3.11',
4443
'Programming Language :: Python :: 3.12',
@@ -50,17 +49,18 @@
5049
'Topic :: Utilities',
5150
]
5251

53-
setup(name=PACKAGE,
54-
version=VERSION,
55-
description=DESCRIPTION,
56-
long_description=long_description,
57-
long_description_content_type="text/markdown",
58-
author=AUTHOR,
59-
author_email=EMAIL,
60-
license=LICENSE,
61-
url=WEBSITE,
62-
py_modules=MODULES,
63-
scripts=['bin/jsonpointer'],
64-
classifiers=CLASSIFIERS,
65-
python_requires='>=3.9',
66-
)
52+
setup(
53+
name=PACKAGE,
54+
version=VERSION,
55+
description=DESCRIPTION,
56+
long_description=long_description,
57+
long_description_content_type="text/markdown",
58+
author=AUTHOR,
59+
author_email=EMAIL,
60+
license=LICENSE,
61+
url=WEBSITE,
62+
py_modules=MODULES,
63+
scripts=['bin/jsonpointer'],
64+
classifiers=CLASSIFIERS,
65+
python_requires='>=3.10',
66+
)

tests.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env python
2-
# -*- coding: utf-8 -*-
32

43
import copy
54
import doctest
@@ -216,6 +215,10 @@ def test_trailing_escape(self):
216215
def test_invalid_escape(self):
217216
self.assertRaises(JsonPointerException, JsonPointer, '/foo/bar~2')
218217

218+
def test_leading_zero(self):
219+
doc = [0, 1, 2]
220+
self.assertRaises(JsonPointerException, resolve_pointer, doc, '/01')
221+
219222

220223
class ToLastTests(unittest.TestCase):
221224

@@ -370,7 +373,7 @@ def test_mock_dict_sanity(self):
370373
'/root/1/2': '3',
371374
}
372375

373-
for path, expected_value in iter(path_to_expected_value.items()):
376+
for path, expected_value in path_to_expected_value.items():
374377
self.assertEqual(resolve_pointer(doc, path, default), expected_value)
375378

376379
def test_mock_dict_returns_default(self):
@@ -382,7 +385,7 @@ def test_mock_dict_returns_default(self):
382385
'/x/y/z/d': default
383386
}
384387

385-
for path, expected_value in iter(path_to_expected_value.items()):
388+
for path, expected_value in path_to_expected_value.items():
386389
self.assertEqual(resolve_pointer(doc, path, default), expected_value)
387390

388391
def test_mock_dict_raises_key_error(self):

0 commit comments

Comments
 (0)