MCPcopy
hub / github.com/waditu/tushare / try_encode_default

Method try_encode_default

tushare/util/demjson.py:5354–5367  ·  view source on GitHub ↗
( self, obj, state )

Source from the content-addressed store, hash-verified

5352 return False
5353
5354 def try_encode_default( self, obj, state ):
5355 orig_obj = obj
5356 if self.has_hook('encode_default'):
5357 try:
5358 obj = self.call_hook( 'encode_default', obj )
5359 except JSONSkipHook:
5360 pass
5361 else:
5362 if obj is not orig_obj:
5363 # Hook made a transformation, re-encode it
5364 return self._do_encode( obj, state )
5365
5366 # End of the road.
5367 raise JSONEncodeError('can not encode object into a JSON representation',obj)
5368
5369
5370# ------------------------------

Callers 2

_do_encodeMethod · 0.95
encode_compositeMethod · 0.95

Calls 4

has_hookMethod · 0.95
call_hookMethod · 0.95
_do_encodeMethod · 0.95
JSONEncodeErrorClass · 0.85

Tested by

no test coverage detected