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 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+
6469class 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-
120104def apply_patch (doc , patch , in_place = False ):
121105 """Apply list of patches to specified json document.
122106
Original file line number Diff line number Diff line change 2323)
2424
2525REQUIREMENTS = list (open ('requirements.txt' ))
26- if sys .version_info < (2 , 6 ):
27- REQUIREMENTS += ['simplejson' ]
2826
2927if has_setuptools :
3028 OPTIONS = {
3129 'install_requires' : REQUIREMENTS
3230 }
3331else :
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
3934AUTHOR_EMAIL = metadata ['author' ]
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' ,
You can’t perform that action at this time.
0 commit comments