File tree Expand file tree Collapse file tree 2 files changed +5
-27
lines changed Expand file tree Collapse file tree 2 files changed +5
-27
lines changed Original file line number Diff line number Diff line change 61
61
basestring = (bytes , str ) # pylint: disable=C0103,W0622
62
62
63
63
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
+
64
69
class JsonPatchException (Exception ):
65
70
"""Base Json Patch exception"""
66
71
@@ -96,27 +101,6 @@ def multidict(ordered_pairs):
96
101
)
97
102
98
103
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
-
120
104
def apply_patch (doc , patch , in_place = False ):
121
105
"""Apply list of patches to specified json document.
122
106
Original file line number Diff line number Diff line change 23
23
)
24
24
25
25
REQUIREMENTS = list (open ('requirements.txt' ))
26
- if sys .version_info < (2 , 6 ):
27
- REQUIREMENTS += ['simplejson' ]
28
26
29
27
if has_setuptools :
30
28
OPTIONS = {
31
29
'install_requires' : REQUIREMENTS
32
30
}
33
31
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' )
37
32
OPTIONS = {}
38
33
39
34
AUTHOR_EMAIL = metadata ['author' ]
61
56
'Operating System :: OS Independent' ,
62
57
'Programming Language :: Python' ,
63
58
'Programming Language :: Python :: 2' ,
64
- 'Programming Language :: Python :: 2.6' ,
65
59
'Programming Language :: Python :: 2.7' ,
66
60
'Programming Language :: Python :: 3' ,
67
61
'Programming Language :: Python :: 3.3' ,
You can’t perform that action at this time.
0 commit comments