Skip to content

Commit b45fc5a

Browse files
committed
Remove support for Python 2.6
1 parent 4351804 commit b45fc5a

File tree

2 files changed

+5
-27
lines changed

2 files changed

+5
-27
lines changed

jsonpatch.py

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@
6161
basestring = (bytes, str) # pylint: disable=C0103,W0622
6262

6363

64+
# The "object_pairs_hook" parameter is used to handle duplicate keys when
65+
# loading a JSON object.
66+
json.load = functools.partial(json.load, object_pairs_hook=multidict)
67+
68+
6469
class JsonPatchException(Exception):
6570
"""Base Json Patch exception"""
6671

@@ -96,27 +101,6 @@ def multidict(ordered_pairs):
96101
)
97102

98103

99-
def get_loadjson():
100-
""" adds the object_pairs_hook parameter to json.load when possible
101-
102-
The "object_pairs_hook" parameter is used to handle duplicate keys when
103-
loading a JSON object. This parameter does not exist in Python 2.6. This
104-
methods returns an unmodified json.load for Python 2.6 and a partial
105-
function with object_pairs_hook set to multidict for Python versions that
106-
support the parameter. """
107-
108-
if sys.version_info >= (3, 3):
109-
args = inspect.signature(json.load).parameters
110-
else:
111-
args = inspect.getargspec(json.load).args
112-
if 'object_pairs_hook' not in args:
113-
return json.load
114-
115-
return functools.partial(json.load, object_pairs_hook=multidict)
116-
117-
json.load = get_loadjson()
118-
119-
120104
def apply_patch(doc, patch, in_place=False):
121105
"""Apply list of patches to specified json document.
122106

setup.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,12 @@
2323
)
2424

2525
REQUIREMENTS = list(open('requirements.txt'))
26-
if sys.version_info < (2, 6):
27-
REQUIREMENTS += ['simplejson']
2826

2927
if has_setuptools:
3028
OPTIONS = {
3129
'install_requires': REQUIREMENTS
3230
}
3331
else:
34-
if sys.version_info < (2, 6):
35-
warnings.warn('No setuptools installed. Be sure that you have '
36-
'json or simplejson package installed')
3732
OPTIONS = {}
3833

3934
AUTHOR_EMAIL = metadata['author']
@@ -61,7 +56,6 @@
6156
'Operating System :: OS Independent',
6257
'Programming Language :: Python',
6358
'Programming Language :: Python :: 2',
64-
'Programming Language :: Python :: 2.6',
6559
'Programming Language :: Python :: 2.7',
6660
'Programming Language :: Python :: 3',
6761
'Programming Language :: Python :: 3.3',

0 commit comments

Comments
 (0)