def __init__(self, **kw_args):
"""Compose the standard JSONDecoder with a custom object_hook.
The custom object_hook will recognize a dictionary that represents
a ClientData object, and decode it as a ClientData object. All other
objects will get passed to the standard JSONDecoder.
Args:
Same arguments as JSONDecoder.__init__() with the exception that
'strict' is always set to False. If an 'object_hook' is supplied
then it will be called by _object_decode() if the object is
not interpreted as ClientData.
"""
self._other_object_hook = None
kw_args_new = kw_args.copy()
if 'object_hook' in kw_args:
self._other_object_hook = kw_args['object_hook']
kw_args_new['object_hook'] = self._object_decode
# Note: strict=False because the notes attribute might contain
# line feeds.
#
kw_args_new['strict'] = False
self._decoder = json.JSONDecoder(**kw_args_new)
评论列表
文章目录