B Y- @sdZddlmZddlZddlZddlZddlZy ejZWnek rRe ZYnXGdddej Z ddZ dd Z d d Zed ZdddZed Zd ddZGdddejZGdddejZGdddejZGdddeejZGdddeejZddZeedS)!z raven.utils.json ~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. )absolute_importNc sDeZdZejddejddeeeee ddiZ fddZ Z S)BetterJSONEncodercCs|jS)N)hex)orA/opt/alt/python37/lib/python3.7/site-packages/raven/utils/json.pyzBetterJSONEncoder.cCs |dS)Nz%Y-%m-%dT%H:%M:%SZ)strftime)rrrrrr cCs|jdddS)Nzutf-8replace)errors)decode)rrrrrr c sZy|jt|}Wn>tk rPytt||Stk rJt|SXYnX||S)N)ENCODER_BY_TYPEtypeKeyErrorsuperrdefault TypeErrorrepr)selfobjencoder) __class__rrrszBetterJSONEncoder.default) __name__ __module__ __qualname__uuidUUIDdatetimesetlist frozensetbytesrr __classcell__rr)rrrs    rcCs|S)Nr)datarrrbetter_decoder*sr%cKsJytj|fdti|Stk rDd|d<tj|fdti|SXdS)Nclsz safe-utf-8encoding)jsondumpsr Exception)valuekwargsrrrr).s r)cKstj|tdS)N) object_hook)r(loadsr%)r+r,rrrr.6sr.zutf-8backslashreplacecCs t||S)N) _utf8_encoder)inputr rrr safe_encode=sr2r cCs t||S)N) _utf8_decoder)r1r rrr safe_decodeDsr4c@s eZdZdddZd ddZdS) Codecr/cCs t||S)N)r2)rr1r rrrencodeJsz Codec.encoder cCs t||S)N)r4)rr1r rrrr Msz Codec.decodeN)r/)r )rrrr6r rrrrr5Hs r5c@seZdZdddZdS)IncrementalEncoderFcCst||jdS)Nr)r2r )rr1finalrrrr6RszIncrementalEncoder.encodeN)F)rrrr6rrrrr7Qsr7c@seZdZdddZdS)IncrementalDecoderFcCst||jdS)Nr)r4r )rr1r8rrrr WszIncrementalDecoder.decodeN)F)rrrr rrrrr9Vsr9c@s eZdZdS) StreamWriterN)rrrrrrrr:[sr:c@s eZdZdS) StreamReaderN)rrrrrrrr;_sr;c Cs$|dkr dStjdttttttdS)Nz safe-utf-8)namer6r incrementalencoderincrementaldecoder streamreader streamwriter)codecs CodecInfor2r4r7r9r;r:)r<rrr getregentrycsrC)r/)r )__doc__ __future__rrArrr(JSONDecodeErrorAttributeError ValueError JSONEncoderrr%r)r. getencoderr0r2 getdecoderr3r4r5r7r9r:r;rCregisterrrrrs0