Warning: file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 88

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 215

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 216

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 217

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 218

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 219

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 220
PK!~wXpXp ext/parser.sonuȯELF>P@i@8 @HSHS ]] ]  ]] ] 00888$$(S(S(S Std(S(S(S Ptd`O`O`OQtdRtd]] ] GNURcْU0)ta/@ /2BE|ŷ|!qXR` L *v7r Um{$5, iF"WdGXa #Hc  :Xa __gmon_start___ITM_deregisterTMCloneTable_ITM_registerTMCloneTable__cxa_finalizerb_str_buf_newrb_str_internrb_str_buf_catrb_utf8_encodingrb_str_duprb_enc_associaterb_ary_new2rb_ary_pushrb_hash_foreachrb_ary_entryrb_funcall__stack_chk_failrb_check_typerb_scan_argsrb_convert_typerb_hash_arefrb_string_valuerb_fix2intrb_eTypeErrorrb_raiserb_eArgErrorruby_xfreerb_gc_mark_mayberuby_xmallocrb_data_object_allocrb_str_newrb_Integerrb_Floatrb_class_new_instancerb_ary_newrb_hash_newrb_hash_asetInit_parserrb_requirerb_define_modulerb_define_module_underrb_cObjectrb_define_class_underrb_path2classrb_define_alloc_funcrb_define_methodrb_const_getrb_intern2libruby.so.1.9libpthread.so.0librt.so.1libdl.so.2libcrypt.so.1libm.so.6libc.so.6_edata__bss_start_endGLIBC_2.2.5GLIBC_2.4/opt/alt/openssl/lib64:/opt/alt/ruby19/lib64ui (ii 4] ] ] ] _ _ _ _ _ '_ (_ )`  ` (` 0` 8` @`  H`  P`  X`  ``  h` p` x` ` ` ` ` ` ` ` ` ` ` ` ` ` ` `  ` !a "a #a $a % a &(a )0a *8a +@a ,Ha -Pa .HHO HtH5O %O hhhhhhhhqhah Qh Ah 1h !h hhhhhhhhhhqhahQhAh1h!hhhh h!h"h#h$h%h&h'q%=M D%5M D%-M D%%M D%M D%M D% M D%M D%L D%L D%L D%L D%L D%L D%L D%L D%L D%L D%L D%L D%L D%L D%L D%L D%}L D%uL D%mL D%eL D%]L D%UL D%ML D%EL D%=L D%5L D%-L D%%L D%L D%L D% L D%L DH=L HK H9tHfJ Ht H=K H5K H)HHH?HHtH=J HtfD=K u+UH="J Ht H=G deK ]wHF8HxMOHH4 H @x8OHH H Ȅx$OH HHH ȄҺHHff.AWIAVIAUATUSH1H(HT$dH%(HD$1MHT$IL{I9A?"tr1KPtLcXI8S8u9IwHDHL$dH3 %(H([]A\A]A^A_fDC4tI>I@HMMeL9AE<"t4<\uMeL95AEMHHHI~fDH5*A~uA~LB tA~L B H B H5A L1H5iA H=A 11HC H|$LHC@f.H|$LHHDHCXH|$L{HCHfH|$LcHCPH|$L;HCf.HCH9t{auHCH9t{NfD1HH[]A\A]0@ wIcD$0 HD$L-pHD$HL$LLHHD${HHH}HHL$I<$sH5L5 1HHCHXI9t)P,tW| t HHXI9uH=5 Hٺ1H5uD  #LLsM9SBD/tK]u.Ht$dH34%(HCH([]A\A]A^A_ NUHXI9A@<*tK uIM9A<*t*uLsM9tXC<*t? u&@IM9t(A<*t*uL0 $LH=D3 H5i1wAWIAVAUIATIUHSH8HW@dH%(HD$(1G(HD$t O,93H11I$I9t;A}{u4I]H9t+AE<"L< t< pII]H9u@1H|$(dH3<%(HH8[]A\A]A^A_IcDL> H떃0 fDHL$HLHD$ HHI@LD$ HL$I<$H5/ 1oHSHZH9nB<,t6< t< HHZH9uC< t <1HHH9 B< t~<" HH9uYHH9L<*t*uH=- H51}DHiHZH9B<*tS0 wgHHH2HH t w3HHXH9P t/uHXH9t@<*tLHH޺H1YH=pH.% Hz# HH~H=AHH޺H1 H=-H$ uH&# HHH=HH޺H1H=H$ )H" HHH=ZHH޺H1uH=H2$ H~" HH:H=]HH޺H1) H=dH# H*" HHH=HHH1H# H! HtzH# H! Ht7Hh# H[]fH=OHHu" H=/Hx! H# H[]f.H=HP! iH=9HH5! H=HH! H=HH! :H=HH H=_HH bH=?HH H=pH H=MH wH=)Hx @H=H` H=HH  H=H0 H=_H d H=V?H - H=)H  H=H H=H  H=H Q H=wH H=SHp H="_HX  H=?H@ ~ H=H( GH=H  H=nHH H=HH HH "\ already initialized instance11to_hashHashopts needs to be like a hashuninitialized instance-Infinity%u: unexpected token at '%s'nesting of %d is too deepjson/commonJSONExtParserJSON::ParserErrorJSON::NestingErrorinitializeparsesourcequirks_mode?NaNMinusInfinityjson_creatable?json_createcreate_idcreate_additionschrmax_nestingallow_nansymbolize_namesquirks_modeobject_classarray_classmatchmatch_stringkey?deep_const_get[]=[]<<utf-8findEncodingutf-16beutf-16leutf-32beutf-32leascii-8bitencodingencodeA JSON text must at least contain two octets!@8`""@@H@@@@@@@@N<<<<<<<<<<<<<<<<<  `C] ] o`` k ` X h  o8 oo o] P`p 0@P`p 0@P`pGA$3a1mC GA$3p1067`CGA*GA$annobin gcc 8.5.0 20210514GA$plugin name: gcc-annobinGA$running gcc 8.5.0 20210514GA*GA*GA! GA*FORTIFYGA+GLIBCXX_ASSERTIONS GA*GOW*GA*cf_protectionGA+omit_frame_pointerGA+stack_clashGA!stack_realign GA*FORTIFYvGA+GLIBCXX_ASSERTIONSparser.so-1.9.3-23.el8.x86_64.debug7zXZִF!t/]?Eh=ڊ2Na=>4g1}4K(~l_.û\!n;l(#-tBv8 w/m'wpPD&uBc< \Cmy\F$ȑ 3^;`I|w.8kCc̮K݀?!Ɣi%T vM p@]38m(g{# -2KFfc mr ]U$hPdFRte|;4^gRtXr_GZ"9,JzPdB%8 YhIw)ze\@v)~u_I|֪m{Jgolm<H͛$*Np;@5( #(qۮeh:9^ao2Gm҅9'|eޮ[L/Lڿ* ɯ @>1@T1XZoYa@jÊ6,^%Wg G (LǺ*i#ŌNVF?viw+Z=/!/j7ʚFDr#)^sN\>,DmEINPo $/4Tvb'7k| "<0ثq:Ҩȹ{=Ξh?^@4aI0|lHӆߏR;2D;2G~.'0{厼X+ǖo61ZN2WiPz{D bg&e2m*Qܖ  İsHFAըŒlr&;_Z( 1L Ϣ786gxH$ T;Iw ٵUk}C%!\gYZ.shstrtab.note.gnu.build-id.gnu.hash.dynsym.dynstr.gnu.version.gnu.version_r.rela.dyn.rela.plt.init.plt.sec.text.fini.rodata.eh_frame_hdr.eh_frame.note.gnu.property.init_array.fini_array.data.rel.ro.dynamic.got.got.plt.bss.gnu.build.attributes.gnu_debuglink.gnu_debugdata 88$o``4( 0``k8o fEo8 8 0Th h ^BX X hc@@nwPP.}`C`C CC `O`OOO,(S(S ] ]] ]] ]] ]0_ _8` `XXa XaHc`XaH c(c$g+PK!?9ppext/generator.sonuȯELF>@0{@8 @8i8i 0m0m 0m 8H HmHm Hm 00888$$iii Stdiii Ptd[[[  QtdRtd0m0m 0m GNUgA*Y4HM;@$;=>BE|qXt)6 F?9{LUyd^n ` GtS6, ])F"W.hq xs hq  pH __gmon_start___ITM_deregisterTMCloneTable_ITM_registerTMCloneTable__cxa_finalizerb_funcallrb_check_typeruby_xmallocruby_xrealloc2ruby_xmalloc2ruby_xfreerb_str_newrb_utf8_encodingrb_enc_associaterb_hash_arefrb_hash_newrb_obj_classrb_class_namerb_hash_asetmemccpyrb_convert_typerb_eArgErrorrb_raiserb_scan_args__stack_chk_failstrduprb_data_object_alloc__assert_failmemcpyrb_string_value_ptrrb_path2classrb_string_value_cstrrb_cHashrb_cArrayrb_cStringrb_cFixnumrb_cBignumrb_cFloatrb_respond_torb_cFalseClassrb_cTrueClassrb_cSymbolrb_cNilClassrb_ary_entryrb_cRegexprb_class_new_instancerb_str_new_cstrrb_obj_is_kind_ofrb_const_getInit_generatorrb_requirerb_define_modulerb_define_module_underrb_cObjectrb_define_class_underrb_define_alloc_funcrb_define_singleton_methodrb_define_methodrb_define_aliasrb_intern2libruby.so.1.9libpthread.so.0librt.so.1libdl.so.2libcrypt.so.1libm.so.6libc.so.6_edata__bss_start_endGLIBC_2.14GLIBC_2.2.5GLIBC_2.4/opt/alt/openssl/lib64:/opt/alt/ruby19/lib64ui ii 0m P8m @m @m xo o o o  o  o  o o o "o %o 'o +o ,o 2o 5o 6o :p  p (p 0p 8p @p  Hp  Pp Xp `p hp pp xp p p p p p p p p p p p  p !p #p $p &p (q )q *q -q . q /(q 00q 18q 3@q 4Hq 6Pq 7Xq 8`q 9HHi\ HtH5\ %\ hhhhhhhhqhah Qh Ah 1h !h hhhhhhhhhhqhahQhAh1h!hhhh h!h"h#h$h%h&h'qh(ah)Q% Z D%Z D%Y D%Y D%Y D%Y D%Y D%Y D%Y D%Y D%Y D%Y D%Y D%Y D%Y D%Y D%Y D%Y D%}Y D%uY D%mY D%eY D%]Y D%UY D%MY D%EY D%=Y D%5Y D%-Y D%%Y D%Y D%Y D% Y D%Y D%X D%X D%X D%X D%X D%X D%X D%X DH=X HX H9tHV Ht H=X H5X H)HHH?HHtHV HtfD=MX u+UH=V Ht H=T )d%X ]wHH Y 1H5Y ff.@UHSH HH߾Hm uHHHExH[]@S HNHC [H@xHDff.@UH SHHHC H@rH[]ff.S HHC [xrHff.S HHC [xqHff.S H~HC [xpHff.S HNHC [HxhHf.UHSH HH߾Hm HHHEhH[]@S HHC [H@hHDff.@H f@H@HHfDATIUHSHtWHOIT$HH)H9v:HHHH)H9rH9vI|$H{I\$ID$[]A\@H?[I $ID$IL$ff.SHHHt~H[uDUSHHHwHHHzHHHH[]DSHH?HtH{Ht H{ HtH{0HtH{@HtH{PHtEH{XHt7H{`Ht)H[SHH H=:HHOH=8HH5LU H[H11ATUHSHHeHH5T H=U 1I1LHHUH=7TH5T HH1H=9H'HHH H[]A\ÐUSHHnH߾ HH[ HsH;H5T HHHHHsH{H5xT HHHHHs(H{ H5IT HHHHfHs8H{0iH5T HHHH?HsHH{@BH5S HHHHH5S 1Ҁ{pHHHHH5S 1Ҁ{qHHHHH5kS 1Ҁ{rHHHHH5`S HShHHHTHH5R HSxHHHTHoHH[]DATU1SHt&HIHH1LHH_H[]A\AVAUIATI US$H P5LHI5Im HHHH5R HHHAIHH5R HHHIHH5UR HHHIHVH5R HHHIHH5R HHHIHL%Q HEh1HH5wQ IILzHL%'Q HEx1HH5;Q IIL>HH5KQ HHH H5,Q HHEpHHH5Q HHEqHHHLEr[]A\A]A^HCI4$ #Mt$I|$LLuHEB@LHeIHHEx'fLH5IHHEhfHI4$ kMt$I|$LLu8HE0:@HcI4$ Mt$I|$LLuHHE@@H#I4$ Mt$I|$LLu(HE n@HI4$ tgMt$I|$LELuHE H 1H1LHHH9L H55H81PHI|$IHI|$I>@HI|$I@HI|$I@HI|$I@HILehHILexff.@ATI UHSHHdH%(HD$1HC LHH0H@h1H4$HtH HT$dH3%(Hu H[]A\zf.ATUH SHHLc HEH u8HI|$@HHu2HtZID$@[]A\H]I|$@HtHt(HU H}HtH}I\$HID$@[]A\ATUH SHHHLc 7HEH u8HI|$0HHu2HtID$0[]A\H]I|$0HtHthHU H}HtH}I\$8ID$0[]A\ATUH SHHLc wHEH u@HI|$ HHu:HtID$ ID$([]A\fDH]I|$ HtHtHU H}HtH}I\$(ID$ []A\ATUH SHHLc HEH u@HI|$HHu:HtID$ID$[]A\fDH]I|$HtHtHU H}HtH}TI\$ID$[]A\ATUH SHHLc HEH u8HI<$HHu2Ht[I$ID$[]A\H]I<$HtHt)HU H}HtH}I\$I$[]A\f.SH>1HxHHHHH@x1H)HHH w[UH SHH1HH5-I HMHuH[]fH5 I HH1Hߺ[]SHt"H }f@H@H[H 0=H5+H=+fATIHUHSHH{HH{L8Hk[]A\ff.@AT1USHBH߾ IH[ HkXHHEHHHCXf&HHC`f.H*f  Nf Nуf NFDISHF.H dH%(HD$1HIH?LII1I)fLLLIIHHHI)BIAAHuHyHAA-LILL9v#f0HH@qPH9wM)uHD$dH3%(uH [LL=fDSHHH|$Ht$HL$H uHHL$HuH[DHQHL$HtHHH[ÐHHt(UHHSHHdHHuH[]D1)fHuHHD$HD$H[]AWAVAUATIUHSHH(dH%(HD$1HCHSLH E H5E "1HC}H( XLxHh\uLD$fL$L9ZAH ,HfALH9L5+Ld$L-+f.~HcLpLuHy@?.fDH=&'H5*H1c tLhHh\u1D$L5+fT$1H~fDALLbA<BIcL>DL=&@H)LHHLLL9uH)tLHH{H+HCHS"HCHD$dH3%(H([]A\A]A^A_L=%H)tLHHL$HL$WfDL=%7L=%L=%HLhHLx00H=;%L|$fD$ffD$D$f"\L= %}DH@Hy@?Hx@LeL@AEKcL>f.1AIHHHAIHHAIHHHAIHHAIHHcH (H+HH(H=HBH_=H"H\H5#HDL9wAH (HfALH9:H=#^H5&H1D11 f1f1 fIH@A{1@HHT$HCHsHT$HC@H5"HHBHIcDL>H5"HH5m"HH5D"HtwH5*"HTWH5"H47HHLHHHD$H f(HD$ff$LHvwB!H=5!H5$H1rff.fUSHHH(BH5>> 1dH%(HD$1D$HD$@u"D$f(fT &f. &w\f.z'HHHD$dH3%(uH([]FHH|$H== {H5s H1HH|$H== xH5D H1xAVIAUIATIUH-9 SHH-4HCH9EH9 H96H9 H9FH\HsHH9 H9Hr9 H9H:9 H9H5< HH5< H11HH&H5HtsH&H9 HH9E HL[L]LA\A]A^DH8 HfH8 HH8 HHy8 HHL[L]LA\A]A^IuqHL[]A\A]A^ fH5q[L]A\A]A^T@[L]A\H5OA]A^4@H5<fHL[]HA\A]A^f.H5!; 1H1H[L]A\A]A^f.AupHL[]A\A]A^H5: HL1WHHHfAWAVAUIHATUHSHXHB@LzHT$HD$8HBHHt$ HD$@HHRhHD$HAPHxH@H|$HHyxHD$HwH|$0Ht$(HqxHt H9HHEHU[HEH|$8t H|$@}D$01D`QDHH9}RH|$tH|$HLHHT$Ht$ HH4IE uIEH9|HD$HT$0H|$8HPxtOH|$@Ll$Mt9HD$0H~/A1 DA9tMtLLHA9uHHEHU]HEHX[]A\A]A^A_H|$(,E1AE9MtHt$LH@HT$Ht$HH~HT$@Ht$8HgLl$M#WHT$@Ht$8HBlHHD$H=q8 H5?HPxHT$HHPx1:f.AWAVIAUATUHSHhHB0MnxHL$8HZHD$ HB8Ht$HD$@HHRhH$IFXHHH@HD$0IF`HL$XHHH@HD$(IEHL$PHD$HIFxHt H9qHE1A"HEHUH56 H|$8{11HELt$IHI9H|$0t EH|$ t H|$@H<$0LL=H56 1HI1HHD$HD$HT$HHt$H[H|$(H|$8LI.HT$Ht$HH)I 5IGI98Lt$H|$ MnxMeMfxtLH|$@L4$Mt7M~2AE1 @AE9tHtHLHAE9uHHEHU}HEHh[]A\A]A^A_fDH|$HE1AE9HtH4$HHDHT$(Ht$PHfHT$@Ht$ HNVfHT$0Ht$XH."HT$@Ht$ HL4$MPIFxH==5 H5 HP1IVxff.@ATIUSHH߾ HHS HLH_[H]A\USHH(dH%(HD$1 HHHC xrt$HL$dH3 %(Hu}H([]f.H=\_HH$HL4 HD$H0 HH53 HH1HuH="4 H51_ff.@ATIUSH9H Il$ H߾ H[ HoEoKMoS U o[0]0oc@e@okPmPos`u`o{p}pHsH;HsH{HEHs(H{ HEHs8H{0HE H{@HsHHE0H{PHE@HtHwHHEPH{XHtHwHHEXH{`HtHwHHE`L[]A\H/ H5H811H=3fS HHC Hx@Ht [[DS H^HC Hx0Ht [[DS H.HC Hx Ht [[bfS HHC HxHt [[[2fS HHC H8Ht [,@[fUHSHHHH5HtHH[]fDH- HH0Hu)H=J1 HtHLHH1HH4$H=+ HHH$iHT$dH3%(u H[]A\ff.UHH SHdH%(HD$1HdH4$H=I+ t HH$H<$H5* 1HH1dHHiHHT$dH3%(uH[]DUH= SHH=[ ~H5 HH* H5 HyH= H* H= HX* H=t* H5[ H6* H& HoH5HH>* H=2* HVH5H H=* H7H54 [H=) HH5 00123456789abcdef\n\r\t\f\b\\\"JSON::GeneratorError%u: %s not allowed in JSONnullfalsetruenesting of %ld is too deep\A\s*(?:\[.*\]|\{.*\})\s*\Zunallocated JSON::Statejson/commonExtGeneratorJSON::NestingErrorfrom_stateinitializeinitialize_copyindentindent=spacespace=space_beforespace_before=object_nlobject_nl=array_nlarray_nl=max_nestingmax_nesting=check_circular?allow_nan?ascii_only?quirks_mode?quirks_modequirks_mode=depthdepth=configuremerge[]generateGeneratorMethodsObjectto_jsonArrayFixnumBignumFloatStringincludedto_json_rawto_json_raw_objectExtendjson_createTrueClassFalseClassNilClassMULTILINEto_snewallow_nanascii_onlyunpackcreate_idextendkey?__send__respond_to?matchkeysduputf-8findEncodingencodingencodeSAFE_STATE_PROTOTYPEopts has to be hash like or convertable into a hashpartial character in source, but hit endsource sequence is illegal/malformed utf-8source sequence is illegal/malformed utf8only generation of JSON objects or arrays allowed@8p hXH@8xhH(0123456789fbuffer_alloc_with_length0    ; @(HPhؽ|H <HXx(XD`X8$XXX8ph(hDX|X,X (h X x @ T t 8 h x8 \ ( h 8 l 8 x  , zRx $hFJ w?:*3$"D\8!$pT<EDL dAAl!ER$5EIG XFA%ER%ER%ER0Ի&ER$L<EDL dAAt!ER*De,,BDD V ABE AU$;AAG lDAEv8 _EK(TPFAD AB(ĽEAG DA(89BAC oAB<LFBE I(A0 (A BBBD 0FIF G0`  AABA 4LFAI P FBH DAB4FAI P FBH DAB4FAI Y FBG DAB4FAI Y FBG DAB4,FAI W FBA BABdOEE0oEIG j FAJ KNAGAf A (D1BGD `AB8XVBCA  ABF M ABH 8|K LKK0 AD $pt_AG q AF ]A8]IGG0QAAFP0ZAAH3BBB B(D0I8G` 8A0A(B BBBH ( ACJ@t AAA LBEE D(H0 (D EBBJ O (D EBBL K (A BBBN M (D BBBI A (D GIBI W (A EBBO W (D BBBO L (A BBBM L vBBB H(A0D8D 8A0A(B BBBA L\!BBE B(A0D8D# 8A0A(B BBBG (=BDA kDB(EAG@F AAK ,`IFDA " ABA 4H|+E[ H Ah+E[ H A.E[ H A.E[ H A.EZ I A@EDM N DAG o EAK K IFF , 8EK u AA P EK u AA t EK u AA 0 |FKA D0t  AABA 0 FAK D0v  AABA ( TEAQ0l AAA 0, FKA D0w  AABA 0` $FKA D0w  AABA ( 6FDF \CB0 FDH D0u  AABA ( EKD0 AAA ( EHD  AAC GNUP@m bq 0 @U0m 8m o`  p @`  o oo oHm `p 0@P`p 0@P`pGA$3a10MU GA$3p1067`=UGA*GA$annobin gcc 8.5.0 20210514GA$plugin name: gcc-annobinGA$running gcc 8.5.0 20210514GA*GA*GA! GA*FORTIFYGA+GLIBCXX_ASSERTIONS GA*GOW*GA*cf_protectionGA+omit_frame_pointerGA+stack_clashGA!stack_realign GA*FORTIFY`GA+GLIBCXX_ASSERTIONSgenerator.so-1.9.3-23.el8.x86_64.debugI7zXZִF!t/]?Eh=ڊ2NHldN /2\IPأ; +!0eCFomoR7nCXjk`y,q|ځKjfLknb((`!ռ;yi{AquΨn\쑟08Ek) m=Ϯ#@:* uX1% eS[=ⵡjQ/7t@?\9ϻޥێ@'IKa8ߒw'9ŝ-\AVSW߉e/SO>Ez?!py M z`Y/Yez1&_: 6\ܼzhtxGWk V>[puWsFu9 elTHּsR|p=dE*c1E^7tB: {5TYZd_OVg+걱qڻ:pYGȈd2x r08`Ѱ2vlVA.>23dQ)h\| nxn鉍$.F&N뛙gs?%ETә`92qq&s@wLD|z/=Xw >KN||nI7܊ 5&o?pL9vɾzf2: 'LJ ZY'4ِ#jALTwN~ŭHswuaUҥGHxؠ0.-y)9W{:[Iy81w[ڝpjAά5/ 䝕 q,c\6}` _oӧ.PZoQԝhpvfѻ_[H;),5wZ[glK=?b 4͝e|3qNJ÷ Z ؙ>YimsVݞт%Ж1j:>vŬiZirXE 9(P+j^lI gp+Pf(`t\5jfA3h2]+oSeĈa u'F#H[Z))>[n^؀gƘG0UeդHzt5!mN!9H=Iɓs-aDGW9y}&s5 {67Lfq "֐hd<`;&k] [6<E-M4NTM}KT~Z;l'Ф s\du+|=Hzt(PѺliܻUm|\ Gb.hƝ9bôbQx54~Lyk.3n0ZG8%-R'r)1Lp+Vy^iCrM]sρ27LF/tҳ^=H# {m˔=ek{<KQ@N 2dygYZ.shstrtab.note.gnu.build-id.gnu.hash.dynsym.dynstr.gnu.version.gnu.version_r.rela.dyn.rela.plt.init.plt.sec.text.fini.rodata.eh_frame_hdr.eh_frame.note.gnu.property.init_array.fini_array.data.rel.ro.dynamic.got.got.plt.bss.gnu.build.attributes.gnu_debuglink.gnu_debugdata 88$o``4( 08o ~Eo @T` ` ^B@@h00cPPnw<}@U@U `U`UX [[ ]]L ii 0m 0m8m 8m@m @mHm Hm0xo xop phhq hqxs`hqH s,s(z+PK!@Eyaml_events.rbnu[module Psych module JSON module YAMLEvents # :nodoc: def start_document version, tag_directives, implicit super(version, tag_directives, !streaming?) end def end_document implicit_end = !streaming? super(implicit_end) end def start_mapping anchor, tag, implicit, style super(anchor, nil, true, Nodes::Mapping::FLOW) end def start_sequence anchor, tag, implicit, style super(anchor, nil, true, Nodes::Sequence::FLOW) end def scalar value, anchor, tag, plain, quoted, style if "tag:yaml.org,2002:null" == tag super('null', nil, nil, true, false, Nodes::Scalar::PLAIN) else super end end end end end PK!p6xx stream.rbnu[require 'psych/json/ruby_events' require 'psych/json/yaml_events' module Psych module JSON class Stream < Psych::Visitors::JSONTree include Psych::JSON::RubyEvents include Psych::Streaming extend Psych::Streaming::ClassMethods class Emitter < Psych::Stream::Emitter # :nodoc: include Psych::JSON::YAMLEvents end end end end PK!|ruby_events.rbnu[module Psych module JSON module RubyEvents # :nodoc: def visit_Time o formatted = format_time o @emitter.scalar formatted, nil, nil, false, true, Nodes::Scalar::DOUBLE_QUOTED end def visit_DateTime o visit_Time o.to_time end def visit_String o @emitter.scalar o.to_s, nil, nil, false, true, Nodes::Scalar::DOUBLE_QUOTED end alias :visit_Symbol :visit_String end end end PK!?OGGtree_builder.rbnu[require 'psych/json/yaml_events' module Psych module JSON ### # Psych::JSON::TreeBuilder is an event based AST builder. Events are sent # to an instance of Psych::JSON::TreeBuilder and a JSON AST is constructed. class TreeBuilder < Psych::TreeBuilder include Psych::JSON::YAMLEvents end end end PK!@@ encoder.pynu["""Implementation of JSONEncoder """ import re try: from _json import encode_basestring_ascii as c_encode_basestring_ascii except ImportError: c_encode_basestring_ascii = None try: from _json import make_encoder as c_make_encoder except ImportError: c_make_encoder = None ESCAPE = re.compile(r'[\x00-\x1f\\"\b\f\n\r\t]') ESCAPE_ASCII = re.compile(r'([\\"]|[^\ -~])') HAS_UTF8 = re.compile(r'[\x80-\xff]') ESCAPE_DCT = { '\\': '\\\\', '"': '\\"', '\b': '\\b', '\f': '\\f', '\n': '\\n', '\r': '\\r', '\t': '\\t', } for i in range(0x20): ESCAPE_DCT.setdefault(chr(i), '\\u{0:04x}'.format(i)) #ESCAPE_DCT.setdefault(chr(i), '\\u%04x' % (i,)) INFINITY = float('inf') FLOAT_REPR = float.__repr__ def encode_basestring(s): """Return a JSON representation of a Python string """ def replace(match): return ESCAPE_DCT[match.group(0)] return '"' + ESCAPE.sub(replace, s) + '"' def py_encode_basestring_ascii(s): """Return an ASCII-only JSON representation of a Python string """ if isinstance(s, str) and HAS_UTF8.search(s) is not None: s = s.decode('utf-8') def replace(match): s = match.group(0) try: return ESCAPE_DCT[s] except KeyError: n = ord(s) if n < 0x10000: return '\\u{0:04x}'.format(n) #return '\\u%04x' % (n,) else: # surrogate pair n -= 0x10000 s1 = 0xd800 | ((n >> 10) & 0x3ff) s2 = 0xdc00 | (n & 0x3ff) return '\\u{0:04x}\\u{1:04x}'.format(s1, s2) #return '\\u%04x\\u%04x' % (s1, s2) return '"' + str(ESCAPE_ASCII.sub(replace, s)) + '"' encode_basestring_ascii = ( c_encode_basestring_ascii or py_encode_basestring_ascii) class JSONEncoder(object): """Extensible JSON encoder for Python data structures. Supports the following objects and types by default: +-------------------+---------------+ | Python | JSON | +===================+===============+ | dict | object | +-------------------+---------------+ | list, tuple | array | +-------------------+---------------+ | str, unicode | string | +-------------------+---------------+ | int, long, float | number | +-------------------+---------------+ | True | true | +-------------------+---------------+ | False | false | +-------------------+---------------+ | None | null | +-------------------+---------------+ To extend this to recognize other objects, subclass and implement a ``.default()`` method with another method that returns a serializable object for ``o`` if possible, otherwise it should call the superclass implementation (to raise ``TypeError``). """ item_separator = ', ' key_separator = ': ' def __init__(self, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, encoding='utf-8', default=None): """Constructor for JSONEncoder, with sensible defaults. If skipkeys is false, then it is a TypeError to attempt encoding of keys that are not str, int, long, float or None. If skipkeys is True, such items are simply skipped. If *ensure_ascii* is true (the default), all non-ASCII characters in the output are escaped with \uXXXX sequences, and the results are str instances consisting of ASCII characters only. If ensure_ascii is False, a result may be a unicode instance. This usually happens if the input contains unicode strings or the *encoding* parameter is used. If check_circular is true, then lists, dicts, and custom encoded objects will be checked for circular references during encoding to prevent an infinite recursion (which would cause an OverflowError). Otherwise, no such check takes place. If allow_nan is true, then NaN, Infinity, and -Infinity will be encoded as such. This behavior is not JSON specification compliant, but is consistent with most JavaScript based encoders and decoders. Otherwise, it will be a ValueError to encode such floats. If sort_keys is true, then the output of dictionaries will be sorted by key; this is useful for regression tests to ensure that JSON serializations can be compared on a day-to-day basis. If indent is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. None is the most compact representation. Since the default item separator is ', ', the output might include trailing whitespace when indent is specified. You can use separators=(',', ': ') to avoid this. If specified, separators should be a (item_separator, key_separator) tuple. The default is (', ', ': '). To get the most compact JSON representation you should specify (',', ':') to eliminate whitespace. If specified, default is a function that gets called for objects that can't otherwise be serialized. It should return a JSON encodable version of the object or raise a ``TypeError``. If encoding is not None, then all input strings will be transformed into unicode using that encoding prior to JSON-encoding. The default is UTF-8. """ self.skipkeys = skipkeys self.ensure_ascii = ensure_ascii self.check_circular = check_circular self.allow_nan = allow_nan self.sort_keys = sort_keys self.indent = indent if separators is not None: self.item_separator, self.key_separator = separators if default is not None: self.default = default self.encoding = encoding def default(self, o): """Implement this method in a subclass such that it returns a serializable object for ``o``, or calls the base implementation (to raise a ``TypeError``). For example, to support arbitrary iterators, you could implement default like this:: def default(self, o): try: iterable = iter(o) except TypeError: pass else: return list(iterable) # Let the base class default method raise the TypeError return JSONEncoder.default(self, o) """ raise TypeError(repr(o) + " is not JSON serializable") def encode(self, o): """Return a JSON string representation of a Python data structure. >>> JSONEncoder().encode({"foo": ["bar", "baz"]}) '{"foo": ["bar", "baz"]}' """ # This is for extremely simple cases and benchmarks. if isinstance(o, basestring): if isinstance(o, str): _encoding = self.encoding if (_encoding is not None and not (_encoding == 'utf-8')): o = o.decode(_encoding) if self.ensure_ascii: return encode_basestring_ascii(o) else: return encode_basestring(o) # This doesn't pass the iterator directly to ''.join() because the # exceptions aren't as detailed. The list call should be roughly # equivalent to the PySequence_Fast that ''.join() would do. chunks = self.iterencode(o, _one_shot=True) if not isinstance(chunks, (list, tuple)): chunks = list(chunks) return ''.join(chunks) def iterencode(self, o, _one_shot=False): """Encode the given object and yield each string representation as available. For example:: for chunk in JSONEncoder().iterencode(bigobject): mysocket.write(chunk) """ if self.check_circular: markers = {} else: markers = None if self.ensure_ascii: _encoder = encode_basestring_ascii else: _encoder = encode_basestring if self.encoding != 'utf-8': def _encoder(o, _orig_encoder=_encoder, _encoding=self.encoding): if isinstance(o, str): o = o.decode(_encoding) return _orig_encoder(o) def floatstr(o, allow_nan=self.allow_nan, _repr=FLOAT_REPR, _inf=INFINITY, _neginf=-INFINITY): # Check for specials. Note that this type of test is processor # and/or platform-specific, so do tests which don't depend on the # internals. if o != o: text = 'NaN' elif o == _inf: text = 'Infinity' elif o == _neginf: text = '-Infinity' else: return _repr(o) if not allow_nan: raise ValueError( "Out of range float values are not JSON compliant: " + repr(o)) return text if (_one_shot and c_make_encoder is not None and self.indent is None and not self.sort_keys): _iterencode = c_make_encoder( markers, self.default, _encoder, self.indent, self.key_separator, self.item_separator, self.sort_keys, self.skipkeys, self.allow_nan) else: _iterencode = _make_iterencode( markers, self.default, _encoder, self.indent, floatstr, self.key_separator, self.item_separator, self.sort_keys, self.skipkeys, _one_shot) return _iterencode(o, 0) def _make_iterencode(markers, _default, _encoder, _indent, _floatstr, _key_separator, _item_separator, _sort_keys, _skipkeys, _one_shot, ## HACK: hand-optimized bytecode; turn globals into locals ValueError=ValueError, basestring=basestring, dict=dict, float=float, id=id, int=int, isinstance=isinstance, list=list, long=long, str=str, tuple=tuple, ): def _iterencode_list(lst, _current_indent_level): if not lst: yield '[]' return if markers is not None: markerid = id(lst) if markerid in markers: raise ValueError("Circular reference detected") markers[markerid] = lst buf = '[' if _indent is not None: _current_indent_level += 1 newline_indent = '\n' + (' ' * (_indent * _current_indent_level)) separator = _item_separator + newline_indent buf += newline_indent else: newline_indent = None separator = _item_separator first = True for value in lst: if first: first = False else: buf = separator if isinstance(value, basestring): yield buf + _encoder(value) elif value is None: yield buf + 'null' elif value is True: yield buf + 'true' elif value is False: yield buf + 'false' elif isinstance(value, (int, long)): yield buf + str(value) elif isinstance(value, float): yield buf + _floatstr(value) else: yield buf if isinstance(value, (list, tuple)): chunks = _iterencode_list(value, _current_indent_level) elif isinstance(value, dict): chunks = _iterencode_dict(value, _current_indent_level) else: chunks = _iterencode(value, _current_indent_level) for chunk in chunks: yield chunk if newline_indent is not None: _current_indent_level -= 1 yield '\n' + (' ' * (_indent * _current_indent_level)) yield ']' if markers is not None: del markers[markerid] def _iterencode_dict(dct, _current_indent_level): if not dct: yield '{}' return if markers is not None: markerid = id(dct) if markerid in markers: raise ValueError("Circular reference detected") markers[markerid] = dct yield '{' if _indent is not None: _current_indent_level += 1 newline_indent = '\n' + (' ' * (_indent * _current_indent_level)) item_separator = _item_separator + newline_indent yield newline_indent else: newline_indent = None item_separator = _item_separator first = True if _sort_keys: items = sorted(dct.items(), key=lambda kv: kv[0]) else: items = dct.iteritems() for key, value in items: if isinstance(key, basestring): pass # JavaScript is weakly typed for these, so it makes sense to # also allow them. Many encoders seem to do something like this. elif isinstance(key, float): key = _floatstr(key) elif key is True: key = 'true' elif key is False: key = 'false' elif key is None: key = 'null' elif isinstance(key, (int, long)): key = str(key) elif _skipkeys: continue else: raise TypeError("key " + repr(key) + " is not a string") if first: first = False else: yield item_separator yield _encoder(key) yield _key_separator if isinstance(value, basestring): yield _encoder(value) elif value is None: yield 'null' elif value is True: yield 'true' elif value is False: yield 'false' elif isinstance(value, (int, long)): yield str(value) elif isinstance(value, float): yield _floatstr(value) else: if isinstance(value, (list, tuple)): chunks = _iterencode_list(value, _current_indent_level) elif isinstance(value, dict): chunks = _iterencode_dict(value, _current_indent_level) else: chunks = _iterencode(value, _current_indent_level) for chunk in chunks: yield chunk if newline_indent is not None: _current_indent_level -= 1 yield '\n' + (' ' * (_indent * _current_indent_level)) yield '}' if markers is not None: del markers[markerid] def _iterencode(o, _current_indent_level): if isinstance(o, basestring): yield _encoder(o) elif o is None: yield 'null' elif o is True: yield 'true' elif o is False: yield 'false' elif isinstance(o, (int, long)): yield str(o) elif isinstance(o, float): yield _floatstr(o) elif isinstance(o, (list, tuple)): for chunk in _iterencode_list(o, _current_indent_level): yield chunk elif isinstance(o, dict): for chunk in _iterencode_dict(o, _current_indent_level): yield chunk else: if markers is not None: markerid = id(o) if markerid in markers: raise ValueError("Circular reference detected") markers[markerid] = o o = _default(o) for chunk in _iterencode(o, _current_indent_level): yield chunk if markers is not None: del markers[markerid] return _iterencode PK!ߤ99 __init__.pynu[r"""JSON (JavaScript Object Notation) is a subset of JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data interchange format. :mod:`json` exposes an API familiar to users of the standard library :mod:`marshal` and :mod:`pickle` modules. It is the externally maintained version of the :mod:`json` library contained in Python 2.6, but maintains compatibility with Python 2.4 and Python 2.5 and (currently) has significant performance advantages, even without using the optional C extension for speedups. Encoding basic Python object hierarchies:: >>> import json >>> json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}]) '["foo", {"bar": ["baz", null, 1.0, 2]}]' >>> print json.dumps("\"foo\bar") "\"foo\bar" >>> print json.dumps(u'\u1234') "\u1234" >>> print json.dumps('\\') "\\" >>> print json.dumps({"c": 0, "b": 0, "a": 0}, sort_keys=True) {"a": 0, "b": 0, "c": 0} >>> from StringIO import StringIO >>> io = StringIO() >>> json.dump(['streaming API'], io) >>> io.getvalue() '["streaming API"]' Compact encoding:: >>> import json >>> json.dumps([1,2,3,{'4': 5, '6': 7}], sort_keys=True, separators=(',',':')) '[1,2,3,{"4":5,"6":7}]' Pretty printing:: >>> import json >>> print json.dumps({'4': 5, '6': 7}, sort_keys=True, ... indent=4, separators=(',', ': ')) { "4": 5, "6": 7 } Decoding JSON:: >>> import json >>> obj = [u'foo', {u'bar': [u'baz', None, 1.0, 2]}] >>> json.loads('["foo", {"bar":["baz", null, 1.0, 2]}]') == obj True >>> json.loads('"\\"foo\\bar"') == u'"foo\x08ar' True >>> from StringIO import StringIO >>> io = StringIO('["streaming API"]') >>> json.load(io)[0] == 'streaming API' True Specializing JSON object decoding:: >>> import json >>> def as_complex(dct): ... if '__complex__' in dct: ... return complex(dct['real'], dct['imag']) ... return dct ... >>> json.loads('{"__complex__": true, "real": 1, "imag": 2}', ... object_hook=as_complex) (1+2j) >>> from decimal import Decimal >>> json.loads('1.1', parse_float=Decimal) == Decimal('1.1') True Specializing JSON object encoding:: >>> import json >>> def encode_complex(obj): ... if isinstance(obj, complex): ... return [obj.real, obj.imag] ... raise TypeError(repr(obj) + " is not JSON serializable") ... >>> json.dumps(2 + 1j, default=encode_complex) '[2.0, 1.0]' >>> json.JSONEncoder(default=encode_complex).encode(2 + 1j) '[2.0, 1.0]' >>> ''.join(json.JSONEncoder(default=encode_complex).iterencode(2 + 1j)) '[2.0, 1.0]' Using json.tool from the shell to validate and pretty-print:: $ echo '{"json":"obj"}' | python -m json.tool { "json": "obj" } $ echo '{ 1.2:3.4}' | python -m json.tool Expecting property name enclosed in double quotes: line 1 column 3 (char 2) """ __version__ = '2.0.9' __all__ = [ 'dump', 'dumps', 'load', 'loads', 'JSONDecoder', 'JSONEncoder', ] __author__ = 'Bob Ippolito ' from .decoder import JSONDecoder from .encoder import JSONEncoder _default_encoder = JSONEncoder( skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, indent=None, separators=None, encoding='utf-8', default=None, ) def dump(obj, fp, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, cls=None, indent=None, separators=None, encoding='utf-8', default=None, sort_keys=False, **kw): """Serialize ``obj`` as a JSON formatted stream to ``fp`` (a ``.write()``-supporting file-like object). If ``skipkeys`` is true then ``dict`` keys that are not basic types (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``) will be skipped instead of raising a ``TypeError``. If ``ensure_ascii`` is true (the default), all non-ASCII characters in the output are escaped with ``\uXXXX`` sequences, and the result is a ``str`` instance consisting of ASCII characters only. If ``ensure_ascii`` is false, some chunks written to ``fp`` may be ``unicode`` instances. This usually happens because the input contains unicode strings or the ``encoding`` parameter is used. Unless ``fp.write()`` explicitly understands ``unicode`` (as in ``codecs.getwriter``) this is likely to cause an error. If ``check_circular`` is false, then the circular reference check for container types will be skipped and a circular reference will result in an ``OverflowError`` (or worse). If ``allow_nan`` is false, then it will be a ``ValueError`` to serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). If ``indent`` is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. ``None`` is the most compact representation. Since the default item separator is ``', '``, the output might include trailing whitespace when ``indent`` is specified. You can use ``separators=(',', ': ')`` to avoid this. If ``separators`` is an ``(item_separator, dict_separator)`` tuple then it will be used instead of the default ``(', ', ': ')`` separators. ``(',', ':')`` is the most compact JSON representation. ``encoding`` is the character encoding for str instances, default is UTF-8. ``default(obj)`` is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError. If *sort_keys* is true (default: ``False``), then the output of dictionaries will be sorted by key. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the ``.default()`` method to serialize additional types), specify it with the ``cls`` kwarg; otherwise ``JSONEncoder`` is used. """ # cached encoder if (not skipkeys and ensure_ascii and check_circular and allow_nan and cls is None and indent is None and separators is None and encoding == 'utf-8' and default is None and not sort_keys and not kw): iterable = _default_encoder.iterencode(obj) else: if cls is None: cls = JSONEncoder iterable = cls(skipkeys=skipkeys, ensure_ascii=ensure_ascii, check_circular=check_circular, allow_nan=allow_nan, indent=indent, separators=separators, encoding=encoding, default=default, sort_keys=sort_keys, **kw).iterencode(obj) # could accelerate with writelines in some versions of Python, at # a debuggability cost for chunk in iterable: fp.write(chunk) def dumps(obj, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, cls=None, indent=None, separators=None, encoding='utf-8', default=None, sort_keys=False, **kw): """Serialize ``obj`` to a JSON formatted ``str``. If ``skipkeys`` is true then ``dict`` keys that are not basic types (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``) will be skipped instead of raising a ``TypeError``. If ``ensure_ascii`` is false, all non-ASCII characters are not escaped, and the return value may be a ``unicode`` instance. See ``dump`` for details. If ``check_circular`` is false, then the circular reference check for container types will be skipped and a circular reference will result in an ``OverflowError`` (or worse). If ``allow_nan`` is false, then it will be a ``ValueError`` to serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). If ``indent`` is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. ``None`` is the most compact representation. Since the default item separator is ``', '``, the output might include trailing whitespace when ``indent`` is specified. You can use ``separators=(',', ': ')`` to avoid this. If ``separators`` is an ``(item_separator, dict_separator)`` tuple then it will be used instead of the default ``(', ', ': ')`` separators. ``(',', ':')`` is the most compact JSON representation. ``encoding`` is the character encoding for str instances, default is UTF-8. ``default(obj)`` is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError. If *sort_keys* is true (default: ``False``), then the output of dictionaries will be sorted by key. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the ``.default()`` method to serialize additional types), specify it with the ``cls`` kwarg; otherwise ``JSONEncoder`` is used. """ # cached encoder if (not skipkeys and ensure_ascii and check_circular and allow_nan and cls is None and indent is None and separators is None and encoding == 'utf-8' and default is None and not sort_keys and not kw): return _default_encoder.encode(obj) if cls is None: cls = JSONEncoder return cls( skipkeys=skipkeys, ensure_ascii=ensure_ascii, check_circular=check_circular, allow_nan=allow_nan, indent=indent, separators=separators, encoding=encoding, default=default, sort_keys=sort_keys, **kw).encode(obj) _default_decoder = JSONDecoder(encoding=None, object_hook=None, object_pairs_hook=None) def load(fp, encoding=None, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, **kw): """Deserialize ``fp`` (a ``.read()``-supporting file-like object containing a JSON document) to a Python object. If the contents of ``fp`` is encoded with an ASCII based encoding other than utf-8 (e.g. latin-1), then an appropriate ``encoding`` name must be specified. Encodings that are not ASCII based (such as UCS-2) are not allowed, and should be wrapped with ``codecs.getreader(fp)(encoding)``, or simply decoded to a ``unicode`` object and passed to ``loads()`` ``object_hook`` is an optional function that will be called with the result of any object literal decode (a ``dict``). The return value of ``object_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders (e.g. JSON-RPC class hinting). ``object_pairs_hook`` is an optional function that will be called with the result of any object literal decoded with an ordered list of pairs. The return value of ``object_pairs_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders that rely on the order that the key and value pairs are decoded (for example, collections.OrderedDict will remember the order of insertion). If ``object_hook`` is also defined, the ``object_pairs_hook`` takes priority. To use a custom ``JSONDecoder`` subclass, specify it with the ``cls`` kwarg; otherwise ``JSONDecoder`` is used. """ return loads(fp.read(), encoding=encoding, cls=cls, object_hook=object_hook, parse_float=parse_float, parse_int=parse_int, parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw) def loads(s, encoding=None, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, **kw): """Deserialize ``s`` (a ``str`` or ``unicode`` instance containing a JSON document) to a Python object. If ``s`` is a ``str`` instance and is encoded with an ASCII based encoding other than utf-8 (e.g. latin-1) then an appropriate ``encoding`` name must be specified. Encodings that are not ASCII based (such as UCS-2) are not allowed and should be decoded to ``unicode`` first. ``object_hook`` is an optional function that will be called with the result of any object literal decode (a ``dict``). The return value of ``object_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders (e.g. JSON-RPC class hinting). ``object_pairs_hook`` is an optional function that will be called with the result of any object literal decoded with an ordered list of pairs. The return value of ``object_pairs_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders that rely on the order that the key and value pairs are decoded (for example, collections.OrderedDict will remember the order of insertion). If ``object_hook`` is also defined, the ``object_pairs_hook`` takes priority. ``parse_float``, if specified, will be called with the string of every JSON float to be decoded. By default this is equivalent to float(num_str). This can be used to use another datatype or parser for JSON floats (e.g. decimal.Decimal). ``parse_int``, if specified, will be called with the string of every JSON int to be decoded. By default this is equivalent to int(num_str). This can be used to use another datatype or parser for JSON integers (e.g. float). ``parse_constant``, if specified, will be called with one of the following strings: -Infinity, Infinity, NaN. This can be used to raise an exception if invalid JSON numbers are encountered. To use a custom ``JSONDecoder`` subclass, specify it with the ``cls`` kwarg; otherwise ``JSONDecoder`` is used. """ if (cls is None and encoding is None and object_hook is None and parse_int is None and parse_float is None and parse_constant is None and object_pairs_hook is None and not kw): return _default_decoder.decode(s) if cls is None: cls = JSONDecoder if object_hook is not None: kw['object_hook'] = object_hook if object_pairs_hook is not None: kw['object_pairs_hook'] = object_pairs_hook if parse_float is not None: kw['parse_float'] = parse_float if parse_int is not None: kw['parse_int'] = parse_int if parse_constant is not None: kw['parse_constant'] = parse_constant return cls(encoding=encoding, **kw).decode(s) PK!3)tool.pynu[r"""Command-line tool to validate and pretty-print JSON Usage:: $ echo '{"json":"obj"}' | python -m json.tool { "json": "obj" } $ echo '{ 1.2:3.4}' | python -m json.tool Expecting property name enclosed in double quotes: line 1 column 3 (char 2) """ import sys import json def main(): if len(sys.argv) == 1: infile = sys.stdin outfile = sys.stdout elif len(sys.argv) == 2: infile = open(sys.argv[1], 'rb') outfile = sys.stdout elif len(sys.argv) == 3: infile = open(sys.argv[1], 'rb') outfile = open(sys.argv[2], 'wb') else: raise SystemExit(sys.argv[0] + " [infile [outfile]]") with infile: try: obj = json.load(infile) except ValueError, e: raise SystemExit(e) with outfile: json.dump(obj, outfile, sort_keys=True, indent=4, separators=(',', ': ')) outfile.write('\n') if __name__ == '__main__': main() PK! ;) )__pycache__/__init__.cpython-36.opt-2.pycnu[3 \<8 @sdZdddddddgZdZd d lmZmZd d lmZd d lZeddddd d d dZ ddddd d d d dd ddZ ddddd d d d dd ddZ ed d dZ ddZ d d d d d d dddZd d d d d d d dddZd S)z2.0.9dumpdumpsloadloads JSONDecoderJSONDecodeError JSONEncoderzBob Ippolito )rr)rNFT)skipkeys ensure_asciicheck_circular allow_nanindent separatorsdefault) r r r r clsrrr sort_keysc  Ks| rJ|rJ|rJ|rJ|dkrJ|dkrJ|dkrJ| dkrJ| rJ| rJtj|} n2|dkrVt}|f||||||| | d| j|} x| D]} |j| qWdS)N)r r r r rrrr)_default_encoder iterencoderwrite)objfpr r r r rrrrrkwiterablechunkr%/usr/lib64/python3.6/json/__init__.pyrxs-   c Ksz| rH|rH|rH|rH|dkrH|dkrH|dkrH|dkrH| rH| rHtj|S|dkrTt}|f|||||||| d| j|S)N)r r r r rrrr)rencoder) rr r r r rrrrrrrrrrs,   ) object_hookobject_pairs_hookcCs|j}|tjtjfrdS|tjtjfr.dS|tjrbs4  =8 PK!](__pycache__/scanner.cpython-36.opt-2.pycnu[3 \o @sfddlZyddlmZWnek r0dZYnXdgZejdejejBej BZ ddZ ep`e ZdS)N) make_scannerrz)(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?c sv|j |j|j tj|j |j|j|j|j |j |j  f ddfdd}|S)Ncsy ||}Wntk r(t|YnX|dkrB ||d S|dkrd ||df S|dkr~||dfS|dkr|||ddkrd|dfS|dkr|||dd krd |dfS|d ko|||d d krd|d fS||}|dk rX|j\}}}|s&|rD||p2d|p            z#py_make_scanner.._scan_oncec sz ||SjXdS)N)clear)rr)rrr(r) scan_onceAs z"py_make_scanner..scan_once) r%r!r& NUMBER_REmatchr'r#r$r"rr r)contextr+r() rrrrr r!r"r#r$r%r&r'r)py_make_scanners"%r/) reZ_jsonrZc_make_scanner ImportError__all__compileVERBOSE MULTILINEDOTALLr,r/r(r(r(r)s :PK!NTM++(__pycache__/encoder.cpython-36.opt-1.pycnu[3 \>"@sBdZddlZyddlmZWnek r4dZYnXyddlmZWnek r^dZYnXyddlmZ Wnek rdZ YnXej dZ ej dZ ej dZ d d d d d dddZx&edD]ZejeedjeqWedZddZepeZddZep eZGdddeZeeeeeeee e!ej"f ddZ#dS)zImplementation of JSONEncoder N)encode_basestring_ascii)encode_basestring) make_encoderz[\x00-\x1f\\"\b\f\n\r\t]z([\\"]|[^\ -~])s[-]z\\z\"z\bz\fz\nz\rz\t)\"    z \u{0:04x}infcCsdd}dtj||dS)z5Return a JSON representation of a Python string cSst|jdS)Nr) ESCAPE_DCTgroup)matchr$/usr/lib64/python3.6/json/encoder.pyreplace(sz%py_encode_basestring..replacer)ESCAPEsub)srrrrpy_encode_basestring$srcCsdd}dtj||dS)zAReturn an ASCII-only JSON representation of a Python string c Ssv|jd}yt|Stk rpt|}|dkr.replacer) ESCAPE_ASCIIr)rrrrrpy_encode_basestring_ascii0sr c @sNeZdZdZdZdZddddddddddd Zd d Zd d ZdddZ dS) JSONEncoderaZExtensible JSON encoder for Python data structures. Supports the following objects and types by default: +-------------------+---------------+ | Python | JSON | +===================+===============+ | dict | object | +-------------------+---------------+ | list, tuple | array | +-------------------+---------------+ | str | string | +-------------------+---------------+ | int, float | number | +-------------------+---------------+ | True | true | +-------------------+---------------+ | False | false | +-------------------+---------------+ | None | null | +-------------------+---------------+ To extend this to recognize other objects, subclass and implement a ``.default()`` method with another method that returns a serializable object for ``o`` if possible, otherwise it should call the superclass implementation (to raise ``TypeError``). z, z: FTN)skipkeys ensure_asciicheck_circular allow_nan sort_keysindent separatorsdefaultc CsZ||_||_||_||_||_||_|dk r:|\|_|_n|dk rHd|_|dk rV||_dS)aConstructor for JSONEncoder, with sensible defaults. If skipkeys is false, then it is a TypeError to attempt encoding of keys that are not str, int, float or None. If skipkeys is True, such items are simply skipped. If ensure_ascii is true, the output is guaranteed to be str objects with all incoming non-ASCII characters escaped. If ensure_ascii is false, the output can contain non-ASCII characters. If check_circular is true, then lists, dicts, and custom encoded objects will be checked for circular references during encoding to prevent an infinite recursion (which would cause an OverflowError). Otherwise, no such check takes place. If allow_nan is true, then NaN, Infinity, and -Infinity will be encoded as such. This behavior is not JSON specification compliant, but is consistent with most JavaScript based encoders and decoders. Otherwise, it will be a ValueError to encode such floats. If sort_keys is true, then the output of dictionaries will be sorted by key; this is useful for regression tests to ensure that JSON serializations can be compared on a day-to-day basis. If indent is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. None is the most compact representation. If specified, separators should be an (item_separator, key_separator) tuple. The default is (', ', ': ') if *indent* is ``None`` and (',', ': ') otherwise. To get the most compact JSON representation, you should specify (',', ':') to eliminate whitespace. If specified, default is a function that gets called for objects that can't otherwise be serialized. It should return a JSON encodable version of the object or raise a ``TypeError``. N,) r"r#r$r%r&r'item_separator key_separatorr)) selfr"r#r$r%r&r'r(r)rrr__init__hs+zJSONEncoder.__init__cCstd|jjdS)alImplement this method in a subclass such that it returns a serializable object for ``o``, or calls the base implementation (to raise a ``TypeError``). For example, to support arbitrary iterators, you could implement default like this:: def default(self, o): try: iterable = iter(o) except TypeError: pass else: return list(iterable) # Let the base class default method raise the TypeError return JSONEncoder.default(self, o) z,Object of type '%s' is not JSON serializableN) TypeError __class____name__)r-orrrr)szJSONEncoder.defaultcCsNt|tr |jrt|St|S|j|dd}t|ttfsDt|}dj|S)zReturn a JSON string representation of a Python data structure. >>> from json.encoder import JSONEncoder >>> JSONEncoder().encode({"foo": ["bar", "baz"]}) '{"foo": ["bar", "baz"]}' T) _one_shot) isinstancestrr#rr iterencodelisttuplejoin)r-r2chunksrrrencodes zJSONEncoder.encodec Cs|jr i}nd}|jrt}nt}|jtjtt fdd}|rvtdk rv|j dkrvt||j ||j |j |j |j |j|j }n&t||j ||j ||j |j |j |j| }||dS)zEncode the given object and yield each string representation as available. For example:: for chunk in JSONEncoder().iterencode(bigobject): mysocket.write(chunk) NcSsJ||krd}n$||krd}n||kr*d}n||S|sFtdt||S)NZNaNZInfinityz -Infinityz2Out of range float values are not JSON compliant: ) ValueErrorrepr)r2r%Z_reprZ_infZ_neginftextrrrfloatstrs z(JSONEncoder.iterencode..floatstrr)r$r#rrr%float__repr__INFINITYc_make_encoderr'r)r,r+r&r"_make_iterencode)r-r2r3markers_encoderr@ _iterencoderrrr7s&       zJSONEncoder.iterencode)F) r1 __module__ __qualname____doc__r+r,r.r)r<r7rrrrr!Is6r!csdk r rd fdd  fdd fddS)N c 3s|sdVdSdk r6 |}|kr.d||<d}dk rh|d7}d|}|}||7}nd}}d}x|D]}|rd}n|} |r||Vqz|dkr|dVqz|dkr|d Vqz|dkr|d Vqz | r||Vqz | r||Vqz|V |fr:||}n" | rR||}n ||}|EdHqzW|dk r|d8}d|Vd Vdk r|=dS) Nz[]zCircular reference detected[r TFnulltruefalse]r) Zlst_current_indent_levelmarkeridZbufnewline_indentZ separatorfirstvaluer;)r=rG _floatstr_indent_intstr_item_separatorrH_iterencode_dict_iterencode_listdictrAidintr5r8rFr6r9rrr]s\               z*_make_iterencode.._iterencode_listc 3sL|sdVdSdk r6|}|kr.d||<dVdk rh|d7}d|}|}|Vnd}}d} rt|jddd }n|j}xx|D]n\}}|rnr| rȈ|}n^|dkrd }nP|d krd }nB|dkrd }n4|r|}n rqntdt|d|r2d }n|V|V V|r`|Vq|dkrrd Vq|dkrd Vq|d krd Vq|r|Vq| rƈ|Vq|fr||} n"| r||} n ||} | EdHqW|dk r2|d8}d|VdVdk rH|=dS)Nz{}zCircular reference detected{rNr TcSs|dS)Nrr)Zkvrrrasz<_make_iterencode.._iterencode_dict..)keyrPFrQrOzkey z is not a string})sorteditemsr/r>) ZdctrSrTrUr+rVrfrcrWr;)r=rGrXrYrZr[rHr\r]_key_separator _skipkeys _sort_keysr^rAr_r`r5r8rFr6r9rrr\Ms                      z*_make_iterencode.._iterencode_dictc3s |r|Vn|dkr&dVn|dkr6dVn|dkrFdVn | r\|Vn | rr|Vn | fr||EdHnj |r||EdHnNdk rֈ |}|krΈd||<|}||EdHdk r|=dS)NrOTrPFrQzCircular reference detectedr)r2rSrT)r=_defaultrGrXrZrHr\r]r^rAr_r`r5r8rFr6r9rrrHs2       z%_make_iterencode.._iterencoder)rFrjrGrYrXrgr[rirhr3r=r^rAr_r`r5r8r6r9rZr)r=rjrGrXrYrZr[rHr\r]rgrhrir^rAr_r`r5r8rFr6r9rrEs .84O,rE)$rKreZ_jsonrZc_encode_basestring_ascii ImportErrorrZc_encode_basestringrrDcompilerrZHAS_UTF8rrangei setdefaultchrrrArCrr objectr!r=r^r_r`r5r8r6r9__str__rErrrrsT        >PK!=տ  %__pycache__/tool.cpython-36.opt-1.pycnu[3 \m@s>dZddlZddlZddlZddlZddZedkr:edS)aCommand-line tool to validate and pretty-print JSON Usage:: $ echo '{"json":"obj"}' | python -m json.tool { "json": "obj" } $ echo '{ 1.2:3.4}' | python -m json.tool Expecting property name enclosed in double quotes: line 1 column 3 (char 2) Nc "Cs d}d}tj||d}|jddtjdd|jddtjd d d|jd d d dd|j}|jphtj}|jpttj }|j }|Vy$|rt j |}nt j |t jd}Wn*tk r}zt|WYdd}~XnXWdQRX|"t j|||dd|jdWdQRXdS)Nzpython -m json.toolzZA simple command line interface for json module to validate and pretty-print JSON objects.)prog descriptioninfile?z-a JSON file to be validated or pretty-printed)nargstypehelpoutfilewz%write the output of infile to outfilez --sort-keys store_trueFz5sort the output of dictionaries alphabetically by key)actiondefaultr)Zobject_pairs_hook) sort_keysindent )argparseArgumentParser add_argumentZFileType parse_argsrsysstdinr stdoutrjsonload collections OrderedDict ValueError SystemExitdumpwrite) rrparserZoptionsrr robjer$!/usr/lib64/python3.6/json/tool.pymains0    $r&__main__)__doc__rrrrr&__name__r$r$r$r% sPK!NTM++"__pycache__/encoder.cpython-36.pycnu[3 \>"@sBdZddlZyddlmZWnek r4dZYnXyddlmZWnek r^dZYnXyddlmZ Wnek rdZ YnXej dZ ej dZ ej dZ d d d d d dddZx&edD]ZejeedjeqWedZddZepeZddZep eZGdddeZeeeeeeee e!ej"f ddZ#dS)zImplementation of JSONEncoder N)encode_basestring_ascii)encode_basestring) make_encoderz[\x00-\x1f\\"\b\f\n\r\t]z([\\"]|[^\ -~])s[-]z\\z\"z\bz\fz\nz\rz\t)\"    z \u{0:04x}infcCsdd}dtj||dS)z5Return a JSON representation of a Python string cSst|jdS)Nr) ESCAPE_DCTgroup)matchr$/usr/lib64/python3.6/json/encoder.pyreplace(sz%py_encode_basestring..replacer)ESCAPEsub)srrrrpy_encode_basestring$srcCsdd}dtj||dS)zAReturn an ASCII-only JSON representation of a Python string c Ssv|jd}yt|Stk rpt|}|dkr.replacer) ESCAPE_ASCIIr)rrrrrpy_encode_basestring_ascii0sr c @sNeZdZdZdZdZddddddddddd Zd d Zd d ZdddZ dS) JSONEncoderaZExtensible JSON encoder for Python data structures. Supports the following objects and types by default: +-------------------+---------------+ | Python | JSON | +===================+===============+ | dict | object | +-------------------+---------------+ | list, tuple | array | +-------------------+---------------+ | str | string | +-------------------+---------------+ | int, float | number | +-------------------+---------------+ | True | true | +-------------------+---------------+ | False | false | +-------------------+---------------+ | None | null | +-------------------+---------------+ To extend this to recognize other objects, subclass and implement a ``.default()`` method with another method that returns a serializable object for ``o`` if possible, otherwise it should call the superclass implementation (to raise ``TypeError``). z, z: FTN)skipkeys ensure_asciicheck_circular allow_nan sort_keysindent separatorsdefaultc CsZ||_||_||_||_||_||_|dk r:|\|_|_n|dk rHd|_|dk rV||_dS)aConstructor for JSONEncoder, with sensible defaults. If skipkeys is false, then it is a TypeError to attempt encoding of keys that are not str, int, float or None. If skipkeys is True, such items are simply skipped. If ensure_ascii is true, the output is guaranteed to be str objects with all incoming non-ASCII characters escaped. If ensure_ascii is false, the output can contain non-ASCII characters. If check_circular is true, then lists, dicts, and custom encoded objects will be checked for circular references during encoding to prevent an infinite recursion (which would cause an OverflowError). Otherwise, no such check takes place. If allow_nan is true, then NaN, Infinity, and -Infinity will be encoded as such. This behavior is not JSON specification compliant, but is consistent with most JavaScript based encoders and decoders. Otherwise, it will be a ValueError to encode such floats. If sort_keys is true, then the output of dictionaries will be sorted by key; this is useful for regression tests to ensure that JSON serializations can be compared on a day-to-day basis. If indent is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. None is the most compact representation. If specified, separators should be an (item_separator, key_separator) tuple. The default is (', ', ': ') if *indent* is ``None`` and (',', ': ') otherwise. To get the most compact JSON representation, you should specify (',', ':') to eliminate whitespace. If specified, default is a function that gets called for objects that can't otherwise be serialized. It should return a JSON encodable version of the object or raise a ``TypeError``. N,) r"r#r$r%r&r'item_separator key_separatorr)) selfr"r#r$r%r&r'r(r)rrr__init__hs+zJSONEncoder.__init__cCstd|jjdS)alImplement this method in a subclass such that it returns a serializable object for ``o``, or calls the base implementation (to raise a ``TypeError``). For example, to support arbitrary iterators, you could implement default like this:: def default(self, o): try: iterable = iter(o) except TypeError: pass else: return list(iterable) # Let the base class default method raise the TypeError return JSONEncoder.default(self, o) z,Object of type '%s' is not JSON serializableN) TypeError __class____name__)r-orrrr)szJSONEncoder.defaultcCsNt|tr |jrt|St|S|j|dd}t|ttfsDt|}dj|S)zReturn a JSON string representation of a Python data structure. >>> from json.encoder import JSONEncoder >>> JSONEncoder().encode({"foo": ["bar", "baz"]}) '{"foo": ["bar", "baz"]}' T) _one_shot) isinstancestrr#rr iterencodelisttuplejoin)r-r2chunksrrrencodes zJSONEncoder.encodec Cs|jr i}nd}|jrt}nt}|jtjtt fdd}|rvtdk rv|j dkrvt||j ||j |j |j |j |j|j }n&t||j ||j ||j |j |j |j| }||dS)zEncode the given object and yield each string representation as available. For example:: for chunk in JSONEncoder().iterencode(bigobject): mysocket.write(chunk) NcSsJ||krd}n$||krd}n||kr*d}n||S|sFtdt||S)NZNaNZInfinityz -Infinityz2Out of range float values are not JSON compliant: ) ValueErrorrepr)r2r%Z_reprZ_infZ_neginftextrrrfloatstrs z(JSONEncoder.iterencode..floatstrr)r$r#rrr%float__repr__INFINITYc_make_encoderr'r)r,r+r&r"_make_iterencode)r-r2r3markers_encoderr@ _iterencoderrrr7s&       zJSONEncoder.iterencode)F) r1 __module__ __qualname____doc__r+r,r.r)r<r7rrrrr!Is6r!csdk r rd fdd  fdd fddS)N c 3s|sdVdSdk r6 |}|kr.d||<d}dk rh|d7}d|}|}||7}nd}}d}x|D]}|rd}n|} |r||Vqz|dkr|dVqz|dkr|d Vqz|dkr|d Vqz | r||Vqz | r||Vqz|V |fr:||}n" | rR||}n ||}|EdHqzW|dk r|d8}d|Vd Vdk r|=dS) Nz[]zCircular reference detected[r TFnulltruefalse]r) Zlst_current_indent_levelmarkeridZbufnewline_indentZ separatorfirstvaluer;)r=rG _floatstr_indent_intstr_item_separatorrH_iterencode_dict_iterencode_listdictrAidintr5r8rFr6r9rrr]s\               z*_make_iterencode.._iterencode_listc 3sL|sdVdSdk r6|}|kr.d||<dVdk rh|d7}d|}|}|Vnd}}d} rt|jddd }n|j}xx|D]n\}}|rnr| rȈ|}n^|dkrd }nP|d krd }nB|dkrd }n4|r|}n rqntdt|d|r2d }n|V|V V|r`|Vq|dkrrd Vq|dkrd Vq|d krd Vq|r|Vq| rƈ|Vq|fr||} n"| r||} n ||} | EdHqW|dk r2|d8}d|VdVdk rH|=dS)Nz{}zCircular reference detected{rNr TcSs|dS)Nrr)Zkvrrrasz<_make_iterencode.._iterencode_dict..)keyrPFrQrOzkey z is not a string})sorteditemsr/r>) ZdctrSrTrUr+rVrfrcrWr;)r=rGrXrYrZr[rHr\r]_key_separator _skipkeys _sort_keysr^rAr_r`r5r8rFr6r9rrr\Ms                      z*_make_iterencode.._iterencode_dictc3s |r|Vn|dkr&dVn|dkr6dVn|dkrFdVn | r\|Vn | rr|Vn | fr||EdHnj |r||EdHnNdk rֈ |}|krΈd||<|}||EdHdk r|=dS)NrOTrPFrQzCircular reference detectedr)r2rSrT)r=_defaultrGrXrZrHr\r]r^rAr_r`r5r8rFr6r9rrrHs2       z%_make_iterencode.._iterencoder)rFrjrGrYrXrgr[rirhr3r=r^rAr_r`r5r8r6r9rZr)r=rjrGrXrYrZr[rHr\r]rgrhrir^rAr_r`r5r8rFr6r9rrEs .84O,rE)$rKreZ_jsonrZc_encode_basestring_ascii ImportErrorrZc_encode_basestringrrDcompilerrZHAS_UTF8rrangei setdefaultchrrrArCrr objectr!r=r^r_r`r5r8r6r9__str__rErrrrsT        >PK!(__pycache__/scanner.cpython-36.opt-1.pycnu[3 \o @sjdZddlZyddlmZWnek r4dZYnXdgZejdejej Bej BZ ddZ epde ZdS)zJSON token scanner N) make_scannerrz)(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?c sv|j |j|j tj|j |j|j|j|j |j |j  f ddfdd}|S)Ncsy ||}Wntk r(t|YnX|dkrB ||d S|dkrd ||df S|dkr~||dfS|dkr|||ddkrd|dfS|dkr|||dd krd |dfS|d ko|||d d krd|d fS||}|dk rX|j\}}}|s&|rD||p2d|p            z#py_make_scanner.._scan_oncec sz ||SjXdS)N)clear)rr)rrr(r) scan_onceAs z"py_make_scanner..scan_once) r%r!r& NUMBER_REmatchr'r#r$r"rr r)contextr+r() rrrrr r!r"r#r$r%r&r'r)py_make_scanners"%r/) __doc__reZ_jsonrZc_make_scanner ImportError__all__compileVERBOSE MULTILINEDOTALLr,r/r(r(r(r)s :PK!f n(__pycache__/decoder.cpython-36.opt-2.pycnu[3 \)1@sddlZddlmZyddlmZWnek r<dZYnXddgZejej Bej BZ e dZ e dZe dZGd ddeZeee d Zejd e Zd d dddddddZddZdeejfddZepeZejde ZdZdejefddZejefddZGd ddeZdS)!N)scanner) scanstring JSONDecoderJSONDecodeErrornaninfz-infc@seZdZddZddZdS)rcCsb|jdd|d}||jdd|}d||||f}tj||||_||_||_||_||_dS)N rz%s: line %d column %d (char %d)) countrfind ValueError__init__msgdocposlinenocolno)selfrrrrrerrmsgr$/usr/lib64/python3.6/json/decoder.pyr s zJSONDecodeError.__init__cCs|j|j|j|jffS)N) __class__rrr)rrrr __reduce__*szJSONDecodeError.__reduce__N)__name__ __module__ __qualname__r rrrrrrs  )z -InfinityZInfinityNaNz(.*?)(["\\\x00-\x1f])"\/ r  )rrrbfnrtc Cs`||d|d}t|dkrL|ddkrLy t|dStk rJYnXd}t|||dS)Nr ZxXzInvalid \uXXXX escape)lenintr r)srescrrrr _decode_uXXXX;s r0TcCsg}|j}|d}x|||}|dkr4td|||j}|j\} } | rT|| | dkr`Pn.| dkr|rdj| } t| ||n || qy ||} Wn tk rtd||YnX| dkry || } Wn*tk rdj| } t| ||YnX|d7}nt||}|d7}d |ko.d knr|||d d krt||d}d |kondknrd|d d>|d B}|d7}t|} || qWdj ||fS)Nr zUnterminated string starting atrrz"Invalid control character {0!r} atuzInvalid \escape: {0!r}r)iiz\uiii ) appendrendgroupsformat IndexErrorKeyErrorr0chrjoin)r.r7strictZ_bZ_mZchunks_appendZbeginchunkZcontent terminatorrr/charZuniZuni2rrr py_scanstringEsP           2 rCz [ \t\n\r]*z c#Cs|\}} g} | j} |dkri}|j} || | d} | dkr| |krb||| j} || | d} | dkr|dk r|| }|| dfSi} |dk r|| } | | dfS| dkrtd|| | d7} xt|| |\}} | ||}|| | ddkr&||| j} || | ddkr&td|| | d7} y:|| |krf| d7} || |krf||| dj} Wntk r~YnXy||| \}} Wn4tk r}ztd||jdWYdd}~XnX| ||fy0|| } | |kr||| dj} || } Wntk rd} YnX| d7} | dkr6Pn| d krPtd || d||| j} || | d} | d7} | dkrtd|| dqW|dk r|| }|| fSt| } |dk r|| } | | fS) Nr r}z1Expecting property name enclosed in double quotes:zExpecting ':' delimiterzExpecting valuer5,zExpecting ',' delimiter) r6 setdefaultr7rrr: StopIterationvaluedict) s_and_endr> scan_once object_hookobject_pairs_hookmemo_w_wsr.r7ZpairsZ pairs_appendZmemo_getnextcharresultkeyrIerrrrr JSONObjects     "        rVc Csz|\}}g}|||d}||krF|||dj}|||d}|dkrZ||dfS|j}xy|||\} }Wn2tk r} ztd|| jdWYdd} ~ XnX|| |||d}||kr|||dj}|||d}|d7}|dkrPn|dkrtd||dy:|||krT|d7}|||krT|||dj}Wqdtk rlYqdXqdW||fS)Nr ]zExpecting valuerFzExpecting ',' delimiter)r7r6rHrrIr:) rKrLrPrQr.r7valuesrRr?rIrUrrr JSONArrays@ "   rYc@s<eZdZdddddddddZejfddZd d d ZdS) rNT)rM parse_float parse_intparse_constantr>rNcCsZ||_|p t|_|pt|_|p"tj|_||_||_ t |_ t |_ t|_i|_tj||_dS)N)rMfloatrZr-r[ _CONSTANTS __getitem__r\r>rNrVZ parse_objectrYZ parse_arrayrZ parse_stringrOrZ make_scannerrL)rrMrZr[r\r>rNrrrr s&   zJSONDecoder.__init__cCsF|j|||djd\}}|||j}|t|krBtd|||S)Nr)idxz Extra data) raw_decoder7r,r)rr.rPobjr7rrrdecodeNs   zJSONDecoder.decodercCsPy|j||\}}Wn2tk rF}ztd||jdWYdd}~XnX||fS)NzExpecting value)rLrHrrI)rr.r`rbr7rUrrrraYs "zJSONDecoder.raw_decode)r)rrrr WHITESPACEmatchrcrarrrrrs 1 )reZjsonrZ_jsonrZ c_scanstring ImportError__all__VERBOSE MULTILINEDOTALLFLAGSr]rZPosInfZNegInfr rr^compileZ STRINGCHUNKZ BACKSLASHr0rerCrdZWHITESPACE_STRrVrYobjectrrrrrs4    ; P%PK!ީi%__pycache__/tool.cpython-36.opt-2.pycnu[3 \m@s:ddlZddlZddlZddlZddZedkr6edS)Nc "Cs d}d}tj||d}|jddtjdd|jddtjd d d|jd d d dd|j}|jphtj}|jpttj }|j }|Vy$|rt j |}nt j |t jd}Wn*tk r}zt|WYdd}~XnXWdQRX|"t j|||dd|jdWdQRXdS)Nzpython -m json.toolzZA simple command line interface for json module to validate and pretty-print JSON objects.)prog descriptioninfile?z-a JSON file to be validated or pretty-printed)nargstypehelpoutfilewz%write the output of infile to outfilez --sort-keys store_trueFz5sort the output of dictionaries alphabetically by key)actiondefaultr)Zobject_pairs_hook) sort_keysindent )argparseArgumentParser add_argumentZFileType parse_argsrsysstdinr stdoutrjsonload collections OrderedDict ValueError SystemExitdumpwrite) rrparserZoptionsrr robjer$!/usr/lib64/python3.6/json/tool.pymains0    $r&__main__)rrrrr&__name__r$r$r$r% s PK!(__pycache__/encoder.cpython-36.opt-2.pycnu[3 \>"@s>ddlZyddlmZWnek r0dZYnXyddlmZWnek rZdZYnXyddlmZWnek rdZYnXej dZ ej dZ ej dZ dd d d d d ddZ x&edD]Ze jeedjeqWedZddZepeZddZepeZGdddeZeeeeeeeee ej!f ddZ"dS)N)encode_basestring_ascii)encode_basestring) make_encoderz[\x00-\x1f\\"\b\f\n\r\t]z([\\"]|[^\ -~])s[-]z\\z\"z\bz\fz\nz\rz\t)\"    z \u{0:04x}infcCsdd}dtj||dS)NcSst|jdS)Nr) ESCAPE_DCTgroup)matchr$/usr/lib64/python3.6/json/encoder.pyreplace(sz%py_encode_basestring..replacer)ESCAPEsub)srrrrpy_encode_basestring$srcCsdd}dtj||dS)Nc Ssv|jd}yt|Stk rpt|}|dkr.replacer) ESCAPE_ASCIIr)rrrrrpy_encode_basestring_ascii0sr c @sJeZdZdZdZdddddddddddZd d Zd d Zdd dZdS) JSONEncoderz, z: FTN)skipkeys ensure_asciicheck_circular allow_nan sort_keysindent separatorsdefaultc CsZ||_||_||_||_||_||_|dk r:|\|_|_n|dk rHd|_|dk rV||_dS)N,) r"r#r$r%r&r'item_separator key_separatorr)) selfr"r#r$r%r&r'r(r)rrr__init__hs+zJSONEncoder.__init__cCstd|jjdS)Nz,Object of type '%s' is not JSON serializable) TypeError __class____name__)r-orrrr)szJSONEncoder.defaultcCsNt|tr |jrt|St|S|j|dd}t|ttfsDt|}dj|S)NT) _one_shot) isinstancestrr#rr iterencodelisttuplejoin)r-r2chunksrrrencodes zJSONEncoder.encodec Cs|jr i}nd}|jrt}nt}|jtjtt fdd}|rvtdk rv|j dkrvt||j ||j |j |j |j |j|j }n&t||j ||j ||j |j |j |j| }||dS)NcSsJ||krd}n$||krd}n||kr*d}n||S|sFtdt||S)NZNaNZInfinityz -Infinityz2Out of range float values are not JSON compliant: ) ValueErrorrepr)r2r%Z_reprZ_infZ_neginftextrrrfloatstrs z(JSONEncoder.iterencode..floatstrr)r$r#rrr%float__repr__INFINITYc_make_encoderr'r)r,r+r&r"_make_iterencode)r-r2r3markers_encoderr@ _iterencoderrrr7s&       zJSONEncoder.iterencode)F) r1 __module__ __qualname__r+r,r.r)r<r7rrrrr!Is6r!csdk r rd fdd  fdd fddS)N c 3s|sdVdSdk r6 |}|kr.d||<d}dk rh|d7}d|}|}||7}nd}}d}x|D]}|rd}n|} |r||Vqz|dkr|dVqz|dkr|d Vqz|dkr|d Vqz | r||Vqz | r||Vqz|V |fr:||}n" | rR||}n ||}|EdHqzW|dk r|d8}d|Vd Vdk r|=dS) Nz[]zCircular reference detected[r TFnulltruefalse]r) Zlst_current_indent_levelmarkeridZbufnewline_indentZ separatorfirstvaluer;)r=rG _floatstr_indent_intstr_item_separatorrH_iterencode_dict_iterencode_listdictrAidintr5r8rFr6r9rrr\s\               z*_make_iterencode.._iterencode_listc 3sL|sdVdSdk r6|}|kr.d||<dVdk rh|d7}d|}|}|Vnd}}d} rt|jddd }n|j}xx|D]n\}}|rnr| rȈ|}n^|dkrd }nP|d krd }nB|dkrd }n4|r|}n rqntdt|d|r2d }n|V|V V|r`|Vq|dkrrd Vq|dkrd Vq|d krd Vq|r|Vq| rƈ|Vq|fr||} n"| r||} n ||} | EdHqW|dk r2|d8}d|VdVdk rH|=dS)Nz{}zCircular reference detected{rMr TcSs|dS)Nrr)Zkvrrrasz<_make_iterencode.._iterencode_dict..)keyrOFrPrNzkey z is not a string})sorteditemsr/r>) ZdctrRrSrTr+rUrerbrVr;)r=rGrWrXrYrZrHr[r\_key_separator _skipkeys _sort_keysr]rAr^r_r5r8rFr6r9rrr[Ms                      z*_make_iterencode.._iterencode_dictc3s |r|Vn|dkr&dVn|dkr6dVn|dkrFdVn | r\|Vn | rr|Vn | fr||EdHnj |r||EdHnNdk rֈ |}|krΈd||<|}||EdHdk r|=dS)NrNTrOFrPzCircular reference detectedr)r2rRrS)r=_defaultrGrWrYrHr[r\r]rAr^r_r5r8rFr6r9rrrHs2       z%_make_iterencode.._iterencoder)rFrirGrXrWrfrZrhrgr3r=r]rAr^r_r5r8r6r9rYr)r=rirGrWrXrYrZrHr[r\rfrgrhr]rAr^r_r5r8rFr6r9rrEs .84O,rE)#reZ_jsonrZc_encode_basestring_ascii ImportErrorrZc_encode_basestringrrDcompilerrZHAS_UTF8rrangei setdefaultchrrrArCrr objectr!r=r]r^r_r5r8r6r9__str__rErrrrsR        >PK!=տ  __pycache__/tool.cpython-36.pycnu[3 \m@s>dZddlZddlZddlZddlZddZedkr:edS)aCommand-line tool to validate and pretty-print JSON Usage:: $ echo '{"json":"obj"}' | python -m json.tool { "json": "obj" } $ echo '{ 1.2:3.4}' | python -m json.tool Expecting property name enclosed in double quotes: line 1 column 3 (char 2) Nc "Cs d}d}tj||d}|jddtjdd|jddtjd d d|jd d d dd|j}|jphtj}|jpttj }|j }|Vy$|rt j |}nt j |t jd}Wn*tk r}zt|WYdd}~XnXWdQRX|"t j|||dd|jdWdQRXdS)Nzpython -m json.toolzZA simple command line interface for json module to validate and pretty-print JSON objects.)prog descriptioninfile?z-a JSON file to be validated or pretty-printed)nargstypehelpoutfilewz%write the output of infile to outfilez --sort-keys store_trueFz5sort the output of dictionaries alphabetically by key)actiondefaultr)Zobject_pairs_hook) sort_keysindent )argparseArgumentParser add_argumentZFileType parse_argsrsysstdinr stdoutrjsonload collections OrderedDict ValueError SystemExitdumpwrite) rrparserZoptionsrr robjer$!/usr/lib64/python3.6/json/tool.pymains0    $r&__main__)__doc__rrrrr&__name__r$r$r$r% sPK!.kW&&"__pycache__/decoder.cpython-36.pycnu[3 \)1@sdZddlZddlmZyddlmZWnek r@dZYnXddgZej ej Bej BZ e dZe dZe d ZGd ddeZeeed Zejd e Zd ddddddddZddZdeejfddZepeZejde ZdZdejefddZejefdd ZGd!ddeZdS)"zImplementation of JSONDecoder N)scanner) scanstring JSONDecoderJSONDecodeErrornaninfz-infc@s eZdZdZddZddZdS)ra Subclass of ValueError with the following additional properties: msg: The unformatted error message doc: The JSON document being parsed pos: The start index of doc where parsing failed lineno: The line corresponding to pos colno: The column corresponding to pos cCsb|jdd|d}||jdd|}d||||f}tj||||_||_||_||_||_dS)N rz%s: line %d column %d (char %d)) countrfind ValueError__init__msgdocposlinenocolno)selfrrrrrerrmsgr$/usr/lib64/python3.6/json/decoder.pyr s zJSONDecodeError.__init__cCs|j|j|j|jffS)N) __class__rrr)rrrr __reduce__*szJSONDecodeError.__reduce__N)__name__ __module__ __qualname____doc__r rrrrrrs  )z -InfinityZInfinityNaNz(.*?)(["\\\x00-\x1f])"\/ r  )rrr bfnrtc Cs`||d|d}t|dkrL|ddkrLy t|dStk rJYnXd}t|||dS)Nr ZxXzInvalid \uXXXX escape)lenintr r)srescrrrr _decode_uXXXX;s r1TcCsg}|j}|d}x|||}|dkr4td|||j}|j\} } | rT|| | dkr`Pn.| dkr|rdj| } t| ||n || qy ||} Wn tk rtd||YnX| dkry || } Wn*tk rdj| } t| ||YnX|d7}nt||}|d 7}d |ko.d knr|||d d krt||d}d|kondknrd|d d>|dB}|d7}t|} || qWdj ||fS)aScan the string s for a JSON string. End is the index of the character in s after the quote that started the JSON string. Unescapes all valid JSON string escape sequences and raises ValueError on attempt to decode an invalid string. If strict is False then literal control characters are allowed in the string. Returns a tuple of the decoded string and the index of the character in s after the end quote.r NzUnterminated string starting atrrz"Invalid control character {0!r} atuzInvalid \escape: {0!r}r*iiz\uiii ) appendrendgroupsformat IndexErrorKeyErrorr1chrjoin)r/r8strictZ_bZ_mZchunks_appendZbeginchunkZcontent terminatorrr0charZuniZuni2rrr py_scanstringEsP           2 rDz [ \t\n\r]*z c#Cs|\}} g} | j} |dkri}|j} || | d} | dkr| |krb||| j} || | d} | dkr|dk r|| }|| dfSi} |dk r|| } | | dfS| dkrtd|| | d7} xt|| |\}} | ||}|| | ddkr&||| j} || | ddkr&td|| | d7} y:|| |krf| d7} || |krf||| dj} Wntk r~YnXy||| \}} Wn4tk r}ztd||jdWYdd}~XnX| ||fy0|| } | |kr||| dj} || } Wntk rd} YnX| d7} | dkr6Pn| d krPtd || d||| j} || | d} | d7} | dkrtd|| dqW|dk r|| }|| fSt| } |dk r|| } | | fS) Nr r}z1Expecting property name enclosed in double quotes:zExpecting ':' delimiterzExpecting valuer6,zExpecting ',' delimiter) r7 setdefaultr8rrr; StopIterationvaluedict) s_and_endr? scan_once object_hookobject_pairs_hookmemo_w_wsr/r8ZpairsZ pairs_appendZmemo_getnextcharresultkeyrJerrrrr JSONObjects     "        rWc Csz|\}}g}|||d}||krF|||dj}|||d}|dkrZ||dfS|j}xy|||\} }Wn2tk r} ztd|| jdWYdd} ~ XnX|| |||d}||kr|||dj}|||d}|d7}|dkrPn|dkrtd||dy:|||krT|d7}|||krT|||dj}Wqdtk rlYqdXqdW||fS)Nr ]zExpecting valuerGzExpecting ',' delimiter)r8r7rIrrJr;) rLrMrQrRr/r8valuesrSr@rJrVrrr JSONArrays@ "   rZc@s@eZdZdZdddddddddZejfddZd d d ZdS) raSimple JSON decoder Performs the following translations in decoding by default: +---------------+-------------------+ | JSON | Python | +===============+===================+ | object | dict | +---------------+-------------------+ | array | list | +---------------+-------------------+ | string | str | +---------------+-------------------+ | number (int) | int | +---------------+-------------------+ | number (real) | float | +---------------+-------------------+ | true | True | +---------------+-------------------+ | false | False | +---------------+-------------------+ | null | None | +---------------+-------------------+ It also understands ``NaN``, ``Infinity``, and ``-Infinity`` as their corresponding ``float`` values, which is outside the JSON spec. NT)rN parse_float parse_intparse_constantr?rOcCsZ||_|p t|_|pt|_|p"tj|_||_||_ t |_ t |_ t|_i|_tj||_dS)aD``object_hook``, if specified, will be called with the result of every JSON object decoded and its return value will be used in place of the given ``dict``. This can be used to provide custom deserializations (e.g. to support JSON-RPC class hinting). ``object_pairs_hook``, if specified will be called with the result of every JSON object decoded with an ordered list of pairs. The return value of ``object_pairs_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders that rely on the order that the key and value pairs are decoded (for example, collections.OrderedDict will remember the order of insertion). If ``object_hook`` is also defined, the ``object_pairs_hook`` takes priority. ``parse_float``, if specified, will be called with the string of every JSON float to be decoded. By default this is equivalent to float(num_str). This can be used to use another datatype or parser for JSON floats (e.g. decimal.Decimal). ``parse_int``, if specified, will be called with the string of every JSON int to be decoded. By default this is equivalent to int(num_str). This can be used to use another datatype or parser for JSON integers (e.g. float). ``parse_constant``, if specified, will be called with one of the following strings: -Infinity, Infinity, NaN. This can be used to raise an exception if invalid JSON numbers are encountered. If ``strict`` is false (true is the default), then control characters will be allowed inside strings. Control characters in this context are those with character codes in the 0-31 range, including ``'\t'`` (tab), ``'\n'``, ``'\r'`` and ``'\0'``. N)rNfloatr[r.r\ _CONSTANTS __getitem__r]r?rOrWZ parse_objectrZZ parse_arrayrZ parse_stringrPrZ make_scannerrM)rrNr[r\r]r?rOrrrr s&   zJSONDecoder.__init__cCsF|j|||djd\}}|||j}|t|krBtd|||S)zlReturn the Python representation of ``s`` (a ``str`` instance containing a JSON document). r)idxz Extra data) raw_decoder8r-r)rr/rQobjr8rrrdecodeNs   zJSONDecoder.decodercCsPy|j||\}}Wn2tk rF}ztd||jdWYdd}~XnX||fS)a=Decode a JSON document from ``s`` (a ``str`` beginning with a JSON document) and return a 2-tuple of the Python representation and the index in ``s`` where the document ended. This can be used to decode a JSON document from a string that may have extraneous data at the end. zExpecting valueN)rMrIrrJ)rr/rarcr8rVrrrrbYs "zJSONDecoder.raw_decode)r) rrrrr WHITESPACEmatchrdrbrrrrrs 1 ) rreZjsonrZ_jsonrZ c_scanstring ImportError__all__VERBOSE MULTILINEDOTALLFLAGSr^rZPosInfZNegInfr rr_compileZ STRINGCHUNKZ BACKSLASHr1rfrDreZWHITESPACE_STRrWrZobjectrrrrrs6    ; P%PK!~tc1c1#__pycache__/__init__.cpython-36.pycnu[3 \<8 @sdZdZdddddddgZd Zd d lmZmZd d lmZd dl Z eddddddddZ dddddddddd ddZ dddddddddd ddZ edddZ ddZdddddddddZddddddddddZdS)a JSON (JavaScript Object Notation) is a subset of JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data interchange format. :mod:`json` exposes an API familiar to users of the standard library :mod:`marshal` and :mod:`pickle` modules. It is derived from a version of the externally maintained simplejson library. Encoding basic Python object hierarchies:: >>> import json >>> json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}]) '["foo", {"bar": ["baz", null, 1.0, 2]}]' >>> print(json.dumps("\"foo\bar")) "\"foo\bar" >>> print(json.dumps('\u1234')) "\u1234" >>> print(json.dumps('\\')) "\\" >>> print(json.dumps({"c": 0, "b": 0, "a": 0}, sort_keys=True)) {"a": 0, "b": 0, "c": 0} >>> from io import StringIO >>> io = StringIO() >>> json.dump(['streaming API'], io) >>> io.getvalue() '["streaming API"]' Compact encoding:: >>> import json >>> from collections import OrderedDict >>> mydict = OrderedDict([('4', 5), ('6', 7)]) >>> json.dumps([1,2,3,mydict], separators=(',', ':')) '[1,2,3,{"4":5,"6":7}]' Pretty printing:: >>> import json >>> print(json.dumps({'4': 5, '6': 7}, sort_keys=True, indent=4)) { "4": 5, "6": 7 } Decoding JSON:: >>> import json >>> obj = ['foo', {'bar': ['baz', None, 1.0, 2]}] >>> json.loads('["foo", {"bar":["baz", null, 1.0, 2]}]') == obj True >>> json.loads('"\\"foo\\bar"') == '"foo\x08ar' True >>> from io import StringIO >>> io = StringIO('["streaming API"]') >>> json.load(io)[0] == 'streaming API' True Specializing JSON object decoding:: >>> import json >>> def as_complex(dct): ... if '__complex__' in dct: ... return complex(dct['real'], dct['imag']) ... return dct ... >>> json.loads('{"__complex__": true, "real": 1, "imag": 2}', ... object_hook=as_complex) (1+2j) >>> from decimal import Decimal >>> json.loads('1.1', parse_float=Decimal) == Decimal('1.1') True Specializing JSON object encoding:: >>> import json >>> def encode_complex(obj): ... if isinstance(obj, complex): ... return [obj.real, obj.imag] ... raise TypeError(repr(obj) + " is not JSON serializable") ... >>> json.dumps(2 + 1j, default=encode_complex) '[2.0, 1.0]' >>> json.JSONEncoder(default=encode_complex).encode(2 + 1j) '[2.0, 1.0]' >>> ''.join(json.JSONEncoder(default=encode_complex).iterencode(2 + 1j)) '[2.0, 1.0]' Using json.tool from the shell to validate and pretty-print:: $ echo '{"json":"obj"}' | python -m json.tool { "json": "obj" } $ echo '{ 1.2:3.4}' | python -m json.tool Expecting property name enclosed in double quotes: line 1 column 3 (char 2) z2.0.9dumpdumpsloadloads JSONDecoderJSONDecodeError JSONEncoderzBob Ippolito )rr)rNFT)skipkeys ensure_asciicheck_circular allow_nanindent separatorsdefault) r r r r clsrrr sort_keysc  Ks| rJ|rJ|rJ|rJ|dkrJ|dkrJ|dkrJ| dkrJ| rJ| rJtj|} n2|dkrVt}|f||||||| | d| j|} x| D]} |j| qWdS)aSerialize ``obj`` as a JSON formatted stream to ``fp`` (a ``.write()``-supporting file-like object). If ``skipkeys`` is true then ``dict`` keys that are not basic types (``str``, ``int``, ``float``, ``bool``, ``None``) will be skipped instead of raising a ``TypeError``. If ``ensure_ascii`` is false, then the strings written to ``fp`` can contain non-ASCII characters if they appear in strings contained in ``obj``. Otherwise, all such characters are escaped in JSON strings. If ``check_circular`` is false, then the circular reference check for container types will be skipped and a circular reference will result in an ``OverflowError`` (or worse). If ``allow_nan`` is false, then it will be a ``ValueError`` to serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). If ``indent`` is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. ``None`` is the most compact representation. If specified, ``separators`` should be an ``(item_separator, key_separator)`` tuple. The default is ``(', ', ': ')`` if *indent* is ``None`` and ``(',', ': ')`` otherwise. To get the most compact JSON representation, you should specify ``(',', ':')`` to eliminate whitespace. ``default(obj)`` is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError. If *sort_keys* is true (default: ``False``), then the output of dictionaries will be sorted by key. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the ``.default()`` method to serialize additional types), specify it with the ``cls`` kwarg; otherwise ``JSONEncoder`` is used. N)r r r r rrrr)_default_encoder iterencoderwrite)objfpr r r r rrrrrkwiterablechunkr%/usr/lib64/python3.6/json/__init__.pyrxs-   c Ksz| rH|rH|rH|rH|dkrH|dkrH|dkrH|dkrH| rH| rHtj|S|dkrTt}|f|||||||| d| j|S)auSerialize ``obj`` to a JSON formatted ``str``. If ``skipkeys`` is true then ``dict`` keys that are not basic types (``str``, ``int``, ``float``, ``bool``, ``None``) will be skipped instead of raising a ``TypeError``. If ``ensure_ascii`` is false, then the return value can contain non-ASCII characters if they appear in strings contained in ``obj``. Otherwise, all such characters are escaped in JSON strings. If ``check_circular`` is false, then the circular reference check for container types will be skipped and a circular reference will result in an ``OverflowError`` (or worse). If ``allow_nan`` is false, then it will be a ``ValueError`` to serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). If ``indent`` is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. ``None`` is the most compact representation. If specified, ``separators`` should be an ``(item_separator, key_separator)`` tuple. The default is ``(', ', ': ')`` if *indent* is ``None`` and ``(',', ': ')`` otherwise. To get the most compact JSON representation, you should specify ``(',', ':')`` to eliminate whitespace. ``default(obj)`` is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError. If *sort_keys* is true (default: ``False``), then the output of dictionaries will be sorted by key. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the ``.default()`` method to serialize additional types), specify it with the ``cls`` kwarg; otherwise ``JSONEncoder`` is used. N)r r r r rrrr)rencoder) rr r r r rrrrrrrrrrs,   ) object_hookobject_pairs_hookcCs|j}|tjtjfrdS|tjtjfr.dS|tjras6  =8 PK!~tc1c1)__pycache__/__init__.cpython-36.opt-1.pycnu[3 \<8 @sdZdZdddddddgZd Zd d lmZmZd d lmZd dl Z eddddddddZ dddddddddd ddZ dddddddddd ddZ edddZ ddZdddddddddZddddddddddZdS)a JSON (JavaScript Object Notation) is a subset of JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data interchange format. :mod:`json` exposes an API familiar to users of the standard library :mod:`marshal` and :mod:`pickle` modules. It is derived from a version of the externally maintained simplejson library. Encoding basic Python object hierarchies:: >>> import json >>> json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}]) '["foo", {"bar": ["baz", null, 1.0, 2]}]' >>> print(json.dumps("\"foo\bar")) "\"foo\bar" >>> print(json.dumps('\u1234')) "\u1234" >>> print(json.dumps('\\')) "\\" >>> print(json.dumps({"c": 0, "b": 0, "a": 0}, sort_keys=True)) {"a": 0, "b": 0, "c": 0} >>> from io import StringIO >>> io = StringIO() >>> json.dump(['streaming API'], io) >>> io.getvalue() '["streaming API"]' Compact encoding:: >>> import json >>> from collections import OrderedDict >>> mydict = OrderedDict([('4', 5), ('6', 7)]) >>> json.dumps([1,2,3,mydict], separators=(',', ':')) '[1,2,3,{"4":5,"6":7}]' Pretty printing:: >>> import json >>> print(json.dumps({'4': 5, '6': 7}, sort_keys=True, indent=4)) { "4": 5, "6": 7 } Decoding JSON:: >>> import json >>> obj = ['foo', {'bar': ['baz', None, 1.0, 2]}] >>> json.loads('["foo", {"bar":["baz", null, 1.0, 2]}]') == obj True >>> json.loads('"\\"foo\\bar"') == '"foo\x08ar' True >>> from io import StringIO >>> io = StringIO('["streaming API"]') >>> json.load(io)[0] == 'streaming API' True Specializing JSON object decoding:: >>> import json >>> def as_complex(dct): ... if '__complex__' in dct: ... return complex(dct['real'], dct['imag']) ... return dct ... >>> json.loads('{"__complex__": true, "real": 1, "imag": 2}', ... object_hook=as_complex) (1+2j) >>> from decimal import Decimal >>> json.loads('1.1', parse_float=Decimal) == Decimal('1.1') True Specializing JSON object encoding:: >>> import json >>> def encode_complex(obj): ... if isinstance(obj, complex): ... return [obj.real, obj.imag] ... raise TypeError(repr(obj) + " is not JSON serializable") ... >>> json.dumps(2 + 1j, default=encode_complex) '[2.0, 1.0]' >>> json.JSONEncoder(default=encode_complex).encode(2 + 1j) '[2.0, 1.0]' >>> ''.join(json.JSONEncoder(default=encode_complex).iterencode(2 + 1j)) '[2.0, 1.0]' Using json.tool from the shell to validate and pretty-print:: $ echo '{"json":"obj"}' | python -m json.tool { "json": "obj" } $ echo '{ 1.2:3.4}' | python -m json.tool Expecting property name enclosed in double quotes: line 1 column 3 (char 2) z2.0.9dumpdumpsloadloads JSONDecoderJSONDecodeError JSONEncoderzBob Ippolito )rr)rNFT)skipkeys ensure_asciicheck_circular allow_nanindent separatorsdefault) r r r r clsrrr sort_keysc  Ks| rJ|rJ|rJ|rJ|dkrJ|dkrJ|dkrJ| dkrJ| rJ| rJtj|} n2|dkrVt}|f||||||| | d| j|} x| D]} |j| qWdS)aSerialize ``obj`` as a JSON formatted stream to ``fp`` (a ``.write()``-supporting file-like object). If ``skipkeys`` is true then ``dict`` keys that are not basic types (``str``, ``int``, ``float``, ``bool``, ``None``) will be skipped instead of raising a ``TypeError``. If ``ensure_ascii`` is false, then the strings written to ``fp`` can contain non-ASCII characters if they appear in strings contained in ``obj``. Otherwise, all such characters are escaped in JSON strings. If ``check_circular`` is false, then the circular reference check for container types will be skipped and a circular reference will result in an ``OverflowError`` (or worse). If ``allow_nan`` is false, then it will be a ``ValueError`` to serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). If ``indent`` is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. ``None`` is the most compact representation. If specified, ``separators`` should be an ``(item_separator, key_separator)`` tuple. The default is ``(', ', ': ')`` if *indent* is ``None`` and ``(',', ': ')`` otherwise. To get the most compact JSON representation, you should specify ``(',', ':')`` to eliminate whitespace. ``default(obj)`` is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError. If *sort_keys* is true (default: ``False``), then the output of dictionaries will be sorted by key. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the ``.default()`` method to serialize additional types), specify it with the ``cls`` kwarg; otherwise ``JSONEncoder`` is used. N)r r r r rrrr)_default_encoder iterencoderwrite)objfpr r r r rrrrrkwiterablechunkr%/usr/lib64/python3.6/json/__init__.pyrxs-   c Ksz| rH|rH|rH|rH|dkrH|dkrH|dkrH|dkrH| rH| rHtj|S|dkrTt}|f|||||||| d| j|S)auSerialize ``obj`` to a JSON formatted ``str``. If ``skipkeys`` is true then ``dict`` keys that are not basic types (``str``, ``int``, ``float``, ``bool``, ``None``) will be skipped instead of raising a ``TypeError``. If ``ensure_ascii`` is false, then the return value can contain non-ASCII characters if they appear in strings contained in ``obj``. Otherwise, all such characters are escaped in JSON strings. If ``check_circular`` is false, then the circular reference check for container types will be skipped and a circular reference will result in an ``OverflowError`` (or worse). If ``allow_nan`` is false, then it will be a ``ValueError`` to serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). If ``indent`` is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. ``None`` is the most compact representation. If specified, ``separators`` should be an ``(item_separator, key_separator)`` tuple. The default is ``(', ', ': ')`` if *indent* is ``None`` and ``(',', ': ')`` otherwise. To get the most compact JSON representation, you should specify ``(',', ':')`` to eliminate whitespace. ``default(obj)`` is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError. If *sort_keys* is true (default: ``False``), then the output of dictionaries will be sorted by key. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the ``.default()`` method to serialize additional types), specify it with the ``cls`` kwarg; otherwise ``JSONEncoder`` is used. N)r r r r rrrr)rencoder) rr r r r rrrrrrrrrrs,   ) object_hookobject_pairs_hookcCs|j}|tjtjfrdS|tjtjfr.dS|tjras6  =8 PK!.kW&&(__pycache__/decoder.cpython-36.opt-1.pycnu[3 \)1@sdZddlZddlmZyddlmZWnek r@dZYnXddgZej ej Bej BZ e dZe dZe d ZGd ddeZeeed Zejd e Zd ddddddddZddZdeejfddZepeZejde ZdZdejefddZejefdd ZGd!ddeZdS)"zImplementation of JSONDecoder N)scanner) scanstring JSONDecoderJSONDecodeErrornaninfz-infc@s eZdZdZddZddZdS)ra Subclass of ValueError with the following additional properties: msg: The unformatted error message doc: The JSON document being parsed pos: The start index of doc where parsing failed lineno: The line corresponding to pos colno: The column corresponding to pos cCsb|jdd|d}||jdd|}d||||f}tj||||_||_||_||_||_dS)N rz%s: line %d column %d (char %d)) countrfind ValueError__init__msgdocposlinenocolno)selfrrrrrerrmsgr$/usr/lib64/python3.6/json/decoder.pyr s zJSONDecodeError.__init__cCs|j|j|j|jffS)N) __class__rrr)rrrr __reduce__*szJSONDecodeError.__reduce__N)__name__ __module__ __qualname____doc__r rrrrrrs  )z -InfinityZInfinityNaNz(.*?)(["\\\x00-\x1f])"\/ r  )rrr bfnrtc Cs`||d|d}t|dkrL|ddkrLy t|dStk rJYnXd}t|||dS)Nr ZxXzInvalid \uXXXX escape)lenintr r)srescrrrr _decode_uXXXX;s r1TcCsg}|j}|d}x|||}|dkr4td|||j}|j\} } | rT|| | dkr`Pn.| dkr|rdj| } t| ||n || qy ||} Wn tk rtd||YnX| dkry || } Wn*tk rdj| } t| ||YnX|d7}nt||}|d 7}d |ko.d knr|||d d krt||d}d|kondknrd|d d>|dB}|d7}t|} || qWdj ||fS)aScan the string s for a JSON string. End is the index of the character in s after the quote that started the JSON string. Unescapes all valid JSON string escape sequences and raises ValueError on attempt to decode an invalid string. If strict is False then literal control characters are allowed in the string. Returns a tuple of the decoded string and the index of the character in s after the end quote.r NzUnterminated string starting atrrz"Invalid control character {0!r} atuzInvalid \escape: {0!r}r*iiz\uiii ) appendrendgroupsformat IndexErrorKeyErrorr1chrjoin)r/r8strictZ_bZ_mZchunks_appendZbeginchunkZcontent terminatorrr0charZuniZuni2rrr py_scanstringEsP           2 rDz [ \t\n\r]*z c#Cs|\}} g} | j} |dkri}|j} || | d} | dkr| |krb||| j} || | d} | dkr|dk r|| }|| dfSi} |dk r|| } | | dfS| dkrtd|| | d7} xt|| |\}} | ||}|| | ddkr&||| j} || | ddkr&td|| | d7} y:|| |krf| d7} || |krf||| dj} Wntk r~YnXy||| \}} Wn4tk r}ztd||jdWYdd}~XnX| ||fy0|| } | |kr||| dj} || } Wntk rd} YnX| d7} | dkr6Pn| d krPtd || d||| j} || | d} | d7} | dkrtd|| dqW|dk r|| }|| fSt| } |dk r|| } | | fS) Nr r}z1Expecting property name enclosed in double quotes:zExpecting ':' delimiterzExpecting valuer6,zExpecting ',' delimiter) r7 setdefaultr8rrr; StopIterationvaluedict) s_and_endr? scan_once object_hookobject_pairs_hookmemo_w_wsr/r8ZpairsZ pairs_appendZmemo_getnextcharresultkeyrJerrrrr JSONObjects     "        rWc Csz|\}}g}|||d}||krF|||dj}|||d}|dkrZ||dfS|j}xy|||\} }Wn2tk r} ztd|| jdWYdd} ~ XnX|| |||d}||kr|||dj}|||d}|d7}|dkrPn|dkrtd||dy:|||krT|d7}|||krT|||dj}Wqdtk rlYqdXqdW||fS)Nr ]zExpecting valuerGzExpecting ',' delimiter)r8r7rIrrJr;) rLrMrQrRr/r8valuesrSr@rJrVrrr JSONArrays@ "   rZc@s@eZdZdZdddddddddZejfddZd d d ZdS) raSimple JSON decoder Performs the following translations in decoding by default: +---------------+-------------------+ | JSON | Python | +===============+===================+ | object | dict | +---------------+-------------------+ | array | list | +---------------+-------------------+ | string | str | +---------------+-------------------+ | number (int) | int | +---------------+-------------------+ | number (real) | float | +---------------+-------------------+ | true | True | +---------------+-------------------+ | false | False | +---------------+-------------------+ | null | None | +---------------+-------------------+ It also understands ``NaN``, ``Infinity``, and ``-Infinity`` as their corresponding ``float`` values, which is outside the JSON spec. NT)rN parse_float parse_intparse_constantr?rOcCsZ||_|p t|_|pt|_|p"tj|_||_||_ t |_ t |_ t|_i|_tj||_dS)aD``object_hook``, if specified, will be called with the result of every JSON object decoded and its return value will be used in place of the given ``dict``. This can be used to provide custom deserializations (e.g. to support JSON-RPC class hinting). ``object_pairs_hook``, if specified will be called with the result of every JSON object decoded with an ordered list of pairs. The return value of ``object_pairs_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders that rely on the order that the key and value pairs are decoded (for example, collections.OrderedDict will remember the order of insertion). If ``object_hook`` is also defined, the ``object_pairs_hook`` takes priority. ``parse_float``, if specified, will be called with the string of every JSON float to be decoded. By default this is equivalent to float(num_str). This can be used to use another datatype or parser for JSON floats (e.g. decimal.Decimal). ``parse_int``, if specified, will be called with the string of every JSON int to be decoded. By default this is equivalent to int(num_str). This can be used to use another datatype or parser for JSON integers (e.g. float). ``parse_constant``, if specified, will be called with one of the following strings: -Infinity, Infinity, NaN. This can be used to raise an exception if invalid JSON numbers are encountered. If ``strict`` is false (true is the default), then control characters will be allowed inside strings. Control characters in this context are those with character codes in the 0-31 range, including ``'\t'`` (tab), ``'\n'``, ``'\r'`` and ``'\0'``. N)rNfloatr[r.r\ _CONSTANTS __getitem__r]r?rOrWZ parse_objectrZZ parse_arrayrZ parse_stringrPrZ make_scannerrM)rrNr[r\r]r?rOrrrr s&   zJSONDecoder.__init__cCsF|j|||djd\}}|||j}|t|krBtd|||S)zlReturn the Python representation of ``s`` (a ``str`` instance containing a JSON document). r)idxz Extra data) raw_decoder8r-r)rr/rQobjr8rrrdecodeNs   zJSONDecoder.decodercCsPy|j||\}}Wn2tk rF}ztd||jdWYdd}~XnX||fS)a=Decode a JSON document from ``s`` (a ``str`` beginning with a JSON document) and return a 2-tuple of the Python representation and the index in ``s`` where the document ended. This can be used to decode a JSON document from a string that may have extraneous data at the end. zExpecting valueN)rMrIrrJ)rr/rarcr8rVrrrrbYs "zJSONDecoder.raw_decode)r) rrrrr WHITESPACEmatchrdrbrrrrrs 1 ) rreZjsonrZ_jsonrZ c_scanstring ImportError__all__VERBOSE MULTILINEDOTALLFLAGSr^rZPosInfZNegInfr rr_compileZ STRINGCHUNKZ BACKSLASHr1rfrDreZWHITESPACE_STRrWrZobjectrrrrrs6    ; P%PK!"__pycache__/scanner.cpython-36.pycnu[3 \o @sjdZddlZyddlmZWnek r4dZYnXdgZejdejej Bej BZ ddZ epde ZdS)zJSON token scanner N) make_scannerrz)(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?c sv|j |j|j tj|j |j|j|j|j |j |j  f ddfdd}|S)Ncsy ||}Wntk r(t|YnX|dkrB ||d S|dkrd ||df S|dkr~||dfS|dkr|||ddkrd|dfS|dkr|||dd krd |dfS|d ko|||d d krd|d fS||}|dk rX|j\}}}|s&|rD||p2d|p            z#py_make_scanner.._scan_oncec sz ||SjXdS)N)clear)rr)rrr(r) scan_onceAs z"py_make_scanner..scan_once) r%r!r& NUMBER_REmatchr'r#r$r"rr r)contextr+r() rrrrr r!r"r#r$r%r&r'r)py_make_scanners"%r/) __doc__reZ_jsonrZc_make_scanner ImportError__all__compileVERBOSE MULTILINEDOTALLr,r/r(r(r(r)s :PK!Bs55 decoder.pynu["""Implementation of JSONDecoder """ import re import sys import struct from json import scanner try: from _json import scanstring as c_scanstring except ImportError: c_scanstring = None __all__ = ['JSONDecoder'] FLAGS = re.VERBOSE | re.MULTILINE | re.DOTALL def _floatconstants(): nan, = struct.unpack('>d', b'\x7f\xf8\x00\x00\x00\x00\x00\x00') inf, = struct.unpack('>d', b'\x7f\xf0\x00\x00\x00\x00\x00\x00') return nan, inf, -inf NaN, PosInf, NegInf = _floatconstants() def linecol(doc, pos): lineno = doc.count('\n', 0, pos) + 1 if lineno == 1: colno = pos + 1 else: colno = pos - doc.rindex('\n', 0, pos) return lineno, colno def errmsg(msg, doc, pos, end=None): # Note that this function is called from _json lineno, colno = linecol(doc, pos) if end is None: fmt = '{0}: line {1} column {2} (char {3})' return fmt.format(msg, lineno, colno, pos) #fmt = '%s: line %d column %d (char %d)' #return fmt % (msg, lineno, colno, pos) endlineno, endcolno = linecol(doc, end) fmt = '{0}: line {1} column {2} - line {3} column {4} (char {5} - {6})' return fmt.format(msg, lineno, colno, endlineno, endcolno, pos, end) #fmt = '%s: line %d column %d - line %d column %d (char %d - %d)' #return fmt % (msg, lineno, colno, endlineno, endcolno, pos, end) _CONSTANTS = { '-Infinity': NegInf, 'Infinity': PosInf, 'NaN': NaN, } STRINGCHUNK = re.compile(r'(.*?)(["\\\x00-\x1f])', FLAGS) BACKSLASH = { '"': u'"', '\\': u'\\', '/': u'/', 'b': u'\b', 'f': u'\f', 'n': u'\n', 'r': u'\r', 't': u'\t', } DEFAULT_ENCODING = "utf-8" def _decode_uXXXX(s, pos): esc = s[pos + 1:pos + 5] if len(esc) == 4 and esc[1] not in 'xX': try: return int(esc, 16) except ValueError: pass msg = "Invalid \\uXXXX escape" raise ValueError(errmsg(msg, s, pos)) def py_scanstring(s, end, encoding=None, strict=True, _b=BACKSLASH, _m=STRINGCHUNK.match): """Scan the string s for a JSON string. End is the index of the character in s after the quote that started the JSON string. Unescapes all valid JSON string escape sequences and raises ValueError on attempt to decode an invalid string. If strict is False then literal control characters are allowed in the string. Returns a tuple of the decoded string and the index of the character in s after the end quote.""" if encoding is None: encoding = DEFAULT_ENCODING chunks = [] _append = chunks.append begin = end - 1 while 1: chunk = _m(s, end) if chunk is None: raise ValueError( errmsg("Unterminated string starting at", s, begin)) end = chunk.end() content, terminator = chunk.groups() # Content is contains zero or more unescaped string characters if content: if not isinstance(content, unicode): content = unicode(content, encoding) _append(content) # Terminator is the end of string, a literal control character, # or a backslash denoting that an escape sequence follows if terminator == '"': break elif terminator != '\\': if strict: #msg = "Invalid control character %r at" % (terminator,) msg = "Invalid control character {0!r} at".format(terminator) raise ValueError(errmsg(msg, s, end)) else: _append(terminator) continue try: esc = s[end] except IndexError: raise ValueError( errmsg("Unterminated string starting at", s, begin)) # If not a unicode escape sequence, must be in the lookup table if esc != 'u': try: char = _b[esc] except KeyError: msg = "Invalid \\escape: " + repr(esc) raise ValueError(errmsg(msg, s, end)) end += 1 else: # Unicode escape sequence uni = _decode_uXXXX(s, end) end += 5 # Check for surrogate pair on UCS-4 systems if sys.maxunicode > 65535 and \ 0xd800 <= uni <= 0xdbff and s[end:end + 2] == '\\u': uni2 = _decode_uXXXX(s, end + 1) if 0xdc00 <= uni2 <= 0xdfff: uni = 0x10000 + (((uni - 0xd800) << 10) | (uni2 - 0xdc00)) end += 6 char = unichr(uni) # Append the unescaped character _append(char) return u''.join(chunks), end # Use speedup if available scanstring = c_scanstring or py_scanstring WHITESPACE = re.compile(r'[ \t\n\r]*', FLAGS) WHITESPACE_STR = ' \t\n\r' def JSONObject(s_and_end, encoding, strict, scan_once, object_hook, object_pairs_hook, _w=WHITESPACE.match, _ws=WHITESPACE_STR): s, end = s_and_end pairs = [] pairs_append = pairs.append # Use a slice to prevent IndexError from being raised, the following # check will raise a more specific ValueError if the string is empty nextchar = s[end:end + 1] # Normally we expect nextchar == '"' if nextchar != '"': if nextchar in _ws: end = _w(s, end).end() nextchar = s[end:end + 1] # Trivial empty object if nextchar == '}': if object_pairs_hook is not None: result = object_pairs_hook(pairs) return result, end + 1 pairs = {} if object_hook is not None: pairs = object_hook(pairs) return pairs, end + 1 elif nextchar != '"': raise ValueError(errmsg( "Expecting property name enclosed in double quotes", s, end)) end += 1 while True: key, end = scanstring(s, end, encoding, strict) # To skip some function call overhead we optimize the fast paths where # the JSON key separator is ": " or just ":". if s[end:end + 1] != ':': end = _w(s, end).end() if s[end:end + 1] != ':': raise ValueError(errmsg("Expecting ':' delimiter", s, end)) end += 1 try: if s[end] in _ws: end += 1 if s[end] in _ws: end = _w(s, end + 1).end() except IndexError: pass try: value, end = scan_once(s, end) except StopIteration: raise ValueError(errmsg("Expecting object", s, end)) pairs_append((key, value)) try: nextchar = s[end] if nextchar in _ws: end = _w(s, end + 1).end() nextchar = s[end] except IndexError: nextchar = '' end += 1 if nextchar == '}': break elif nextchar != ',': raise ValueError(errmsg("Expecting ',' delimiter", s, end - 1)) try: nextchar = s[end] if nextchar in _ws: end += 1 nextchar = s[end] if nextchar in _ws: end = _w(s, end + 1).end() nextchar = s[end] except IndexError: nextchar = '' end += 1 if nextchar != '"': raise ValueError(errmsg( "Expecting property name enclosed in double quotes", s, end - 1)) if object_pairs_hook is not None: result = object_pairs_hook(pairs) return result, end pairs = dict(pairs) if object_hook is not None: pairs = object_hook(pairs) return pairs, end def JSONArray(s_and_end, scan_once, _w=WHITESPACE.match, _ws=WHITESPACE_STR): s, end = s_and_end values = [] nextchar = s[end:end + 1] if nextchar in _ws: end = _w(s, end + 1).end() nextchar = s[end:end + 1] # Look-ahead for trivial empty array if nextchar == ']': return values, end + 1 _append = values.append while True: try: value, end = scan_once(s, end) except StopIteration: raise ValueError(errmsg("Expecting object", s, end)) _append(value) nextchar = s[end:end + 1] if nextchar in _ws: end = _w(s, end + 1).end() nextchar = s[end:end + 1] end += 1 if nextchar == ']': break elif nextchar != ',': raise ValueError(errmsg("Expecting ',' delimiter", s, end)) try: if s[end] in _ws: end += 1 if s[end] in _ws: end = _w(s, end + 1).end() except IndexError: pass return values, end class JSONDecoder(object): """Simple JSON decoder Performs the following translations in decoding by default: +---------------+-------------------+ | JSON | Python | +===============+===================+ | object | dict | +---------------+-------------------+ | array | list | +---------------+-------------------+ | string | unicode | +---------------+-------------------+ | number (int) | int, long | +---------------+-------------------+ | number (real) | float | +---------------+-------------------+ | true | True | +---------------+-------------------+ | false | False | +---------------+-------------------+ | null | None | +---------------+-------------------+ It also understands ``NaN``, ``Infinity``, and ``-Infinity`` as their corresponding ``float`` values, which is outside the JSON spec. """ def __init__(self, encoding=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, strict=True, object_pairs_hook=None): """``encoding`` determines the encoding used to interpret any ``str`` objects decoded by this instance (utf-8 by default). It has no effect when decoding ``unicode`` objects. Note that currently only encodings that are a superset of ASCII work, strings of other encodings should be passed in as ``unicode``. ``object_hook``, if specified, will be called with the result of every JSON object decoded and its return value will be used in place of the given ``dict``. This can be used to provide custom deserializations (e.g. to support JSON-RPC class hinting). ``object_pairs_hook``, if specified will be called with the result of every JSON object decoded with an ordered list of pairs. The return value of ``object_pairs_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders that rely on the order that the key and value pairs are decoded (for example, collections.OrderedDict will remember the order of insertion). If ``object_hook`` is also defined, the ``object_pairs_hook`` takes priority. ``parse_float``, if specified, will be called with the string of every JSON float to be decoded. By default this is equivalent to float(num_str). This can be used to use another datatype or parser for JSON floats (e.g. decimal.Decimal). ``parse_int``, if specified, will be called with the string of every JSON int to be decoded. By default this is equivalent to int(num_str). This can be used to use another datatype or parser for JSON integers (e.g. float). ``parse_constant``, if specified, will be called with one of the following strings: -Infinity, Infinity, NaN. This can be used to raise an exception if invalid JSON numbers are encountered. If ``strict`` is false (true is the default), then control characters will be allowed inside strings. Control characters in this context are those with character codes in the 0-31 range, including ``'\\t'`` (tab), ``'\\n'``, ``'\\r'`` and ``'\\0'``. """ self.encoding = encoding self.object_hook = object_hook self.object_pairs_hook = object_pairs_hook self.parse_float = parse_float or float self.parse_int = parse_int or int self.parse_constant = parse_constant or _CONSTANTS.__getitem__ self.strict = strict self.parse_object = JSONObject self.parse_array = JSONArray self.parse_string = scanstring self.scan_once = scanner.make_scanner(self) def decode(self, s, _w=WHITESPACE.match): """Return the Python representation of ``s`` (a ``str`` or ``unicode`` instance containing a JSON document) """ obj, end = self.raw_decode(s, idx=_w(s, 0).end()) end = _w(s, end).end() if end != len(s): raise ValueError(errmsg("Extra data", s, end, len(s))) return obj def raw_decode(self, s, idx=0): """Decode a JSON document from ``s`` (a ``str`` or ``unicode`` beginning with a JSON document) and return a 2-tuple of the Python representation and the index in ``s`` where the document ended. This can be used to decode a JSON document from a string that may have extraneous data at the end. """ try: obj, end = self.scan_once(s, idx) except StopIteration: raise ValueError("No JSON object could be decoded") return obj, end PK!A scanner.pynu["""JSON token scanner """ import re try: from _json import make_scanner as c_make_scanner except ImportError: c_make_scanner = None __all__ = ['make_scanner'] NUMBER_RE = re.compile( r'(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?', (re.VERBOSE | re.MULTILINE | re.DOTALL)) def py_make_scanner(context): parse_object = context.parse_object parse_array = context.parse_array parse_string = context.parse_string match_number = NUMBER_RE.match encoding = context.encoding strict = context.strict parse_float = context.parse_float parse_int = context.parse_int parse_constant = context.parse_constant object_hook = context.object_hook object_pairs_hook = context.object_pairs_hook def _scan_once(string, idx): try: nextchar = string[idx] except IndexError: raise StopIteration if nextchar == '"': return parse_string(string, idx + 1, encoding, strict) elif nextchar == '{': return parse_object((string, idx + 1), encoding, strict, _scan_once, object_hook, object_pairs_hook) elif nextchar == '[': return parse_array((string, idx + 1), _scan_once) elif nextchar == 'n' and string[idx:idx + 4] == 'null': return None, idx + 4 elif nextchar == 't' and string[idx:idx + 4] == 'true': return True, idx + 4 elif nextchar == 'f' and string[idx:idx + 5] == 'false': return False, idx + 5 m = match_number(string, idx) if m is not None: integer, frac, exp = m.groups() if frac or exp: res = parse_float(integer + (frac or '') + (exp or '')) else: res = parse_int(integer) return res, m.end() elif nextchar == 'N' and string[idx:idx + 3] == 'NaN': return parse_constant('NaN'), idx + 3 elif nextchar == 'I' and string[idx:idx + 8] == 'Infinity': return parse_constant('Infinity'), idx + 8 elif nextchar == '-' and string[idx:idx + 9] == '-Infinity': return parse_constant('-Infinity'), idx + 9 else: raise StopIteration return _scan_once make_scanner = c_make_scanner or py_make_scanner PK!]Ɗ(__pycache__/scanner.cpython-38.opt-1.pycnu[U e5dy @sjdZddlZzddlmZWnek r4dZYnXdgZedejej Bej BZ ddZ epde ZdS)zJSON token scanner N) make_scannerrz)(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?c sv|j |j|j tj|j |j|j|j|j |j |j  f ddfdd}|S)Ncsz ||}Wntk r*t|dYnX|dkrD ||d S|dkrf ||df S|dkr||dfS|dkr|||ddkrd|dfS|dkr|||dd krd |dfS|d kr|||d d krd|d fS||}|dk r\|\}}}|s*|rH||p6d|p@d}n|}||fS|dkr|||ddkrd|dfS|dkr|||ddkrd|dfS|dkr|||ddkrd|dfSt|dS)N"{[nZnullttrueTfZfalseFNZNaNIZInfinity- z -Infinity) IndexError StopIterationgroupsend)stringidxZnextcharmZintegerZfracZexpres _scan_onceZ match_numbermemo object_hookobject_pairs_hook parse_arrayparse_constant parse_float parse_int parse_object parse_stringstrict$/usr/lib64/python3.8/json/scanner.pyrsF            z#py_make_scanner.._scan_oncecsz||WSXdS)N)clear)rr)rrr(r) scan_onceAsz"py_make_scanner..scan_once) r%r!r& NUMBER_REmatchr'r#r$r"rr r)contextr+r(rr)py_make_scanners"%r/) __doc__reZ_jsonrZc_make_scanner ImportError__all__compileVERBOSE MULTILINEDOTALLr,r/r(r(r(r)s :PK!ɂjj__pycache__/tool.cpython-38.pycnu[U e5d @sjdZddlZddlZddlZddZedkrfz eWn.ek rdZzeej W5dZ[XYnXdS)aCommand-line tool to validate and pretty-print JSON Usage:: $ echo '{"json":"obj"}' | python -m json.tool { "json": "obj" } $ echo '{ 1.2:3.4}' | python -m json.tool Expecting property name enclosed in double quotes: line 1 column 3 (char 2) Nc Cs4d}d}tj||d}|jddtjdddtjd |jd dtjd ddd tjd |jd dddd|jddddd|}|j}|j }|j }|j }||~zJ|rdd|D}n t |f}|D] } t j| ||dd|dqWn,tk r} z t| W5d} ~ XYnXW5QRXW5QRXdS)Nzpython -m json.toolzZA simple command line interface for json module to validate and pretty-print JSON objects.)prog descriptioninfile?zutf-8)encodingz-a JSON file to be validated or pretty-printed)nargstypehelpdefaultoutfilewz%write the output of infile to outfilez --sort-keys store_trueFz5sort the output of dictionaries alphabetically by key)actionr r z --json-linesz&parse input using the jsonlines formatcss|]}t|VqdS)N)jsonloads).0liner!/usr/lib64/python3.8/json/tool.py ,szmain..) sort_keysindent )argparseArgumentParser add_argumentZFileTypesysstdinstdout parse_argsrr r json_linesrloaddumpwrite ValueError SystemExit) rrparserZoptionsrr rr!ZobjsobjerrrmainsD      r*__main__) __doc__rrrr*__name__BrokenPipeErrorexcexiterrnorrrrs $ PK!#ӽx}}(__pycache__/scanner.cpython-38.opt-2.pycnu[U e5dy @sfddlZzddlmZWnek r0dZYnXdgZedejejBej BZ ddZ ep`e ZdS)N) make_scannerrz)(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?c sv|j |j|j tj|j |j|j|j|j |j |j  f ddfdd}|S)Ncsz ||}Wntk r*t|dYnX|dkrD ||d S|dkrf ||df S|dkr||dfS|dkr|||ddkrd|dfS|dkr|||dd krd |dfS|d kr|||d d krd|d fS||}|dk r\|\}}}|s*|rH||p6d|p@d}n|}||fS|dkr|||ddkrd|dfS|dkr|||ddkrd|dfS|dkr|||ddkrd|dfSt|dS)N"{[nZnullttrueTfZfalseFNZNaNIZInfinity- z -Infinity) IndexError StopIterationgroupsend)stringidxZnextcharmZintegerZfracZexpres _scan_onceZ match_numbermemo object_hookobject_pairs_hook parse_arrayparse_constant parse_float parse_int parse_object parse_stringstrict$/usr/lib64/python3.8/json/scanner.pyrsF            z#py_make_scanner.._scan_oncecsz||WSXdS)N)clear)rr)rrr(r) scan_onceAsz"py_make_scanner..scan_once) r%r!r& NUMBER_REmatchr'r#r$r"rr r)contextr+r(rr)py_make_scanners"%r/) reZ_jsonrZc_make_scanner ImportError__all__compileVERBOSE MULTILINEDOTALLr,r/r(r(r(r)s :PK!OEB1B1)__pycache__/__init__.cpython-38.opt-1.pycnu[U e5d 8 @sdZdZdddddddgZd Zd d lmZmZd d lmZd dl Z eddddddddZ dddddddddd ddZ dddddddddd ddZ edddZ ddZdddddddddZdddddddddZdS)a JSON (JavaScript Object Notation) is a subset of JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data interchange format. :mod:`json` exposes an API familiar to users of the standard library :mod:`marshal` and :mod:`pickle` modules. It is derived from a version of the externally maintained simplejson library. Encoding basic Python object hierarchies:: >>> import json >>> json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}]) '["foo", {"bar": ["baz", null, 1.0, 2]}]' >>> print(json.dumps("\"foo\bar")) "\"foo\bar" >>> print(json.dumps('\u1234')) "\u1234" >>> print(json.dumps('\\')) "\\" >>> print(json.dumps({"c": 0, "b": 0, "a": 0}, sort_keys=True)) {"a": 0, "b": 0, "c": 0} >>> from io import StringIO >>> io = StringIO() >>> json.dump(['streaming API'], io) >>> io.getvalue() '["streaming API"]' Compact encoding:: >>> import json >>> mydict = {'4': 5, '6': 7} >>> json.dumps([1,2,3,mydict], separators=(',', ':')) '[1,2,3,{"4":5,"6":7}]' Pretty printing:: >>> import json >>> print(json.dumps({'4': 5, '6': 7}, sort_keys=True, indent=4)) { "4": 5, "6": 7 } Decoding JSON:: >>> import json >>> obj = ['foo', {'bar': ['baz', None, 1.0, 2]}] >>> json.loads('["foo", {"bar":["baz", null, 1.0, 2]}]') == obj True >>> json.loads('"\\"foo\\bar"') == '"foo\x08ar' True >>> from io import StringIO >>> io = StringIO('["streaming API"]') >>> json.load(io)[0] == 'streaming API' True Specializing JSON object decoding:: >>> import json >>> def as_complex(dct): ... if '__complex__' in dct: ... return complex(dct['real'], dct['imag']) ... return dct ... >>> json.loads('{"__complex__": true, "real": 1, "imag": 2}', ... object_hook=as_complex) (1+2j) >>> from decimal import Decimal >>> json.loads('1.1', parse_float=Decimal) == Decimal('1.1') True Specializing JSON object encoding:: >>> import json >>> def encode_complex(obj): ... if isinstance(obj, complex): ... return [obj.real, obj.imag] ... raise TypeError(f'Object of type {obj.__class__.__name__} ' ... f'is not JSON serializable') ... >>> json.dumps(2 + 1j, default=encode_complex) '[2.0, 1.0]' >>> json.JSONEncoder(default=encode_complex).encode(2 + 1j) '[2.0, 1.0]' >>> ''.join(json.JSONEncoder(default=encode_complex).iterencode(2 + 1j)) '[2.0, 1.0]' Using json.tool from the shell to validate and pretty-print:: $ echo '{"json":"obj"}' | python -m json.tool { "json": "obj" } $ echo '{ 1.2:3.4}' | python -m json.tool Expecting property name enclosed in double quotes: line 1 column 3 (char 2) z2.0.9dumpdumpsloadloads JSONDecoderJSONDecodeError JSONEncoderzBob Ippolito )rr)rNFT)skipkeys ensure_asciicheck_circular allow_nanindent separatorsdefault) r r r r clsrrr sort_keysc  Ks|sD|rD|rD|rD|dkrD|dkrD|dkrD| dkrD| sD| sDt|} n2|dkrPt}|f||||||| | d| |} | D]} || qzdS)aSerialize ``obj`` as a JSON formatted stream to ``fp`` (a ``.write()``-supporting file-like object). If ``skipkeys`` is true then ``dict`` keys that are not basic types (``str``, ``int``, ``float``, ``bool``, ``None``) will be skipped instead of raising a ``TypeError``. If ``ensure_ascii`` is false, then the strings written to ``fp`` can contain non-ASCII characters if they appear in strings contained in ``obj``. Otherwise, all such characters are escaped in JSON strings. If ``check_circular`` is false, then the circular reference check for container types will be skipped and a circular reference will result in an ``OverflowError`` (or worse). If ``allow_nan`` is false, then it will be a ``ValueError`` to serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). If ``indent`` is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. ``None`` is the most compact representation. If specified, ``separators`` should be an ``(item_separator, key_separator)`` tuple. The default is ``(', ', ': ')`` if *indent* is ``None`` and ``(',', ': ')`` otherwise. To get the most compact JSON representation, you should specify ``(',', ':')`` to eliminate whitespace. ``default(obj)`` is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError. If *sort_keys* is true (default: ``False``), then the output of dictionaries will be sorted by key. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the ``.default()`` method to serialize additional types), specify it with the ``cls`` kwarg; otherwise ``JSONEncoder`` is used. Nr r r r rrrr)_default_encoder iterencoderwrite)objfpr r r r rrrrrkwiterablechunkr%/usr/lib64/python3.8/json/__init__.pyrxsD- c Kst|sB|rB|rB|rB|dkrB|dkrB|dkrB|dkrB| sB| sBt|S|dkrNt}|f|||||||| d| |S)auSerialize ``obj`` to a JSON formatted ``str``. If ``skipkeys`` is true then ``dict`` keys that are not basic types (``str``, ``int``, ``float``, ``bool``, ``None``) will be skipped instead of raising a ``TypeError``. If ``ensure_ascii`` is false, then the return value can contain non-ASCII characters if they appear in strings contained in ``obj``. Otherwise, all such characters are escaped in JSON strings. If ``check_circular`` is false, then the circular reference check for container types will be skipped and a circular reference will result in an ``OverflowError`` (or worse). If ``allow_nan`` is false, then it will be a ``ValueError`` to serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). If ``indent`` is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. ``None`` is the most compact representation. If specified, ``separators`` should be an ``(item_separator, key_separator)`` tuple. The default is ``(', ', ': ')`` if *indent* is ``None`` and ``(',', ': ')`` otherwise. To get the most compact JSON representation, you should specify ``(',', ':')`` to eliminate whitespace. ``default(obj)`` is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError. If *sort_keys* is true (default: ``False``), then the output of dictionaries will be sorted by key. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the ``.default()`` method to serialize additional types), specify it with the ``cls`` kwarg; otherwise ``JSONEncoder`` is used. Nr)rencoder) rr r r r rrrrrrrrrrsD, ) object_hookobject_pairs_hookcCs|j}|tjtjfrdS|tjtjfr.dS|tjrrrrr+sT$     )__doc__ __version____all__ __author__decoderrrencoderrr%rrrrAr-rrrrrrsda   ? :  PK!(#EE%__pycache__/tool.cpython-38.opt-2.pycnu[U e5d @sfddlZddlZddlZddZedkrbz eWn.ek r`ZzeejW5dZ[XYnXdS)Nc Cs4d}d}tj||d}|jddtjdddtjd |jd dtjd ddd tjd |jd dddd|jddddd|}|j}|j }|j }|j }||~zJ|rdd|D}n t |f}|D] } t j| ||dd|dqWn,tk r} z t| W5d} ~ XYnXW5QRXW5QRXdS)Nzpython -m json.toolzZA simple command line interface for json module to validate and pretty-print JSON objects.)prog descriptioninfile?zutf-8)encodingz-a JSON file to be validated or pretty-printed)nargstypehelpdefaultoutfilewz%write the output of infile to outfilez --sort-keys store_trueFz5sort the output of dictionaries alphabetically by key)actionr r z --json-linesz&parse input using the jsonlines formatcss|]}t|VqdS)N)jsonloads).0liner!/usr/lib64/python3.8/json/tool.py ,szmain..) sort_keysindent )argparseArgumentParser add_argumentZFileTypesysstdinstdout parse_argsrr r json_linesrloaddumpwrite ValueError SystemExit) rrparserZoptionsrr rr!ZobjsobjerrrmainsD      r*__main__) rrrr*__name__BrokenPipeErrorexcexiterrnorrrr s$ PK!E )__pycache__/__init__.cpython-38.opt-2.pycnu[U e5d 8 @sdZdddddddgZdZd d lmZmZd d lmZd d lZeddddd d d dZ ddddd d d d dd ddZ ddddd d d d dd ddZ ed d dZ ddZ d d d d d d dddZd d d d d d dddZd S)z2.0.9dumpdumpsloadloads JSONDecoderJSONDecodeError JSONEncoderzBob Ippolito )rr)rNFT)skipkeys ensure_asciicheck_circular allow_nanindent separatorsdefault) r r r r clsrrr sort_keysc  Ks|sD|rD|rD|rD|dkrD|dkrD|dkrD| dkrD| sD| sDt|} n2|dkrPt}|f||||||| | d| |} | D]} || qzdSN)r r r r rrrr)_default_encoder iterencoderwrite)objfpr r r r rrrrrkwiterablechunkr%/usr/lib64/python3.8/json/__init__.pyrxsD- c Kst|sB|rB|rB|rB|dkrB|dkrB|dkrB|dkrB| sB| sBt|S|dkrNt}|f|||||||| d| |Sr)rencoder) rr r r r rrrrrrrrrrsD, ) object_hookobject_pairs_hookcCs|j}|tjtjfrdS|tjtjfr.dS|tjrrrrr+sT$     ) __version____all__ __author__decoderrrencoderrr%rrrrAr-rrrrrrbsb   ? :  PK!e4"v&v&(__pycache__/decoder.cpython-38.opt-1.pycnu[U e5d0 @sdZddlZddlmZzddlmZWnek r@dZYnXddgZej ej Bej BZ e dZe dZe d ZGd ddeZeeed Zed e Zd ddddddddZddZdeejfddZepeZede ZdZdejefddZejefdd ZGd!ddeZdS)"zImplementation of JSONDecoder N)scanner) scanstring JSONDecoderJSONDecodeErrornaninfz-infc@s eZdZdZddZddZdS)ra Subclass of ValueError with the following additional properties: msg: The unformatted error message doc: The JSON document being parsed pos: The start index of doc where parsing failed lineno: The line corresponding to pos colno: The column corresponding to pos cCsb|dd|d}||dd|}d||||f}t||||_||_||_||_||_dS)N rz%s: line %d column %d (char %d)) countrfind ValueError__init__msgdocposlinenocolno)selfrrrrrerrmsgr$/usr/lib64/python3.8/json/decoder.pyr s zJSONDecodeError.__init__cCs|j|j|j|jffS)N) __class__rrr)rrrr __reduce__*szJSONDecodeError.__reduce__N)__name__ __module__ __qualname____doc__r rrrrrrs  )z -InfinityZInfinityNaNz(.*?)(["\\\x00-\x1f])"\/ r  )rrr bfnrtcCsb||d|d}t|dkrN|ddkrNz t|dWStk rLYnXd}t|||dS)Nr ZxXzInvalid \uXXXX escape)lenintr r)srescrrrr _decode_uXXXX;s r1TcCsg}|j}|d}|||}|dkr0td|||}|\} } | rP|| | dkr^qn.| dkr|rd| } t| ||n || qz ||} Wn"tk rtd||dYnX| dkrz || } Wn*tk rd| } t| ||YnX|d7}nt||}|d 7}d |kr2d krnn`|||d d krt||d}d|krrdkrnn d|d d>|dB}|d7}t|} || qd ||fS)aScan the string s for a JSON string. End is the index of the character in s after the quote that started the JSON string. Unescapes all valid JSON string escape sequences and raises ValueError on attempt to decode an invalid string. If strict is False then literal control characters are allowed in the string. Returns a tuple of the decoded string and the index of the character in s after the end quote.r NzUnterminated string starting atrrz"Invalid control character {0!r} atuzInvalid \escape: {0!r}r*iiz\uiii ) appendrendgroupsformat IndexErrorKeyErrorr1chrjoin)r/r8strictZ_b_mZchunks_appendZbeginchunkZcontent terminatorrr0charZuniZuni2rrr py_scanstringEsX           2 rEz [ \t\n\r]*z c Cs|\}} g} | j} |dkri}|j} || | d} | dkr| |krb||| } || | d} | dkr|dk r|| }|| dfSi} |dk r|| } | | dfS| dkrtd|| | d7} t|| |\}} | ||}|| | ddkr"||| } || | ddkr"td|| | d7} z:|| |krb| d7} || |krb||| d} Wntk rzYnXz||| \}} Wn4tk r}ztd||jdW5d}~XYnX| ||fz0|| } | |kr||| d} || } Wntk rd} YnX| d7} | dkr4qn| d krNtd || d||| } || | d} | d7} | dkrtd|| dq|dk r|| }|| fSt| } |dk r|| } | | fS) Nr r}z1Expecting property name enclosed in double quotes:zExpecting ':' delimiterExpecting valuer6,Expecting ',' delimiter) r7 setdefaultr8rrr; StopIterationvaluedict) s_and_endr? scan_once object_hookobject_pairs_hookmemo_w_wsr/r8ZpairsZ pairs_appendZmemo_getnextcharresultkeyrMerrrrr JSONObjects    "        rZc Cst|\}}g}|||d}||krF|||d}|||d}|dkrZ||dfS|j}z|||\} }Wn2tk r} ztd|| jdW5d} ~ XYnX|| |||d}||kr|||d}|||d}|d7}|dkrqln|dkrtd||dz:|||krP|d7}|||krP|||d}Wq`tk rhYq`Xq`||fS)Nr ]rHrIrJ)r8r7rLrrMr;) rOrPrTrUr/r8valuesrVrArMrYrrr JSONArrays> " r]c@s@eZdZdZdddddddddZejfddZd d d ZdS) raSimple JSON decoder Performs the following translations in decoding by default: +---------------+-------------------+ | JSON | Python | +===============+===================+ | object | dict | +---------------+-------------------+ | array | list | +---------------+-------------------+ | string | str | +---------------+-------------------+ | number (int) | int | +---------------+-------------------+ | number (real) | float | +---------------+-------------------+ | true | True | +---------------+-------------------+ | false | False | +---------------+-------------------+ | null | None | +---------------+-------------------+ It also understands ``NaN``, ``Infinity``, and ``-Infinity`` as their corresponding ``float`` values, which is outside the JSON spec. NT)rQ parse_float parse_intparse_constantr?rRcCsZ||_|p t|_|pt|_|p"tj|_||_||_ t |_ t |_ t|_i|_t||_dS)a``object_hook``, if specified, will be called with the result of every JSON object decoded and its return value will be used in place of the given ``dict``. This can be used to provide custom deserializations (e.g. to support JSON-RPC class hinting). ``object_pairs_hook``, if specified will be called with the result of every JSON object decoded with an ordered list of pairs. The return value of ``object_pairs_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders. If ``object_hook`` is also defined, the ``object_pairs_hook`` takes priority. ``parse_float``, if specified, will be called with the string of every JSON float to be decoded. By default this is equivalent to float(num_str). This can be used to use another datatype or parser for JSON floats (e.g. decimal.Decimal). ``parse_int``, if specified, will be called with the string of every JSON int to be decoded. By default this is equivalent to int(num_str). This can be used to use another datatype or parser for JSON integers (e.g. float). ``parse_constant``, if specified, will be called with one of the following strings: -Infinity, Infinity, NaN. This can be used to raise an exception if invalid JSON numbers are encountered. If ``strict`` is false (true is the default), then control characters will be allowed inside strings. Control characters in this context are those with character codes in the 0-31 range, including ``'\t'`` (tab), ``'\n'``, ``'\r'`` and ``'\0'``. N)rQfloatr^r.r_ _CONSTANTS __getitem__r`r?rRrZZ parse_objectr]Z parse_arrayrZ parse_stringrSrZ make_scannerrP)rrQr^r_r`r?rRrrrr s#   zJSONDecoder.__init__cCsF|j|||dd\}}|||}|t|krBtd|||S)zlReturn the Python representation of ``s`` (a ``str`` instance containing a JSON document). r)idxz Extra data) raw_decoder8r-r)rr/rTobjr8rrrdecodeLs   zJSONDecoder.decoderc CsPz|||\}}Wn2tk rF}ztd||jdW5d}~XYnX||fS)a=Decode a JSON document from ``s`` (a ``str`` beginning with a JSON document) and return a 2-tuple of the Python representation and the index in ``s`` where the document ended. This can be used to decode a JSON document from a string that may have extraneous data at the end. rHN)rPrLrrM)rr/rdrfr8rYrrrreWs "zJSONDecoder.raw_decode)r) rrrrr WHITESPACEmatchrgrerrrrrs 0 ) rreZjsonrZ_jsonrZ c_scanstring ImportError__all__VERBOSE MULTILINEDOTALLFLAGSrarZPosInfZNegInfr rrbcompileZ STRINGCHUNKZ BACKSLASHr1rirErhZWHITESPACE_STRrZr]objectrrrrrsP     =  Q%PK!n0++(__pycache__/encoder.cpython-38.opt-1.pycnu[U e5d> @s>dZddlZzddlmZWnek r4dZYnXzddlmZWnek r^dZYnXzddlmZ Wnek rdZ YnXe dZ e dZ e dZ d d d d d dddZedD]ZeeedeqedZddZepeZddZepeZGdddeZeeeeeeee e!ej"f ddZ#dS)zImplementation of JSONEncoder N)encode_basestring_ascii)encode_basestring) make_encoderz[\x00-\x1f\\"\b\f\n\r\t]z([\\"]|[^\ -~])s[-]z\\z\"z\bz\fz\nz\rz\t)\"    \u{0:04x}infcCsdd}dt||dS)z5Return a JSON representation of a Python string cSst|dS)Nr) ESCAPE_DCTgroup)matchr$/usr/lib64/python3.8/json/encoder.pyreplace(sz%py_encode_basestring..replacer)ESCAPEsubsrrrrpy_encode_basestring$srcCsdd}dt||dS)zAReturn an ASCII-only JSON representation of a Python string cSs|d}z t|WStk rzt|}|dkrBd|YS|d8}d|d?d@B}d|d@B}d||YSYnXdS) Nrir i iiz\u{0:04x}\u{1:04x})rrKeyErrorordformat)rrns1s2rrrr4s   z+py_encode_basestring_ascii..replacer) ESCAPE_ASCIIrrrrrpy_encode_basestring_ascii0sr"c @sNeZdZdZdZdZddddddddddd Zd d Zd d ZdddZ dS) JSONEncoderaZExtensible JSON encoder for Python data structures. Supports the following objects and types by default: +-------------------+---------------+ | Python | JSON | +===================+===============+ | dict | object | +-------------------+---------------+ | list, tuple | array | +-------------------+---------------+ | str | string | +-------------------+---------------+ | int, float | number | +-------------------+---------------+ | True | true | +-------------------+---------------+ | False | false | +-------------------+---------------+ | None | null | +-------------------+---------------+ To extend this to recognize other objects, subclass and implement a ``.default()`` method with another method that returns a serializable object for ``o`` if possible, otherwise it should call the superclass implementation (to raise ``TypeError``). z, z: FTN)skipkeys ensure_asciicheck_circular allow_nan sort_keysindent separatorsdefaultc CsZ||_||_||_||_||_||_|dk r:|\|_|_n|dk rHd|_|dk rV||_dS)aConstructor for JSONEncoder, with sensible defaults. If skipkeys is false, then it is a TypeError to attempt encoding of keys that are not str, int, float or None. If skipkeys is True, such items are simply skipped. If ensure_ascii is true, the output is guaranteed to be str objects with all incoming non-ASCII characters escaped. If ensure_ascii is false, the output can contain non-ASCII characters. If check_circular is true, then lists, dicts, and custom encoded objects will be checked for circular references during encoding to prevent an infinite recursion (which would cause an OverflowError). Otherwise, no such check takes place. If allow_nan is true, then NaN, Infinity, and -Infinity will be encoded as such. This behavior is not JSON specification compliant, but is consistent with most JavaScript based encoders and decoders. Otherwise, it will be a ValueError to encode such floats. If sort_keys is true, then the output of dictionaries will be sorted by key; this is useful for regression tests to ensure that JSON serializations can be compared on a day-to-day basis. If indent is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. None is the most compact representation. If specified, separators should be an (item_separator, key_separator) tuple. The default is (', ', ': ') if *indent* is ``None`` and (',', ': ') otherwise. To get the most compact JSON representation, you should specify (',', ':') to eliminate whitespace. If specified, default is a function that gets called for objects that can't otherwise be serialized. It should return a JSON encodable version of the object or raise a ``TypeError``. N,) r$r%r&r'r(r)item_separator key_separatorr+) selfr$r%r&r'r(r)r*r+rrr__init__hs+zJSONEncoder.__init__cCstd|jjddS)alImplement this method in a subclass such that it returns a serializable object for ``o``, or calls the base implementation (to raise a ``TypeError``). For example, to support arbitrary iterators, you could implement default like this:: def default(self, o): try: iterable = iter(o) except TypeError: pass else: return list(iterable) # Let the base class default method raise the TypeError return JSONEncoder.default(self, o) zObject of type z is not JSON serializableN) TypeError __class____name__)r/orrrr+szJSONEncoder.defaultcCsNt|tr |jrt|St|S|j|dd}t|ttfsDt|}d|S)zReturn a JSON string representation of a Python data structure. >>> from json.encoder import JSONEncoder >>> JSONEncoder().encode({"foo": ["bar", "baz"]}) '{"foo": ["bar", "baz"]}' T) _one_shot) isinstancestrr%rr iterencodelisttuplejoin)r/r4chunksrrrencodes zJSONEncoder.encodec Cs|jr i}nd}|jrt}nt}|jtjtt fdd}|rvtdk rv|j dkrvt||j ||j |j |j |j |j|j }n&t||j ||j ||j |j |j |j| }||dS)zEncode the given object and yield each string representation as available. For example:: for chunk in JSONEncoder().iterencode(bigobject): mysocket.write(chunk) NcSsJ||krd}n$||krd}n||kr*d}n||S|sFtdt||S)NZNaNZInfinityz -Infinityz2Out of range float values are not JSON compliant: ) ValueErrorrepr)r4r'Z_reprZ_infZ_neginftextrrrfloatstrsz(JSONEncoder.iterencode..floatstrr)r&r%rrr'float__repr__INFINITYc_make_encoderr)r+r.r-r(r$_make_iterencode)r/r4r5markers_encoderrB _iterencoderrrr9sL   zJSONEncoder.iterencode)F) r3 __module__ __qualname____doc__r-r.r0r+r>r9rrrrr#Is 8r#csdk rsd fdd  fdd fddS)N c 3s|sdVdSdk r6 |}|kr.d||<d}dk rh|d7}d|}|}||7}nd}}d}|D]}|rd}n|} |r||Vqx|dkr|dVqx|dkr|d Vqx|dkr|d Vqx | r||Vqx | r||Vqx|V |fr8||}n" | rP||}n ||}|EdHqx|dk r|d8}d|Vd Vdk r|=dS) Nz[]Circular reference detected[r TFnulltruefalse]r) Zlst_current_indent_levelmarkeridZbufnewline_indentZ separatorfirstvaluer=)r?rI _floatstr_indent_intstr_item_separatorrJ_iterencode_dict_iterencode_listdictrCidintr7r:rHr8r;rrr`s\               z*_make_iterencode.._iterencode_listc 3s:|sdVdSdk r6|}|kr.d||<dVdk rh|d7}d|}|}|Vnd}}d} rt|}n|}|D]j\}}|rnn| r|}nZ|dkrd}nL|dkrd }n>|dkrd }n0|r|}n rqntd |jj|r"d}n|V|V V|rP|Vq|dkrbd Vq|dkrtdVq|dkrd Vq|r|Vq| r|Vq|fr҈||} n"| r||} n ||} | EdHq|dk r |d8}d|Vd Vdk r6|=dS) Nz{}rO{rQr TrSFrTrRz0keys must be str, int, float, bool or None, not })sorteditemsr1r2r3) ZdctrVrWrXr-rYrgkeyrZr=)r?rIr[r\r]r^rJr_r`_key_separator _skipkeys _sort_keysrarCrbrcr7r:rHr8r;rrr_Ms                       z*_make_iterencode.._iterencode_dictc3s |r|Vn|dkr&dVn|dkr6dVn|dkrFdVn | r\|Vn | rr|Vn | fr||EdHnj |r||EdHnNdk rֈ |}|krΈd||<|}||EdHdk r|=dS)NrRTrSFrTrOr)r4rVrW)r?_defaultrIr[r]rJr_r`rarCrbrcr7r:rHr8r;rrrJs2       z%_make_iterencode.._iterencoder)rHrlrIr\r[rir^rkrjr5r?rarCrbrcr7r:r8r;r]r)r?rlrIr[r\r]r^rJr_r`rirjrkrarCrbrcr7r:rHr8r;rrGs .84P,rG)$rMreZ_jsonrZc_encode_basestring_ascii ImportErrorrZc_encode_basestringrrFcompilerr!ZHAS_UTF8rrangei setdefaultchrrrCrErr"objectr#r?rarbrcr7r:r8r;rDrGrrrrsZ        >PK!E(__pycache__/decoder.cpython-38.opt-2.pycnu[U e5d0 @sddlZddlmZzddlmZWnek r<dZYnXddgZejej Bej BZ e dZ e dZe dZGd ddeZeee d Zed e Zd d dddddddZddZdeejfddZepeZede ZdZdejefddZejefddZGd ddeZdS)!N)scanner) scanstring JSONDecoderJSONDecodeErrornaninfz-infc@seZdZddZddZdS)rcCsb|dd|d}||dd|}d||||f}t||||_||_||_||_||_dS)N rz%s: line %d column %d (char %d)) countrfind ValueError__init__msgdocposlinenocolno)selfrrrrrerrmsgr$/usr/lib64/python3.8/json/decoder.pyr s zJSONDecodeError.__init__cCs|j|j|j|jffSN) __class__rrr)rrrr __reduce__*szJSONDecodeError.__reduce__N)__name__ __module__ __qualname__r rrrrrrs  )z -InfinityZInfinityNaNz(.*?)(["\\\x00-\x1f])"\/ r  )rrr bfnrtcCsb||d|d}t|dkrN|ddkrNz t|dWStk rLYnXd}t|||dS)Nr ZxXzInvalid \uXXXX escape)lenintr r)srescrrrr _decode_uXXXX;s r1TcCsg}|j}|d}|||}|dkr0td|||}|\} } | rP|| | dkr^qn.| dkr|rd| } t| ||n || qz ||} Wn"tk rtd||dYnX| dkrz || } Wn*tk rd| } t| ||YnX|d7}nt||}|d7}d |kr2d krnn`|||d d krt||d}d |krrdkrnn d|d d>|d B}|d7}t|} || qd ||fS)Nr zUnterminated string starting atrrz"Invalid control character {0!r} atuzInvalid \escape: {0!r}r*iiz\uiii ) appendrendgroupsformat IndexErrorKeyErrorr1chrjoin)r/r8strictZ_b_mZchunks_appendZbeginchunkZcontent terminatorrr0charZuniZuni2rrr py_scanstringEsX           2 rEz [ \t\n\r]*z c Cs|\}} g} | j} |dkri}|j} || | d} | dkr| |krb||| } || | d} | dkr|dk r|| }|| dfSi} |dk r|| } | | dfS| dkrtd|| | d7} t|| |\}} | ||}|| | ddkr"||| } || | ddkr"td|| | d7} z:|| |krb| d7} || |krb||| d} Wntk rzYnXz||| \}} Wn4tk r}ztd||jdW5d}~XYnX| ||fz0|| } | |kr||| d} || } Wntk rd} YnX| d7} | dkr4qn| d krNtd || d||| } || | d} | d7} | dkrtd|| dq|dk r|| }|| fSt| } |dk r|| } | | fS) Nr r}z1Expecting property name enclosed in double quotes:zExpecting ':' delimiterExpecting valuer6,Expecting ',' delimiter) r7 setdefaultr8rrr; StopIterationvaluedict) s_and_endr? scan_once object_hookobject_pairs_hookmemo_w_wsr/r8ZpairsZ pairs_appendZmemo_getnextcharresultkeyrMerrrrr JSONObjects    "        rZc Cst|\}}g}|||d}||krF|||d}|||d}|dkrZ||dfS|j}z|||\} }Wn2tk r} ztd|| jdW5d} ~ XYnX|| |||d}||kr|||d}|||d}|d7}|dkrqln|dkrtd||dz:|||krP|d7}|||krP|||d}Wq`tk rhYq`Xq`||fS)Nr ]rHrIrJ)r8r7rLrrMr;) rOrPrTrUr/r8valuesrVrArMrYrrr JSONArrays> " r]c@s<eZdZdddddddddZejfddZd d d ZdS) rNT)rQ parse_float parse_intparse_constantr?rRcCsZ||_|p t|_|pt|_|p"tj|_||_||_ t |_ t |_ t|_i|_t||_dSr)rQfloatr^r.r_ _CONSTANTS __getitem__r`r?rRrZZ parse_objectr]Z parse_arrayrZ parse_stringrSrZ make_scannerrP)rrQr^r_r`r?rRrrrr s#   zJSONDecoder.__init__cCsF|j|||dd\}}|||}|t|krBtd|||S)Nr)idxz Extra data) raw_decoder8r-r)rr/rTobjr8rrrdecodeLs   zJSONDecoder.decoderc CsPz|||\}}Wn2tk rF}ztd||jdW5d}~XYnX||fS)NrH)rPrLrrM)rr/rdrfr8rYrrrreWs "zJSONDecoder.raw_decode)r)rrrr WHITESPACEmatchrgrerrrrrs 0 )reZjsonrZ_jsonrZ c_scanstring ImportError__all__VERBOSE MULTILINEDOTALLFLAGSrarZPosInfZNegInfr rrbcompileZ STRINGCHUNKZ BACKSLASHr1rirErhZWHITESPACE_STRrZr]objectrrrrrsN     =  Q%PK!ɂjj%__pycache__/tool.cpython-38.opt-1.pycnu[U e5d @sjdZddlZddlZddlZddZedkrfz eWn.ek rdZzeej W5dZ[XYnXdS)aCommand-line tool to validate and pretty-print JSON Usage:: $ echo '{"json":"obj"}' | python -m json.tool { "json": "obj" } $ echo '{ 1.2:3.4}' | python -m json.tool Expecting property name enclosed in double quotes: line 1 column 3 (char 2) Nc Cs4d}d}tj||d}|jddtjdddtjd |jd dtjd ddd tjd |jd dddd|jddddd|}|j}|j }|j }|j }||~zJ|rdd|D}n t |f}|D] } t j| ||dd|dqWn,tk r} z t| W5d} ~ XYnXW5QRXW5QRXdS)Nzpython -m json.toolzZA simple command line interface for json module to validate and pretty-print JSON objects.)prog descriptioninfile?zutf-8)encodingz-a JSON file to be validated or pretty-printed)nargstypehelpdefaultoutfilewz%write the output of infile to outfilez --sort-keys store_trueFz5sort the output of dictionaries alphabetically by key)actionr r z --json-linesz&parse input using the jsonlines formatcss|]}t|VqdS)N)jsonloads).0liner!/usr/lib64/python3.8/json/tool.py ,szmain..) sort_keysindent )argparseArgumentParser add_argumentZFileTypesysstdinstdout parse_argsrr r json_linesrloaddumpwrite ValueError SystemExit) rrparserZoptionsrr rr!ZobjsobjerrrmainsD      r*__main__) __doc__rrrr*__name__BrokenPipeErrorexcexiterrnorrrrs $ PK!n0++"__pycache__/encoder.cpython-38.pycnu[U e5d> @s>dZddlZzddlmZWnek r4dZYnXzddlmZWnek r^dZYnXzddlmZ Wnek rdZ YnXe dZ e dZ e dZ d d d d d dddZedD]ZeeedeqedZddZepeZddZepeZGdddeZeeeeeeee e!ej"f ddZ#dS)zImplementation of JSONEncoder N)encode_basestring_ascii)encode_basestring) make_encoderz[\x00-\x1f\\"\b\f\n\r\t]z([\\"]|[^\ -~])s[-]z\\z\"z\bz\fz\nz\rz\t)\"    \u{0:04x}infcCsdd}dt||dS)z5Return a JSON representation of a Python string cSst|dS)Nr) ESCAPE_DCTgroup)matchr$/usr/lib64/python3.8/json/encoder.pyreplace(sz%py_encode_basestring..replacer)ESCAPEsubsrrrrpy_encode_basestring$srcCsdd}dt||dS)zAReturn an ASCII-only JSON representation of a Python string cSs|d}z t|WStk rzt|}|dkrBd|YS|d8}d|d?d@B}d|d@B}d||YSYnXdS) Nrir i iiz\u{0:04x}\u{1:04x})rrKeyErrorordformat)rrns1s2rrrr4s   z+py_encode_basestring_ascii..replacer) ESCAPE_ASCIIrrrrrpy_encode_basestring_ascii0sr"c @sNeZdZdZdZdZddddddddddd Zd d Zd d ZdddZ dS) JSONEncoderaZExtensible JSON encoder for Python data structures. Supports the following objects and types by default: +-------------------+---------------+ | Python | JSON | +===================+===============+ | dict | object | +-------------------+---------------+ | list, tuple | array | +-------------------+---------------+ | str | string | +-------------------+---------------+ | int, float | number | +-------------------+---------------+ | True | true | +-------------------+---------------+ | False | false | +-------------------+---------------+ | None | null | +-------------------+---------------+ To extend this to recognize other objects, subclass and implement a ``.default()`` method with another method that returns a serializable object for ``o`` if possible, otherwise it should call the superclass implementation (to raise ``TypeError``). z, z: FTN)skipkeys ensure_asciicheck_circular allow_nan sort_keysindent separatorsdefaultc CsZ||_||_||_||_||_||_|dk r:|\|_|_n|dk rHd|_|dk rV||_dS)aConstructor for JSONEncoder, with sensible defaults. If skipkeys is false, then it is a TypeError to attempt encoding of keys that are not str, int, float or None. If skipkeys is True, such items are simply skipped. If ensure_ascii is true, the output is guaranteed to be str objects with all incoming non-ASCII characters escaped. If ensure_ascii is false, the output can contain non-ASCII characters. If check_circular is true, then lists, dicts, and custom encoded objects will be checked for circular references during encoding to prevent an infinite recursion (which would cause an OverflowError). Otherwise, no such check takes place. If allow_nan is true, then NaN, Infinity, and -Infinity will be encoded as such. This behavior is not JSON specification compliant, but is consistent with most JavaScript based encoders and decoders. Otherwise, it will be a ValueError to encode such floats. If sort_keys is true, then the output of dictionaries will be sorted by key; this is useful for regression tests to ensure that JSON serializations can be compared on a day-to-day basis. If indent is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. None is the most compact representation. If specified, separators should be an (item_separator, key_separator) tuple. The default is (', ', ': ') if *indent* is ``None`` and (',', ': ') otherwise. To get the most compact JSON representation, you should specify (',', ':') to eliminate whitespace. If specified, default is a function that gets called for objects that can't otherwise be serialized. It should return a JSON encodable version of the object or raise a ``TypeError``. N,) r$r%r&r'r(r)item_separator key_separatorr+) selfr$r%r&r'r(r)r*r+rrr__init__hs+zJSONEncoder.__init__cCstd|jjddS)alImplement this method in a subclass such that it returns a serializable object for ``o``, or calls the base implementation (to raise a ``TypeError``). For example, to support arbitrary iterators, you could implement default like this:: def default(self, o): try: iterable = iter(o) except TypeError: pass else: return list(iterable) # Let the base class default method raise the TypeError return JSONEncoder.default(self, o) zObject of type z is not JSON serializableN) TypeError __class____name__)r/orrrr+szJSONEncoder.defaultcCsNt|tr |jrt|St|S|j|dd}t|ttfsDt|}d|S)zReturn a JSON string representation of a Python data structure. >>> from json.encoder import JSONEncoder >>> JSONEncoder().encode({"foo": ["bar", "baz"]}) '{"foo": ["bar", "baz"]}' T) _one_shot) isinstancestrr%rr iterencodelisttuplejoin)r/r4chunksrrrencodes zJSONEncoder.encodec Cs|jr i}nd}|jrt}nt}|jtjtt fdd}|rvtdk rv|j dkrvt||j ||j |j |j |j |j|j }n&t||j ||j ||j |j |j |j| }||dS)zEncode the given object and yield each string representation as available. For example:: for chunk in JSONEncoder().iterencode(bigobject): mysocket.write(chunk) NcSsJ||krd}n$||krd}n||kr*d}n||S|sFtdt||S)NZNaNZInfinityz -Infinityz2Out of range float values are not JSON compliant: ) ValueErrorrepr)r4r'Z_reprZ_infZ_neginftextrrrfloatstrsz(JSONEncoder.iterencode..floatstrr)r&r%rrr'float__repr__INFINITYc_make_encoderr)r+r.r-r(r$_make_iterencode)r/r4r5markers_encoderrB _iterencoderrrr9sL   zJSONEncoder.iterencode)F) r3 __module__ __qualname____doc__r-r.r0r+r>r9rrrrr#Is 8r#csdk rsd fdd  fdd fddS)N c 3s|sdVdSdk r6 |}|kr.d||<d}dk rh|d7}d|}|}||7}nd}}d}|D]}|rd}n|} |r||Vqx|dkr|dVqx|dkr|d Vqx|dkr|d Vqx | r||Vqx | r||Vqx|V |fr8||}n" | rP||}n ||}|EdHqx|dk r|d8}d|Vd Vdk r|=dS) Nz[]Circular reference detected[r TFnulltruefalse]r) Zlst_current_indent_levelmarkeridZbufnewline_indentZ separatorfirstvaluer=)r?rI _floatstr_indent_intstr_item_separatorrJ_iterencode_dict_iterencode_listdictrCidintr7r:rHr8r;rrr`s\               z*_make_iterencode.._iterencode_listc 3s:|sdVdSdk r6|}|kr.d||<dVdk rh|d7}d|}|}|Vnd}}d} rt|}n|}|D]j\}}|rnn| r|}nZ|dkrd}nL|dkrd }n>|dkrd }n0|r|}n rqntd |jj|r"d}n|V|V V|rP|Vq|dkrbd Vq|dkrtdVq|dkrd Vq|r|Vq| r|Vq|fr҈||} n"| r||} n ||} | EdHq|dk r |d8}d|Vd Vdk r6|=dS) Nz{}rO{rQr TrSFrTrRz0keys must be str, int, float, bool or None, not })sorteditemsr1r2r3) ZdctrVrWrXr-rYrgkeyrZr=)r?rIr[r\r]r^rJr_r`_key_separator _skipkeys _sort_keysrarCrbrcr7r:rHr8r;rrr_Ms                       z*_make_iterencode.._iterencode_dictc3s |r|Vn|dkr&dVn|dkr6dVn|dkrFdVn | r\|Vn | rr|Vn | fr||EdHnj |r||EdHnNdk rֈ |}|krΈd||<|}||EdHdk r|=dS)NrRTrSFrTrOr)r4rVrW)r?_defaultrIr[r]rJr_r`rarCrbrcr7r:rHr8r;rrrJs2       z%_make_iterencode.._iterencoder)rHrlrIr\r[rir^rkrjr5r?rarCrbrcr7r:r8r;r]r)r?rlrIr[r\r]r^rJr_r`rirjrkrarCrbrcr7r:rHr8r;rrGs .84P,rG)$rMreZ_jsonrZc_encode_basestring_ascii ImportErrorrZc_encode_basestringrrFcompilerr!ZHAS_UTF8rrangei setdefaultchrrrCrErr"objectr#r?rarbrcr7r:r8r;rDrGrrrrsZ        >PK!{(__pycache__/encoder.cpython-38.opt-2.pycnu[U e5d> @s:ddlZzddlmZWnek r0dZYnXzddlmZWnek rZdZYnXzddlmZWnek rdZYnXe dZ e dZ e dZ dd d d d d ddZ edD]Ze eedeqedZddZepeZddZepeZGdddeZeeeeeeeee ej!f ddZ"dS)N)encode_basestring_ascii)encode_basestring) make_encoderz[\x00-\x1f\\"\b\f\n\r\t]z([\\"]|[^\ -~])s[-]z\\z\"z\bz\fz\nz\rz\t)\"    \u{0:04x}infcCsdd}dt||dS)NcSst|dS)Nr) ESCAPE_DCTgroup)matchr$/usr/lib64/python3.8/json/encoder.pyreplace(sz%py_encode_basestring..replacer)ESCAPEsubsrrrrpy_encode_basestring$srcCsdd}dt||dS)NcSs|d}z t|WStk rzt|}|dkrBd|YS|d8}d|d?d@B}d|d@B}d||YSYnXdS) Nrir i iiz\u{0:04x}\u{1:04x})rrKeyErrorordformat)rrns1s2rrrr4s   z+py_encode_basestring_ascii..replacer) ESCAPE_ASCIIrrrrrpy_encode_basestring_ascii0sr"c @sJeZdZdZdZdddddddddddZd d Zd d Zdd dZdS) JSONEncoderz, z: FTN)skipkeys ensure_asciicheck_circular allow_nan sort_keysindent separatorsdefaultc CsZ||_||_||_||_||_||_|dk r:|\|_|_n|dk rHd|_|dk rV||_dS)N,) r$r%r&r'r(r)item_separator key_separatorr+) selfr$r%r&r'r(r)r*r+rrr__init__hs+zJSONEncoder.__init__cCstd|jjddS)NzObject of type z is not JSON serializable) TypeError __class____name__)r/orrrr+szJSONEncoder.defaultcCsNt|tr |jrt|St|S|j|dd}t|ttfsDt|}d|S)NT) _one_shot) isinstancestrr%rr iterencodelisttuplejoin)r/r4chunksrrrencodes zJSONEncoder.encodec Cs|jr i}nd}|jrt}nt}|jtjtt fdd}|rvtdk rv|j dkrvt||j ||j |j |j |j |j|j }n&t||j ||j ||j |j |j |j| }||dS)NcSsJ||krd}n$||krd}n||kr*d}n||S|sFtdt||S)NZNaNZInfinityz -Infinityz2Out of range float values are not JSON compliant: ) ValueErrorrepr)r4r'Z_reprZ_infZ_neginftextrrrfloatstrsz(JSONEncoder.iterencode..floatstrr)r&r%rrr'float__repr__INFINITYc_make_encoderr)r+r.r-r(r$_make_iterencode)r/r4r5markers_encoderrB _iterencoderrrr9sL   zJSONEncoder.iterencode)F) r3 __module__ __qualname__r-r.r0r+r>r9rrrrr#Is 8r#csdk rsd fdd  fdd fddS)N c 3s|sdVdSdk r6 |}|kr.d||<d}dk rh|d7}d|}|}||7}nd}}d}|D]}|rd}n|} |r||Vqx|dkr|dVqx|dkr|d Vqx|dkr|d Vqx | r||Vqx | r||Vqx|V |fr8||}n" | rP||}n ||}|EdHqx|dk r|d8}d|Vd Vdk r|=dS) Nz[]Circular reference detected[r TFnulltruefalse]r) Zlst_current_indent_levelmarkeridZbufnewline_indentZ separatorfirstvaluer=)r?rI _floatstr_indent_intstr_item_separatorrJ_iterencode_dict_iterencode_listdictrCidintr7r:rHr8r;rrr_s\               z*_make_iterencode.._iterencode_listc 3s:|sdVdSdk r6|}|kr.d||<dVdk rh|d7}d|}|}|Vnd}}d} rt|}n|}|D]j\}}|rnn| r|}nZ|dkrd}nL|dkrd }n>|dkrd }n0|r|}n rqntd |jj|r"d}n|V|V V|rP|Vq|dkrbd Vq|dkrtdVq|dkrd Vq|r|Vq| r|Vq|fr҈||} n"| r||} n ||} | EdHq|dk r |d8}d|Vd Vdk r6|=dS) Nz{}rN{rPr TrRFrSrQz0keys must be str, int, float, bool or None, not })sorteditemsr1r2r3) ZdctrUrVrWr-rXrfkeyrYr=)r?rIrZr[r\r]rJr^r__key_separator _skipkeys _sort_keysr`rCrarbr7r:rHr8r;rrr^Ms                       z*_make_iterencode.._iterencode_dictc3s |r|Vn|dkr&dVn|dkr6dVn|dkrFdVn | r\|Vn | rr|Vn | fr||EdHnj |r||EdHnNdk rֈ |}|krΈd||<|}||EdHdk r|=dS)NrQTrRFrSrNr)r4rUrV)r?_defaultrIrZr\rJr^r_r`rCrarbr7r:rHr8r;rrrJs2       z%_make_iterencode.._iterencoder)rHrkrIr[rZrhr]rjrir5r?r`rCrarbr7r:r8r;r\r)r?rkrIrZr[r\r]rJr^r_rhrirjr`rCrarbr7r:rHr8r;rrGs .84P,rG)#reZ_jsonrZc_encode_basestring_ascii ImportErrorrZc_encode_basestringrrFcompilerr!ZHAS_UTF8rrangei setdefaultchrrrCrErr"objectr#r?r`rarbr7r:r8r;rDrGrrrrsX        >PK!e4"v&v&"__pycache__/decoder.cpython-38.pycnu[U e5d0 @sdZddlZddlmZzddlmZWnek r@dZYnXddgZej ej Bej BZ e dZe dZe d ZGd ddeZeeed Zed e Zd ddddddddZddZdeejfddZepeZede ZdZdejefddZejefdd ZGd!ddeZdS)"zImplementation of JSONDecoder N)scanner) scanstring JSONDecoderJSONDecodeErrornaninfz-infc@s eZdZdZddZddZdS)ra Subclass of ValueError with the following additional properties: msg: The unformatted error message doc: The JSON document being parsed pos: The start index of doc where parsing failed lineno: The line corresponding to pos colno: The column corresponding to pos cCsb|dd|d}||dd|}d||||f}t||||_||_||_||_||_dS)N rz%s: line %d column %d (char %d)) countrfind ValueError__init__msgdocposlinenocolno)selfrrrrrerrmsgr$/usr/lib64/python3.8/json/decoder.pyr s zJSONDecodeError.__init__cCs|j|j|j|jffS)N) __class__rrr)rrrr __reduce__*szJSONDecodeError.__reduce__N)__name__ __module__ __qualname____doc__r rrrrrrs  )z -InfinityZInfinityNaNz(.*?)(["\\\x00-\x1f])"\/ r  )rrr bfnrtcCsb||d|d}t|dkrN|ddkrNz t|dWStk rLYnXd}t|||dS)Nr ZxXzInvalid \uXXXX escape)lenintr r)srescrrrr _decode_uXXXX;s r1TcCsg}|j}|d}|||}|dkr0td|||}|\} } | rP|| | dkr^qn.| dkr|rd| } t| ||n || qz ||} Wn"tk rtd||dYnX| dkrz || } Wn*tk rd| } t| ||YnX|d7}nt||}|d 7}d |kr2d krnn`|||d d krt||d}d|krrdkrnn d|d d>|dB}|d7}t|} || qd ||fS)aScan the string s for a JSON string. End is the index of the character in s after the quote that started the JSON string. Unescapes all valid JSON string escape sequences and raises ValueError on attempt to decode an invalid string. If strict is False then literal control characters are allowed in the string. Returns a tuple of the decoded string and the index of the character in s after the end quote.r NzUnterminated string starting atrrz"Invalid control character {0!r} atuzInvalid \escape: {0!r}r*iiz\uiii ) appendrendgroupsformat IndexErrorKeyErrorr1chrjoin)r/r8strictZ_b_mZchunks_appendZbeginchunkZcontent terminatorrr0charZuniZuni2rrr py_scanstringEsX           2 rEz [ \t\n\r]*z c Cs|\}} g} | j} |dkri}|j} || | d} | dkr| |krb||| } || | d} | dkr|dk r|| }|| dfSi} |dk r|| } | | dfS| dkrtd|| | d7} t|| |\}} | ||}|| | ddkr"||| } || | ddkr"td|| | d7} z:|| |krb| d7} || |krb||| d} Wntk rzYnXz||| \}} Wn4tk r}ztd||jdW5d}~XYnX| ||fz0|| } | |kr||| d} || } Wntk rd} YnX| d7} | dkr4qn| d krNtd || d||| } || | d} | d7} | dkrtd|| dq|dk r|| }|| fSt| } |dk r|| } | | fS) Nr r}z1Expecting property name enclosed in double quotes:zExpecting ':' delimiterExpecting valuer6,Expecting ',' delimiter) r7 setdefaultr8rrr; StopIterationvaluedict) s_and_endr? scan_once object_hookobject_pairs_hookmemo_w_wsr/r8ZpairsZ pairs_appendZmemo_getnextcharresultkeyrMerrrrr JSONObjects    "        rZc Cst|\}}g}|||d}||krF|||d}|||d}|dkrZ||dfS|j}z|||\} }Wn2tk r} ztd|| jdW5d} ~ XYnX|| |||d}||kr|||d}|||d}|d7}|dkrqln|dkrtd||dz:|||krP|d7}|||krP|||d}Wq`tk rhYq`Xq`||fS)Nr ]rHrIrJ)r8r7rLrrMr;) rOrPrTrUr/r8valuesrVrArMrYrrr JSONArrays> " r]c@s@eZdZdZdddddddddZejfddZd d d ZdS) raSimple JSON decoder Performs the following translations in decoding by default: +---------------+-------------------+ | JSON | Python | +===============+===================+ | object | dict | +---------------+-------------------+ | array | list | +---------------+-------------------+ | string | str | +---------------+-------------------+ | number (int) | int | +---------------+-------------------+ | number (real) | float | +---------------+-------------------+ | true | True | +---------------+-------------------+ | false | False | +---------------+-------------------+ | null | None | +---------------+-------------------+ It also understands ``NaN``, ``Infinity``, and ``-Infinity`` as their corresponding ``float`` values, which is outside the JSON spec. NT)rQ parse_float parse_intparse_constantr?rRcCsZ||_|p t|_|pt|_|p"tj|_||_||_ t |_ t |_ t|_i|_t||_dS)a``object_hook``, if specified, will be called with the result of every JSON object decoded and its return value will be used in place of the given ``dict``. This can be used to provide custom deserializations (e.g. to support JSON-RPC class hinting). ``object_pairs_hook``, if specified will be called with the result of every JSON object decoded with an ordered list of pairs. The return value of ``object_pairs_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders. If ``object_hook`` is also defined, the ``object_pairs_hook`` takes priority. ``parse_float``, if specified, will be called with the string of every JSON float to be decoded. By default this is equivalent to float(num_str). This can be used to use another datatype or parser for JSON floats (e.g. decimal.Decimal). ``parse_int``, if specified, will be called with the string of every JSON int to be decoded. By default this is equivalent to int(num_str). This can be used to use another datatype or parser for JSON integers (e.g. float). ``parse_constant``, if specified, will be called with one of the following strings: -Infinity, Infinity, NaN. This can be used to raise an exception if invalid JSON numbers are encountered. If ``strict`` is false (true is the default), then control characters will be allowed inside strings. Control characters in this context are those with character codes in the 0-31 range, including ``'\t'`` (tab), ``'\n'``, ``'\r'`` and ``'\0'``. N)rQfloatr^r.r_ _CONSTANTS __getitem__r`r?rRrZZ parse_objectr]Z parse_arrayrZ parse_stringrSrZ make_scannerrP)rrQr^r_r`r?rRrrrr s#   zJSONDecoder.__init__cCsF|j|||dd\}}|||}|t|krBtd|||S)zlReturn the Python representation of ``s`` (a ``str`` instance containing a JSON document). r)idxz Extra data) raw_decoder8r-r)rr/rTobjr8rrrdecodeLs   zJSONDecoder.decoderc CsPz|||\}}Wn2tk rF}ztd||jdW5d}~XYnX||fS)a=Decode a JSON document from ``s`` (a ``str`` beginning with a JSON document) and return a 2-tuple of the Python representation and the index in ``s`` where the document ended. This can be used to decode a JSON document from a string that may have extraneous data at the end. rHN)rPrLrrM)rr/rdrfr8rYrrrreWs "zJSONDecoder.raw_decode)r) rrrrr WHITESPACEmatchrgrerrrrrs 0 ) rreZjsonrZ_jsonrZ c_scanstring ImportError__all__VERBOSE MULTILINEDOTALLFLAGSrarZPosInfZNegInfr rrbcompileZ STRINGCHUNKZ BACKSLASHr1rirErhZWHITESPACE_STRrZr]objectrrrrrsP     =  Q%PK!]Ɗ"__pycache__/scanner.cpython-38.pycnu[U e5dy @sjdZddlZzddlmZWnek r4dZYnXdgZedejej Bej BZ ddZ epde ZdS)zJSON token scanner N) make_scannerrz)(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?c sv|j |j|j tj|j |j|j|j|j |j |j  f ddfdd}|S)Ncsz ||}Wntk r*t|dYnX|dkrD ||d S|dkrf ||df S|dkr||dfS|dkr|||ddkrd|dfS|dkr|||dd krd |dfS|d kr|||d d krd|d fS||}|dk r\|\}}}|s*|rH||p6d|p@d}n|}||fS|dkr|||ddkrd|dfS|dkr|||ddkrd|dfS|dkr|||ddkrd|dfSt|dS)N"{[nZnullttrueTfZfalseFNZNaNIZInfinity- z -Infinity) IndexError StopIterationgroupsend)stringidxZnextcharmZintegerZfracZexpres _scan_onceZ match_numbermemo object_hookobject_pairs_hook parse_arrayparse_constant parse_float parse_int parse_object parse_stringstrict$/usr/lib64/python3.8/json/scanner.pyrsF            z#py_make_scanner.._scan_oncecsz||WSXdS)N)clear)rr)rrr(r) scan_onceAsz"py_make_scanner..scan_once) r%r!r& NUMBER_REmatchr'r#r$r"rr r)contextr+r(rr)py_make_scanners"%r/) __doc__reZ_jsonrZc_make_scanner ImportError__all__compileVERBOSE MULTILINEDOTALLr,r/r(r(r(r)s :PK!OEB1B1#__pycache__/__init__.cpython-38.pycnu[U e5d 8 @sdZdZdddddddgZd Zd d lmZmZd d lmZd dl Z eddddddddZ dddddddddd ddZ dddddddddd ddZ edddZ ddZdddddddddZdddddddddZdS)a JSON (JavaScript Object Notation) is a subset of JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data interchange format. :mod:`json` exposes an API familiar to users of the standard library :mod:`marshal` and :mod:`pickle` modules. It is derived from a version of the externally maintained simplejson library. Encoding basic Python object hierarchies:: >>> import json >>> json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}]) '["foo", {"bar": ["baz", null, 1.0, 2]}]' >>> print(json.dumps("\"foo\bar")) "\"foo\bar" >>> print(json.dumps('\u1234')) "\u1234" >>> print(json.dumps('\\')) "\\" >>> print(json.dumps({"c": 0, "b": 0, "a": 0}, sort_keys=True)) {"a": 0, "b": 0, "c": 0} >>> from io import StringIO >>> io = StringIO() >>> json.dump(['streaming API'], io) >>> io.getvalue() '["streaming API"]' Compact encoding:: >>> import json >>> mydict = {'4': 5, '6': 7} >>> json.dumps([1,2,3,mydict], separators=(',', ':')) '[1,2,3,{"4":5,"6":7}]' Pretty printing:: >>> import json >>> print(json.dumps({'4': 5, '6': 7}, sort_keys=True, indent=4)) { "4": 5, "6": 7 } Decoding JSON:: >>> import json >>> obj = ['foo', {'bar': ['baz', None, 1.0, 2]}] >>> json.loads('["foo", {"bar":["baz", null, 1.0, 2]}]') == obj True >>> json.loads('"\\"foo\\bar"') == '"foo\x08ar' True >>> from io import StringIO >>> io = StringIO('["streaming API"]') >>> json.load(io)[0] == 'streaming API' True Specializing JSON object decoding:: >>> import json >>> def as_complex(dct): ... if '__complex__' in dct: ... return complex(dct['real'], dct['imag']) ... return dct ... >>> json.loads('{"__complex__": true, "real": 1, "imag": 2}', ... object_hook=as_complex) (1+2j) >>> from decimal import Decimal >>> json.loads('1.1', parse_float=Decimal) == Decimal('1.1') True Specializing JSON object encoding:: >>> import json >>> def encode_complex(obj): ... if isinstance(obj, complex): ... return [obj.real, obj.imag] ... raise TypeError(f'Object of type {obj.__class__.__name__} ' ... f'is not JSON serializable') ... >>> json.dumps(2 + 1j, default=encode_complex) '[2.0, 1.0]' >>> json.JSONEncoder(default=encode_complex).encode(2 + 1j) '[2.0, 1.0]' >>> ''.join(json.JSONEncoder(default=encode_complex).iterencode(2 + 1j)) '[2.0, 1.0]' Using json.tool from the shell to validate and pretty-print:: $ echo '{"json":"obj"}' | python -m json.tool { "json": "obj" } $ echo '{ 1.2:3.4}' | python -m json.tool Expecting property name enclosed in double quotes: line 1 column 3 (char 2) z2.0.9dumpdumpsloadloads JSONDecoderJSONDecodeError JSONEncoderzBob Ippolito )rr)rNFT)skipkeys ensure_asciicheck_circular allow_nanindent separatorsdefault) r r r r clsrrr sort_keysc  Ks|sD|rD|rD|rD|dkrD|dkrD|dkrD| dkrD| sD| sDt|} n2|dkrPt}|f||||||| | d| |} | D]} || qzdS)aSerialize ``obj`` as a JSON formatted stream to ``fp`` (a ``.write()``-supporting file-like object). If ``skipkeys`` is true then ``dict`` keys that are not basic types (``str``, ``int``, ``float``, ``bool``, ``None``) will be skipped instead of raising a ``TypeError``. If ``ensure_ascii`` is false, then the strings written to ``fp`` can contain non-ASCII characters if they appear in strings contained in ``obj``. Otherwise, all such characters are escaped in JSON strings. If ``check_circular`` is false, then the circular reference check for container types will be skipped and a circular reference will result in an ``OverflowError`` (or worse). If ``allow_nan`` is false, then it will be a ``ValueError`` to serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). If ``indent`` is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. ``None`` is the most compact representation. If specified, ``separators`` should be an ``(item_separator, key_separator)`` tuple. The default is ``(', ', ': ')`` if *indent* is ``None`` and ``(',', ': ')`` otherwise. To get the most compact JSON representation, you should specify ``(',', ':')`` to eliminate whitespace. ``default(obj)`` is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError. If *sort_keys* is true (default: ``False``), then the output of dictionaries will be sorted by key. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the ``.default()`` method to serialize additional types), specify it with the ``cls`` kwarg; otherwise ``JSONEncoder`` is used. Nr r r r rrrr)_default_encoder iterencoderwrite)objfpr r r r rrrrrkwiterablechunkr%/usr/lib64/python3.8/json/__init__.pyrxsD- c Kst|sB|rB|rB|rB|dkrB|dkrB|dkrB|dkrB| sB| sBt|S|dkrNt}|f|||||||| d| |S)auSerialize ``obj`` to a JSON formatted ``str``. If ``skipkeys`` is true then ``dict`` keys that are not basic types (``str``, ``int``, ``float``, ``bool``, ``None``) will be skipped instead of raising a ``TypeError``. If ``ensure_ascii`` is false, then the return value can contain non-ASCII characters if they appear in strings contained in ``obj``. Otherwise, all such characters are escaped in JSON strings. If ``check_circular`` is false, then the circular reference check for container types will be skipped and a circular reference will result in an ``OverflowError`` (or worse). If ``allow_nan`` is false, then it will be a ``ValueError`` to serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). If ``indent`` is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. ``None`` is the most compact representation. If specified, ``separators`` should be an ``(item_separator, key_separator)`` tuple. The default is ``(', ', ': ')`` if *indent* is ``None`` and ``(',', ': ')`` otherwise. To get the most compact JSON representation, you should specify ``(',', ':')`` to eliminate whitespace. ``default(obj)`` is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError. If *sort_keys* is true (default: ``False``), then the output of dictionaries will be sorted by key. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the ``.default()`` method to serialize additional types), specify it with the ``cls`` kwarg; otherwise ``JSONEncoder`` is used. Nr)rencoder) rr r r r rrrrrrrrrrsD, ) object_hookobject_pairs_hookcCs|j}|tjtjfrdS|tjtjfr.dS|tjrrrrr+sT$     )__doc__ __version____all__ __author__decoderrrencoderrr%rrrrAr-rrrrrrsda   ? :  PK!ze scanner.pycnu[ {fc@sdZddlZyddlmZWnek r?dZnXdgZejdej ej Bej BZ dZ ep~e ZdS(sJSON token scanner iN(t make_scannerRs)(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?c s|j |j|j tj|j|j |j|j|j |j |j  f dS(NcsZy||}Wntk r'tnX|dkrK ||d S|dkrz ||df S|dkr||dfS|dkr|||d!dkrd|dfS|dkr|||d!d krt|dfS|d kr0|||d !d kr0t|d fS||}|dk r|j\}}}|sl|r||p{d |pd }n |}||jfS|dkr|||d!dkrd|dfS|dkr|||d!dkrd|dfS|dkrP|||d!dkrPd|dfStdS(Nt"it{t[tnitnullttttruetfitfalsettNitNaNtIitInfinityt-i s -Infinity(t IndexErrort StopIterationtNonetTruetFalsetgroupstend(tstringtidxtnextchartmtintegertfractexptres( t _scan_oncetencodingt match_numbert object_hooktobject_pairs_hookt parse_arraytparse_constantt parse_floatt parse_intt parse_objectt parse_stringtstrict(s$/usr/lib64/python2.7/json/scanner.pyRs>      ###  # ###( R(R$R)t NUMBER_REtmatchR R*R&R'R%R"R#(tcontext(( RR R!R"R#R$R%R&R'R(R)R*s$/usr/lib64/python2.7/json/scanner.pytpy_make_scanners           0%(t__doc__tret_jsonRtc_make_scannert ImportErrorRt__all__tcompiletVERBOSEt MULTILINEtDOTALLR+R.(((s$/usr/lib64/python2.7/json/scanner.pyts     4PK!RC55 encoder.pycnu[ {fc @sdZddlZyddlmZWnek r?dZnXyddlmZWnek rmdZnXej dZ ej dZ ej dZ idd 6d d 6d d 6dd6dd6dd6dd6Z x3edD]%Ze jeedjeqWedZejZdZdZep8eZdefdYZeeeeeee e!e"e#e$d Z%dS(sImplementation of JSONEncoder iN(tencode_basestring_ascii(t make_encoders[\x00-\x1f\\"\b\f\n\r\t]s([\\"]|[^\ -~])s [\x80-\xff]s\\s\s\"t"s\bss\fs s\ns s\rs s\ts i s \u{0:04x}tinfcCs!d}dtj||dS(s5Return a JSON representation of a Python string cSst|jdS(Ni(t ESCAPE_DCTtgroup(tmatch((s$/usr/lib64/python2.7/json/encoder.pytreplace%sR(tESCAPEtsub(tsR((s$/usr/lib64/python2.7/json/encoder.pytencode_basestring!s cCs]t|tr6tj|dk r6|jd}nd}dttj||dS(sAReturn an ASCII-only JSON representation of a Python string sutf-8cSs|jd}y t|SWnptk rt|}|dkrPdj|S|d8}d|d?d@B}d|d@B}dj||SnXdS( Niis \u{0:04x}ii iis\u{0:04x}\u{1:04x}(RRtKeyErrortordtformat(RR tnts1ts2((s$/usr/lib64/python2.7/json/encoder.pyR0s      RN(t isinstancetstrtHAS_UTF8tsearchtNonetdecodet ESCAPE_ASCIIR (R R((s$/usr/lib64/python2.7/json/encoder.pytpy_encode_basestring_ascii*s$ t JSONEncoderc Bs\eZdZdZdZeeeeeddddd ZdZ dZ edZ RS( sZExtensible JSON encoder for Python data structures. Supports the following objects and types by default: +-------------------+---------------+ | Python | JSON | +===================+===============+ | dict | object | +-------------------+---------------+ | list, tuple | array | +-------------------+---------------+ | str, unicode | string | +-------------------+---------------+ | int, long, float | number | +-------------------+---------------+ | True | true | +-------------------+---------------+ | False | false | +-------------------+---------------+ | None | null | +-------------------+---------------+ To extend this to recognize other objects, subclass and implement a ``.default()`` method with another method that returns a serializable object for ``o`` if possible, otherwise it should call the superclass implementation (to raise ``TypeError``). s, s: sutf-8c Cs|||_||_||_||_||_||_|dk rW|\|_|_n| dk ro| |_ n||_ dS(s Constructor for JSONEncoder, with sensible defaults. If skipkeys is false, then it is a TypeError to attempt encoding of keys that are not str, int, long, float or None. If skipkeys is True, such items are simply skipped. If *ensure_ascii* is true (the default), all non-ASCII characters in the output are escaped with \uXXXX sequences, and the results are str instances consisting of ASCII characters only. If ensure_ascii is False, a result may be a unicode instance. This usually happens if the input contains unicode strings or the *encoding* parameter is used. If check_circular is true, then lists, dicts, and custom encoded objects will be checked for circular references during encoding to prevent an infinite recursion (which would cause an OverflowError). Otherwise, no such check takes place. If allow_nan is true, then NaN, Infinity, and -Infinity will be encoded as such. This behavior is not JSON specification compliant, but is consistent with most JavaScript based encoders and decoders. Otherwise, it will be a ValueError to encode such floats. If sort_keys is true, then the output of dictionaries will be sorted by key; this is useful for regression tests to ensure that JSON serializations can be compared on a day-to-day basis. If indent is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. None is the most compact representation. Since the default item separator is ', ', the output might include trailing whitespace when indent is specified. You can use separators=(',', ': ') to avoid this. If specified, separators should be a (item_separator, key_separator) tuple. The default is (', ', ': '). To get the most compact JSON representation you should specify (',', ':') to eliminate whitespace. If specified, default is a function that gets called for objects that can't otherwise be serialized. It should return a JSON encodable version of the object or raise a ``TypeError``. If encoding is not None, then all input strings will be transformed into unicode using that encoding prior to JSON-encoding. The default is UTF-8. N( tskipkeyst ensure_asciitcheck_circulart allow_nant sort_keystindentRtitem_separatort key_separatortdefaulttencoding( tselfRRRRRR t separatorsR$R#((s$/usr/lib64/python2.7/json/encoder.pyt__init__es4         cCstt|ddS(slImplement this method in a subclass such that it returns a serializable object for ``o``, or calls the base implementation (to raise a ``TypeError``). For example, to support arbitrary iterators, you could implement default like this:: def default(self, o): try: iterable = iter(o) except TypeError: pass else: return list(iterable) # Let the base class default method raise the TypeError return JSONEncoder.default(self, o) s is not JSON serializableN(t TypeErrortrepr(R%to((s$/usr/lib64/python2.7/json/encoder.pyR#scCst|trut|trU|j}|dk rU|dk rU|j|}qUn|jrht|St|Sn|j |dt }t|t t fst |}ndj |S(sReturn a JSON string representation of a Python data structure. >>> JSONEncoder().encode({"foo": ["bar", "baz"]}) '{"foo": ["bar", "baz"]}' sutf-8t _one_shottN(Rt basestringRR$RRRRR t iterencodetTruetlistttupletjoin(R%R*t _encodingtchunks((s$/usr/lib64/python2.7/json/encoder.pytencodes      c Cs|jri}nd}|jr*t}nt}|jdkrT||jd}n|jttt d}|rt dk r|j dkr|j rt ||j ||j |j |j|j |j|j }n9t||j ||j ||j |j|j |j| }||dS(sEncode the given object and yield each string representation as available. For example:: for chunk in JSONEncoder().iterencode(bigobject): mysocket.write(chunk) sutf-8cSs+t|tr!|j|}n||S(N(RRR(R*t _orig_encoderR3((s$/usr/lib64/python2.7/json/encoder.pyt_encoderscSsl||krd}n4||kr*d}n||kr?d}n ||S|shtdt|n|S(NtNaNtInfinitys -Infinitys2Out of range float values are not JSON compliant: (t ValueErrorR)(R*Rt_reprt_inft_neginfttext((s$/usr/lib64/python2.7/json/encoder.pytfloatstrs       iN(RRRRR R$Rt FLOAT_REPRtINFINITYtc_make_encoderR RR#R"R!Rt_make_iterencode(R%R*R+tmarkersR7R?t _iterencode((s$/usr/lib64/python2.7/json/encoder.pyR.s*    N( t__name__t __module__t__doc__R!R"tFalseR/RR'R#R5R.(((s$/usr/lib64/python2.7/json/encoder.pyRFs >  cs fd fd fdS(Nc 3s8|sdVdSdk rO |}|krBdn||}|rt}n|} |r||Vq|dkr|dVq|tkr|dVq|tkr1|d Vq | frX||Vq | ry||Vq|V |fr||}n0 | r||}n||}x|D] } | VqWqW|dk r|d8}dd|Vnd Vdk r4|=ndS( Ns[]sCircular reference detectedt[is t tnullttruetfalset](RR/RI( tlstt_current_indent_leveltmarkeridtbuftnewline_indentt separatortfirsttvalueR4tchunk(R:R7t _floatstrt_indentt_item_separatorREt_iterencode_dictt_iterencode_listR-tdicttfloattidtintRR0tlongRDRR1(s$/usr/lib64/python2.7/json/encoder.pyR] s^                     c 3s|sdVdSdk rO|}|krBdn||iR,RMRNRLskey s is not a stringt}(RR/tsortedtitemst iteritemsRIR(R)( tdctRQRRRTR!RVRiRdRWR4RX(R:R7RYRZR[RER\R]t_key_separatort _skipkeyst _sort_keysR-R^R_R`RaRR0RbRDRR1(s$/usr/lib64/python2.7/json/encoder.pyR\Us                        c3s |r|Vne|dkr1dVnQ|tkrEdVn=|tkrYdVn) | fr||Vn | r|Vn | frx||D] }|VqWn |rx||D] }|VqWndk rA |}|kr4dn||sN      #    PK!ĤBf6f6 __init__.pyonu[ {fc@s,dZdZddddddgZdZd d lmZd d lmZed ed e de de ddddddddZ ee e e ddddded Z ee e e ddddded Z eddddddZddddddddZddddddddZdS(s JSON (JavaScript Object Notation) is a subset of JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data interchange format. :mod:`json` exposes an API familiar to users of the standard library :mod:`marshal` and :mod:`pickle` modules. It is the externally maintained version of the :mod:`json` library contained in Python 2.6, but maintains compatibility with Python 2.4 and Python 2.5 and (currently) has significant performance advantages, even without using the optional C extension for speedups. Encoding basic Python object hierarchies:: >>> import json >>> json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}]) '["foo", {"bar": ["baz", null, 1.0, 2]}]' >>> print json.dumps("\"foo\bar") "\"foo\bar" >>> print json.dumps(u'\u1234') "\u1234" >>> print json.dumps('\\') "\\" >>> print json.dumps({"c": 0, "b": 0, "a": 0}, sort_keys=True) {"a": 0, "b": 0, "c": 0} >>> from StringIO import StringIO >>> io = StringIO() >>> json.dump(['streaming API'], io) >>> io.getvalue() '["streaming API"]' Compact encoding:: >>> import json >>> json.dumps([1,2,3,{'4': 5, '6': 7}], sort_keys=True, separators=(',',':')) '[1,2,3,{"4":5,"6":7}]' Pretty printing:: >>> import json >>> print json.dumps({'4': 5, '6': 7}, sort_keys=True, ... indent=4, separators=(',', ': ')) { "4": 5, "6": 7 } Decoding JSON:: >>> import json >>> obj = [u'foo', {u'bar': [u'baz', None, 1.0, 2]}] >>> json.loads('["foo", {"bar":["baz", null, 1.0, 2]}]') == obj True >>> json.loads('"\\"foo\\bar"') == u'"foo\x08ar' True >>> from StringIO import StringIO >>> io = StringIO('["streaming API"]') >>> json.load(io)[0] == 'streaming API' True Specializing JSON object decoding:: >>> import json >>> def as_complex(dct): ... if '__complex__' in dct: ... return complex(dct['real'], dct['imag']) ... return dct ... >>> json.loads('{"__complex__": true, "real": 1, "imag": 2}', ... object_hook=as_complex) (1+2j) >>> from decimal import Decimal >>> json.loads('1.1', parse_float=Decimal) == Decimal('1.1') True Specializing JSON object encoding:: >>> import json >>> def encode_complex(obj): ... if isinstance(obj, complex): ... return [obj.real, obj.imag] ... raise TypeError(repr(obj) + " is not JSON serializable") ... >>> json.dumps(2 + 1j, default=encode_complex) '[2.0, 1.0]' >>> json.JSONEncoder(default=encode_complex).encode(2 + 1j) '[2.0, 1.0]' >>> ''.join(json.JSONEncoder(default=encode_complex).iterencode(2 + 1j)) '[2.0, 1.0]' Using json.tool from the shell to validate and pretty-print:: $ echo '{"json":"obj"}' | python -m json.tool { "json": "obj" } $ echo '{ 1.2:3.4}' | python -m json.tool Expecting property name enclosed in double quotes: line 1 column 3 (char 2) s2.0.9tdumptdumpstloadtloadst JSONDecodert JSONEncodersBob Ippolito i(R(Rtskipkeyst ensure_asciitcheck_circulart allow_nantindentt separatorstencodingsutf-8tdefaultc Ks| ru|ru|ru|ru|d kru|d kru|d kru| dkru| d kru| ru| rutj|} n`|d krt}n|d|d|d|d|d|d|d| d | d | | j|} x| D]}|j|qWd S( s Serialize ``obj`` as a JSON formatted stream to ``fp`` (a ``.write()``-supporting file-like object). If ``skipkeys`` is true then ``dict`` keys that are not basic types (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``) will be skipped instead of raising a ``TypeError``. If ``ensure_ascii`` is true (the default), all non-ASCII characters in the output are escaped with ``\uXXXX`` sequences, and the result is a ``str`` instance consisting of ASCII characters only. If ``ensure_ascii`` is false, some chunks written to ``fp`` may be ``unicode`` instances. This usually happens because the input contains unicode strings or the ``encoding`` parameter is used. Unless ``fp.write()`` explicitly understands ``unicode`` (as in ``codecs.getwriter``) this is likely to cause an error. If ``check_circular`` is false, then the circular reference check for container types will be skipped and a circular reference will result in an ``OverflowError`` (or worse). If ``allow_nan`` is false, then it will be a ``ValueError`` to serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). If ``indent`` is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. ``None`` is the most compact representation. Since the default item separator is ``', '``, the output might include trailing whitespace when ``indent`` is specified. You can use ``separators=(',', ': ')`` to avoid this. If ``separators`` is an ``(item_separator, dict_separator)`` tuple then it will be used instead of the default ``(', ', ': ')`` separators. ``(',', ':')`` is the most compact JSON representation. ``encoding`` is the character encoding for str instances, default is UTF-8. ``default(obj)`` is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError. If *sort_keys* is true (default: ``False``), then the output of dictionaries will be sorted by key. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the ``.default()`` method to serialize additional types), specify it with the ``cls`` kwarg; otherwise ``JSONEncoder`` is used. sutf-8RRRR R R R R t sort_keysN(tNonet_default_encodert iterencodeRtwrite(tobjtfpRRRR tclsR R R R Rtkwtiterabletchunk((s%/usr/lib64/python2.7/json/__init__.pyRzs5  $&    c Ks| rp|rp|rp|rp|d krp|d krp|d krp|dkrp| d krp| rp| rptj|S|d krt}n|d|d|d|d|d|d|d|d | d | | j|S( sSerialize ``obj`` to a JSON formatted ``str``. If ``skipkeys`` is true then ``dict`` keys that are not basic types (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``) will be skipped instead of raising a ``TypeError``. If ``ensure_ascii`` is false, all non-ASCII characters are not escaped, and the return value may be a ``unicode`` instance. See ``dump`` for details. If ``check_circular`` is false, then the circular reference check for container types will be skipped and a circular reference will result in an ``OverflowError`` (or worse). If ``allow_nan`` is false, then it will be a ``ValueError`` to serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). If ``indent`` is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. ``None`` is the most compact representation. Since the default item separator is ``', '``, the output might include trailing whitespace when ``indent`` is specified. You can use ``separators=(',', ': ')`` to avoid this. If ``separators`` is an ``(item_separator, dict_separator)`` tuple then it will be used instead of the default ``(', ', ': ')`` separators. ``(',', ':')`` is the most compact JSON representation. ``encoding`` is the character encoding for str instances, default is UTF-8. ``default(obj)`` is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError. If *sort_keys* is true (default: ``False``), then the output of dictionaries will be sorted by key. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the ``.default()`` method to serialize additional types), specify it with the ``cls`` kwarg; otherwise ``JSONEncoder`` is used. sutf-8RRRR R R R R RN(RRtencodeR( RRRRR RR R R R RR((s%/usr/lib64/python2.7/json/__init__.pyRs/  $&    t object_hooktobject_pairs_hookc Ks=t|jd|d|d|d|d|d|d||S(sDeserialize ``fp`` (a ``.read()``-supporting file-like object containing a JSON document) to a Python object. If the contents of ``fp`` is encoded with an ASCII based encoding other than utf-8 (e.g. latin-1), then an appropriate ``encoding`` name must be specified. Encodings that are not ASCII based (such as UCS-2) are not allowed, and should be wrapped with ``codecs.getreader(fp)(encoding)``, or simply decoded to a ``unicode`` object and passed to ``loads()`` ``object_hook`` is an optional function that will be called with the result of any object literal decode (a ``dict``). The return value of ``object_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders (e.g. JSON-RPC class hinting). ``object_pairs_hook`` is an optional function that will be called with the result of any object literal decoded with an ordered list of pairs. The return value of ``object_pairs_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders that rely on the order that the key and value pairs are decoded (for example, collections.OrderedDict will remember the order of insertion). If ``object_hook`` is also defined, the ``object_pairs_hook`` takes priority. To use a custom ``JSONDecoder`` subclass, specify it with the ``cls`` kwarg; otherwise ``JSONDecoder`` is used. R RRt parse_floatt parse_inttparse_constantR(Rtread( RR RRRRRRR((s%/usr/lib64/python2.7/json/__init__.pyRs   c Ks|dkrh|dkrh|dkrh|dkrh|dkrh|dkrh|dkrh| rhtj|S|dkr}t}n|dk r||dcs6     E  ;  # PK!7y9tool.pycnu[ {fc@sAdZddlZddlZdZedkr=endS(sCommand-line tool to validate and pretty-print JSON Usage:: $ echo '{"json":"obj"}' | python -m json.tool { "json": "obj" } $ echo '{ 1.2:3.4}' | python -m json.tool Expecting property name enclosed in double quotes: line 1 column 3 (char 2) iNcCs>ttjdkr*tj}tj}nttjdkrattjdd}tj}n[ttjdkrttjdd}ttjdd}nttjdd|:ytj|}Wnt k r}t|nXWdQX|4tj ||dt d d d d|j dWdQXdS(Niitrbitwbis [infile [outfile]]t sort_keystindentit separatorst,s: s (Rs: ( tlentsystargvtstdintstdouttopent SystemExittjsontloadt ValueErrortdumptTruetwrite(tinfiletoutfiletobjte((s!/usr/lib64/python2.7/json/tool.pytmains&    t__main__(t__doc__RR Rt__name__(((s!/usr/lib64/python2.7/json/tool.pyt s     PK!RC55 encoder.pyonu[ {fc @sdZddlZyddlmZWnek r?dZnXyddlmZWnek rmdZnXej dZ ej dZ ej dZ idd 6d d 6d d 6dd6dd6dd6dd6Z x3edD]%Ze jeedjeqWedZejZdZdZep8eZdefdYZeeeeeee e!e"e#e$d Z%dS(sImplementation of JSONEncoder iN(tencode_basestring_ascii(t make_encoders[\x00-\x1f\\"\b\f\n\r\t]s([\\"]|[^\ -~])s [\x80-\xff]s\\s\s\"t"s\bss\fs s\ns s\rs s\ts i s \u{0:04x}tinfcCs!d}dtj||dS(s5Return a JSON representation of a Python string cSst|jdS(Ni(t ESCAPE_DCTtgroup(tmatch((s$/usr/lib64/python2.7/json/encoder.pytreplace%sR(tESCAPEtsub(tsR((s$/usr/lib64/python2.7/json/encoder.pytencode_basestring!s cCs]t|tr6tj|dk r6|jd}nd}dttj||dS(sAReturn an ASCII-only JSON representation of a Python string sutf-8cSs|jd}y t|SWnptk rt|}|dkrPdj|S|d8}d|d?d@B}d|d@B}dj||SnXdS( Niis \u{0:04x}ii iis\u{0:04x}\u{1:04x}(RRtKeyErrortordtformat(RR tnts1ts2((s$/usr/lib64/python2.7/json/encoder.pyR0s      RN(t isinstancetstrtHAS_UTF8tsearchtNonetdecodet ESCAPE_ASCIIR (R R((s$/usr/lib64/python2.7/json/encoder.pytpy_encode_basestring_ascii*s$ t JSONEncoderc Bs\eZdZdZdZeeeeeddddd ZdZ dZ edZ RS( sZExtensible JSON encoder for Python data structures. Supports the following objects and types by default: +-------------------+---------------+ | Python | JSON | +===================+===============+ | dict | object | +-------------------+---------------+ | list, tuple | array | +-------------------+---------------+ | str, unicode | string | +-------------------+---------------+ | int, long, float | number | +-------------------+---------------+ | True | true | +-------------------+---------------+ | False | false | +-------------------+---------------+ | None | null | +-------------------+---------------+ To extend this to recognize other objects, subclass and implement a ``.default()`` method with another method that returns a serializable object for ``o`` if possible, otherwise it should call the superclass implementation (to raise ``TypeError``). s, s: sutf-8c Cs|||_||_||_||_||_||_|dk rW|\|_|_n| dk ro| |_ n||_ dS(s Constructor for JSONEncoder, with sensible defaults. If skipkeys is false, then it is a TypeError to attempt encoding of keys that are not str, int, long, float or None. If skipkeys is True, such items are simply skipped. If *ensure_ascii* is true (the default), all non-ASCII characters in the output are escaped with \uXXXX sequences, and the results are str instances consisting of ASCII characters only. If ensure_ascii is False, a result may be a unicode instance. This usually happens if the input contains unicode strings or the *encoding* parameter is used. If check_circular is true, then lists, dicts, and custom encoded objects will be checked for circular references during encoding to prevent an infinite recursion (which would cause an OverflowError). Otherwise, no such check takes place. If allow_nan is true, then NaN, Infinity, and -Infinity will be encoded as such. This behavior is not JSON specification compliant, but is consistent with most JavaScript based encoders and decoders. Otherwise, it will be a ValueError to encode such floats. If sort_keys is true, then the output of dictionaries will be sorted by key; this is useful for regression tests to ensure that JSON serializations can be compared on a day-to-day basis. If indent is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. None is the most compact representation. Since the default item separator is ', ', the output might include trailing whitespace when indent is specified. You can use separators=(',', ': ') to avoid this. If specified, separators should be a (item_separator, key_separator) tuple. The default is (', ', ': '). To get the most compact JSON representation you should specify (',', ':') to eliminate whitespace. If specified, default is a function that gets called for objects that can't otherwise be serialized. It should return a JSON encodable version of the object or raise a ``TypeError``. If encoding is not None, then all input strings will be transformed into unicode using that encoding prior to JSON-encoding. The default is UTF-8. N( tskipkeyst ensure_asciitcheck_circulart allow_nant sort_keystindentRtitem_separatort key_separatortdefaulttencoding( tselfRRRRRR t separatorsR$R#((s$/usr/lib64/python2.7/json/encoder.pyt__init__es4         cCstt|ddS(slImplement this method in a subclass such that it returns a serializable object for ``o``, or calls the base implementation (to raise a ``TypeError``). For example, to support arbitrary iterators, you could implement default like this:: def default(self, o): try: iterable = iter(o) except TypeError: pass else: return list(iterable) # Let the base class default method raise the TypeError return JSONEncoder.default(self, o) s is not JSON serializableN(t TypeErrortrepr(R%to((s$/usr/lib64/python2.7/json/encoder.pyR#scCst|trut|trU|j}|dk rU|dk rU|j|}qUn|jrht|St|Sn|j |dt }t|t t fst |}ndj |S(sReturn a JSON string representation of a Python data structure. >>> JSONEncoder().encode({"foo": ["bar", "baz"]}) '{"foo": ["bar", "baz"]}' sutf-8t _one_shottN(Rt basestringRR$RRRRR t iterencodetTruetlistttupletjoin(R%R*t _encodingtchunks((s$/usr/lib64/python2.7/json/encoder.pytencodes      c Cs|jri}nd}|jr*t}nt}|jdkrT||jd}n|jttt d}|rt dk r|j dkr|j rt ||j ||j |j |j|j |j|j }n9t||j ||j ||j |j|j |j| }||dS(sEncode the given object and yield each string representation as available. For example:: for chunk in JSONEncoder().iterencode(bigobject): mysocket.write(chunk) sutf-8cSs+t|tr!|j|}n||S(N(RRR(R*t _orig_encoderR3((s$/usr/lib64/python2.7/json/encoder.pyt_encoderscSsl||krd}n4||kr*d}n||kr?d}n ||S|shtdt|n|S(NtNaNtInfinitys -Infinitys2Out of range float values are not JSON compliant: (t ValueErrorR)(R*Rt_reprt_inft_neginfttext((s$/usr/lib64/python2.7/json/encoder.pytfloatstrs       iN(RRRRR R$Rt FLOAT_REPRtINFINITYtc_make_encoderR RR#R"R!Rt_make_iterencode(R%R*R+tmarkersR7R?t _iterencode((s$/usr/lib64/python2.7/json/encoder.pyR.s*    N( t__name__t __module__t__doc__R!R"tFalseR/RR'R#R5R.(((s$/usr/lib64/python2.7/json/encoder.pyRFs >  cs fd fd fdS(Nc 3s8|sdVdSdk rO |}|krBdn||}|rt}n|} |r||Vq|dkr|dVq|tkr|dVq|tkr1|d Vq | frX||Vq | ry||Vq|V |fr||}n0 | r||}n||}x|D] } | VqWqW|dk r|d8}dd|Vnd Vdk r4|=ndS( Ns[]sCircular reference detectedt[is t tnullttruetfalset](RR/RI( tlstt_current_indent_leveltmarkeridtbuftnewline_indentt separatortfirsttvalueR4tchunk(R:R7t _floatstrt_indentt_item_separatorREt_iterencode_dictt_iterencode_listR-tdicttfloattidtintRR0tlongRDRR1(s$/usr/lib64/python2.7/json/encoder.pyR] s^                     c 3s|sdVdSdk rO|}|krBdn||iR,RMRNRLskey s is not a stringt}(RR/tsortedtitemst iteritemsRIR(R)( tdctRQRRRTR!RVRiRdRWR4RX(R:R7RYRZR[RER\R]t_key_separatort _skipkeyst _sort_keysR-R^R_R`RaRR0RbRDRR1(s$/usr/lib64/python2.7/json/encoder.pyR\Us                        c3s |r|Vne|dkr1dVnQ|tkrEdVn=|tkrYdVn) | fr||Vn | r|Vn | frx||D] }|VqWn |rx||D] }|VqWndk rA |}|kr4dn||sN      #    PK!ze scanner.pyonu[ {fc@sdZddlZyddlmZWnek r?dZnXdgZejdej ej Bej BZ dZ ep~e ZdS(sJSON token scanner iN(t make_scannerRs)(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?c s|j |j|j tj|j|j |j|j|j |j |j  f dS(NcsZy||}Wntk r'tnX|dkrK ||d S|dkrz ||df S|dkr||dfS|dkr|||d!dkrd|dfS|dkr|||d!d krt|dfS|d kr0|||d !d kr0t|d fS||}|dk r|j\}}}|sl|r||p{d |pd }n |}||jfS|dkr|||d!dkrd|dfS|dkr|||d!dkrd|dfS|dkrP|||d!dkrPd|dfStdS(Nt"it{t[tnitnullttttruetfitfalsettNitNaNtIitInfinityt-i s -Infinity(t IndexErrort StopIterationtNonetTruetFalsetgroupstend(tstringtidxtnextchartmtintegertfractexptres( t _scan_oncetencodingt match_numbert object_hooktobject_pairs_hookt parse_arraytparse_constantt parse_floatt parse_intt parse_objectt parse_stringtstrict(s$/usr/lib64/python2.7/json/scanner.pyRs>      ###  # ###( R(R$R)t NUMBER_REtmatchR R*R&R'R%R"R#(tcontext(( RR R!R"R#R$R%R&R'R(R)R*s$/usr/lib64/python2.7/json/scanner.pytpy_make_scanners           0%(t__doc__tret_jsonRtc_make_scannert ImportErrorRt__all__tcompiletVERBOSEt MULTILINEtDOTALLR+R.(((s$/usr/lib64/python2.7/json/scanner.pyts     4PK!~.. decoder.pycnu[ {fc@sdZddlZddlZddlZddlmZyddlmZWne k rgdZnXdgZ ej ej BejBZdZe\ZZZdZddZied 6ed 6ed 6Zejd eZid d6dd6dd6dd6dd6dd6dd6dd6ZdZdZdeeejdZepSeZejd eZd!Z eje d"Z!eje d#Z"de#fd$YZ$dS(%sImplementation of JSONDecoder iN(tscanner(t scanstringt JSONDecodercCs8tjdd\}tjdd\}||| fS(Ns>dss(tstructtunpack(tnantinf((s$/usr/lib64/python2.7/json/decoder.pyt_floatconstantsscCsU|jdd|d}|dkr2|d}n||jdd|}||fS(Ns ii(tcounttrindex(tdoctpostlinenotcolno((s$/usr/lib64/python2.7/json/decoder.pytlinecols   c Cswt||\}}|dkr=d}|j||||St||\}}d}|j|||||||S(Ns#{0}: line {1} column {2} (char {3})s?{0}: line {1} column {2} - line {3} column {4} (char {5} - {6})(RtNonetformat( tmsgR R tendR R tfmtt endlinenotendcolno((s$/usr/lib64/python2.7/json/decoder.pyterrmsg"s s -InfinitytInfinitytNaNs(.*?)(["\\\x00-\x1f])u"t"u\s\u/t/utbu tfu tnu tru ttsutf-8cCs||d|d!}t|dkr_|ddkr_yt|dSWq_tk r[q_Xnd}tt|||dS(NiiitxXisInvalid \uXXXX escape(tlentintt ValueErrorR(tsR tescR((s$/usr/lib64/python2.7/json/decoder.pyt _decode_uXXXX?s" cCs|dkrt}ng}|j}|d}xO|||} | dkrgttd||n| j}| j\} } | rt| tst| |} n|| n| dkrPnL| dkr|rdj | } tt| ||q|| q1ny||} Wn)t k rNttd||nX| dkry|| }Wn9t k rdt | } tt| ||nX|d7}nt ||}|d7}tjd krfd |kod knrf|||d !d krft ||d}d|ko7dknrfd|d d>|dB}|d7}qfnt|}||q1Wdj||fS(sScan the string s for a JSON string. End is the index of the character in s after the quote that started the JSON string. Unescapes all valid JSON string escape sequences and raises ValueError on attempt to decode an invalid string. If strict is False then literal control characters are allowed in the string. Returns a tuple of the decoded string and the index of the character in s after the end quote.isUnterminated string starting atRs\s"Invalid control character {0!r} attusInvalid \escape: iiiiis\uiiii iuN(RtDEFAULT_ENCODINGtappendR#RRtgroupst isinstancetunicodeRt IndexErrortKeyErrortreprR&tsyst maxunicodetunichrtjoin(R$Rtencodingtstrictt_bt_mtchunkst_appendtbegintchunktcontentt terminatorRR%tchartunituni2((s$/usr/lib64/python2.7/json/decoder.pyt py_scanstringIs^               3 s [ \t\n\r]*s cCs|\}} g} | j} || | d!} | dkr| |krm||| j} || | d!} n| dkr|dk r|| } | | dfSi} |dk r|| } n| | dfS| dkrttd|| qn| d7} xtrt|| ||\}} || | d!dkr||| j} || | d!dkrttd|| qn| d7} yM|| |kr| d7} || |kr||| dj} qnWntk rnXy||| \}} Wn)tk r6ttd|| nX| ||fy@|| } | |kr||| dj} || } nWntk rd} nX| d7} | dkrPn+| d krttd || dnyc|| } | |krH| d7} || } | |krH||| dj} || } qHnWntk rbd} nX| d7} | dkrttd|| dqqW|dk r|| } | | fSt | } |dk r|| } n| | fS( NiRt}s1Expecting property name enclosed in double quotest:sExpecting ':' delimitersExpecting objecttt,sExpecting ',' delimiter( R)RRR#RtTrueRR-t StopIterationtdict(t s_and_endR4R5t scan_oncet object_hooktobject_pairs_hookt_wt_wsR$Rtpairst pairs_appendtnextchartresulttkeytvalue((s$/usr/lib64/python2.7/json/decoder.pyt JSONObjects             #                       c Cs|\}}g}|||d!}||kr\|||dj}|||d!}n|dkrv||dfS|j}xEtry|||\} }Wn)tk rttd||nX|| |||d!}||kr!|||dj}|||d!}n|d7}|dkr;Pn'|dkrbttd||nyM|||kr|d7}|||kr|||dj}qnWqtk rqXqW||fS(Nit]sExpecting objectREsExpecting ',' delimiter(RR)RFRGR#RR-( RIRJRMRNR$RtvaluesRQR9RT((s$/usr/lib64/python2.7/json/decoder.pyt JSONArrays@            # cBsGeZdZdddddeddZejdZddZ RS(sSimple JSON decoder Performs the following translations in decoding by default: +---------------+-------------------+ | JSON | Python | +===============+===================+ | object | dict | +---------------+-------------------+ | array | list | +---------------+-------------------+ | string | unicode | +---------------+-------------------+ | number (int) | int, long | +---------------+-------------------+ | number (real) | float | +---------------+-------------------+ | true | True | +---------------+-------------------+ | false | False | +---------------+-------------------+ | null | None | +---------------+-------------------+ It also understands ``NaN``, ``Infinity``, and ``-Infinity`` as their corresponding ``float`` values, which is outside the JSON spec. cCs||_||_||_|p$t|_|p3t|_|pEtj|_ ||_ t |_ t |_t|_tj||_dS(s``encoding`` determines the encoding used to interpret any ``str`` objects decoded by this instance (utf-8 by default). It has no effect when decoding ``unicode`` objects. Note that currently only encodings that are a superset of ASCII work, strings of other encodings should be passed in as ``unicode``. ``object_hook``, if specified, will be called with the result of every JSON object decoded and its return value will be used in place of the given ``dict``. This can be used to provide custom deserializations (e.g. to support JSON-RPC class hinting). ``object_pairs_hook``, if specified will be called with the result of every JSON object decoded with an ordered list of pairs. The return value of ``object_pairs_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders that rely on the order that the key and value pairs are decoded (for example, collections.OrderedDict will remember the order of insertion). If ``object_hook`` is also defined, the ``object_pairs_hook`` takes priority. ``parse_float``, if specified, will be called with the string of every JSON float to be decoded. By default this is equivalent to float(num_str). This can be used to use another datatype or parser for JSON floats (e.g. decimal.Decimal). ``parse_int``, if specified, will be called with the string of every JSON int to be decoded. By default this is equivalent to int(num_str). This can be used to use another datatype or parser for JSON integers (e.g. float). ``parse_constant``, if specified, will be called with one of the following strings: -Infinity, Infinity, NaN. This can be used to raise an exception if invalid JSON numbers are encountered. If ``strict`` is false (true is the default), then control characters will be allowed inside strings. Control characters in this context are those with character codes in the 0-31 range, including ``'\t'`` (tab), ``'\n'``, ``'\r'`` and ``'\0'``. N(R4RKRLtfloatt parse_floatR"t parse_intt _CONSTANTSt __getitem__tparse_constantR5RUt parse_objectRXt parse_arrayRt parse_stringRt make_scannerRJ(tselfR4RKRZR[R^R5RL((s$/usr/lib64/python2.7/json/decoder.pyt__init__.s-       cCsy|j|d||dj\}}|||j}|t|kruttd||t|n|S(szReturn the Python representation of ``s`` (a ``str`` or ``unicode`` instance containing a JSON document) tidxis Extra data(t raw_decodeRR!R#R(RcR$RMtobjR((s$/usr/lib64/python2.7/json/decoder.pytdecodegs *$icCsFy|j||\}}Wntk r;tdnX||fS(sLDecode a JSON document from ``s`` (a ``str`` or ``unicode`` beginning with a JSON document) and return a 2-tuple of the Python representation and the index in ``s`` where the document ended. This can be used to decode a JSON document from a string that may have extraneous data at the end. sNo JSON object could be decoded(RJRGR#(RcR$ReRgR((s$/usr/lib64/python2.7/json/decoder.pyRfrs  N( t__name__t __module__t__doc__RRFRdt WHITESPACEtmatchRhRf(((s$/usr/lib64/python2.7/json/decoder.pyRs    7 (%RktreR0RtjsonRt_jsonRt c_scanstringt ImportErrorRt__all__tVERBOSEt MULTILINEtDOTALLtFLAGSRRtPosInftNegInfRRR\tcompilet STRINGCHUNKt BACKSLASHR(R&RFRmRARltWHITESPACE_STRRURXtobjectR(((s$/usr/lib64/python2.7/json/decoder.pyts@         & E W$PK!7y9tool.pyonu[ {fc@sAdZddlZddlZdZedkr=endS(sCommand-line tool to validate and pretty-print JSON Usage:: $ echo '{"json":"obj"}' | python -m json.tool { "json": "obj" } $ echo '{ 1.2:3.4}' | python -m json.tool Expecting property name enclosed in double quotes: line 1 column 3 (char 2) iNcCs>ttjdkr*tj}tj}nttjdkrattjdd}tj}n[ttjdkrttjdd}ttjdd}nttjdd|:ytj|}Wnt k r}t|nXWdQX|4tj ||dt d d d d|j dWdQXdS(Niitrbitwbis [infile [outfile]]t sort_keystindentit separatorst,s: s (Rs: ( tlentsystargvtstdintstdouttopent SystemExittjsontloadt ValueErrortdumptTruetwrite(tinfiletoutfiletobjte((s!/usr/lib64/python2.7/json/tool.pytmains&    t__main__(t__doc__RR Rt__name__(((s!/usr/lib64/python2.7/json/tool.pyt s     PK!~.. decoder.pyonu[ {fc@sdZddlZddlZddlZddlmZyddlmZWne k rgdZnXdgZ ej ej BejBZdZe\ZZZdZddZied 6ed 6ed 6Zejd eZid d6dd6dd6dd6dd6dd6dd6dd6ZdZdZdeeejdZepSeZejd eZd!Z eje d"Z!eje d#Z"de#fd$YZ$dS(%sImplementation of JSONDecoder iN(tscanner(t scanstringt JSONDecodercCs8tjdd\}tjdd\}||| fS(Ns>dss(tstructtunpack(tnantinf((s$/usr/lib64/python2.7/json/decoder.pyt_floatconstantsscCsU|jdd|d}|dkr2|d}n||jdd|}||fS(Ns ii(tcounttrindex(tdoctpostlinenotcolno((s$/usr/lib64/python2.7/json/decoder.pytlinecols   c Cswt||\}}|dkr=d}|j||||St||\}}d}|j|||||||S(Ns#{0}: line {1} column {2} (char {3})s?{0}: line {1} column {2} - line {3} column {4} (char {5} - {6})(RtNonetformat( tmsgR R tendR R tfmtt endlinenotendcolno((s$/usr/lib64/python2.7/json/decoder.pyterrmsg"s s -InfinitytInfinitytNaNs(.*?)(["\\\x00-\x1f])u"t"u\s\u/t/utbu tfu tnu tru ttsutf-8cCs||d|d!}t|dkr_|ddkr_yt|dSWq_tk r[q_Xnd}tt|||dS(NiiitxXisInvalid \uXXXX escape(tlentintt ValueErrorR(tsR tescR((s$/usr/lib64/python2.7/json/decoder.pyt _decode_uXXXX?s" cCs|dkrt}ng}|j}|d}xO|||} | dkrgttd||n| j}| j\} } | rt| tst| |} n|| n| dkrPnL| dkr|rdj | } tt| ||q|| q1ny||} Wn)t k rNttd||nX| dkry|| }Wn9t k rdt | } tt| ||nX|d7}nt ||}|d7}tjd krfd |kod knrf|||d !d krft ||d}d|ko7dknrfd|d d>|dB}|d7}qfnt|}||q1Wdj||fS(sScan the string s for a JSON string. End is the index of the character in s after the quote that started the JSON string. Unescapes all valid JSON string escape sequences and raises ValueError on attempt to decode an invalid string. If strict is False then literal control characters are allowed in the string. Returns a tuple of the decoded string and the index of the character in s after the end quote.isUnterminated string starting atRs\s"Invalid control character {0!r} attusInvalid \escape: iiiiis\uiiii iuN(RtDEFAULT_ENCODINGtappendR#RRtgroupst isinstancetunicodeRt IndexErrortKeyErrortreprR&tsyst maxunicodetunichrtjoin(R$Rtencodingtstrictt_bt_mtchunkst_appendtbegintchunktcontentt terminatorRR%tchartunituni2((s$/usr/lib64/python2.7/json/decoder.pyt py_scanstringIs^               3 s [ \t\n\r]*s cCs|\}} g} | j} || | d!} | dkr| |krm||| j} || | d!} n| dkr|dk r|| } | | dfSi} |dk r|| } n| | dfS| dkrttd|| qn| d7} xtrt|| ||\}} || | d!dkr||| j} || | d!dkrttd|| qn| d7} yM|| |kr| d7} || |kr||| dj} qnWntk rnXy||| \}} Wn)tk r6ttd|| nX| ||fy@|| } | |kr||| dj} || } nWntk rd} nX| d7} | dkrPn+| d krttd || dnyc|| } | |krH| d7} || } | |krH||| dj} || } qHnWntk rbd} nX| d7} | dkrttd|| dqqW|dk r|| } | | fSt | } |dk r|| } n| | fS( NiRt}s1Expecting property name enclosed in double quotest:sExpecting ':' delimitersExpecting objecttt,sExpecting ',' delimiter( R)RRR#RtTrueRR-t StopIterationtdict(t s_and_endR4R5t scan_oncet object_hooktobject_pairs_hookt_wt_wsR$Rtpairst pairs_appendtnextchartresulttkeytvalue((s$/usr/lib64/python2.7/json/decoder.pyt JSONObjects             #                       c Cs|\}}g}|||d!}||kr\|||dj}|||d!}n|dkrv||dfS|j}xEtry|||\} }Wn)tk rttd||nX|| |||d!}||kr!|||dj}|||d!}n|d7}|dkr;Pn'|dkrbttd||nyM|||kr|d7}|||kr|||dj}qnWqtk rqXqW||fS(Nit]sExpecting objectREsExpecting ',' delimiter(RR)RFRGR#RR-( RIRJRMRNR$RtvaluesRQR9RT((s$/usr/lib64/python2.7/json/decoder.pyt JSONArrays@            # cBsGeZdZdddddeddZejdZddZ RS(sSimple JSON decoder Performs the following translations in decoding by default: +---------------+-------------------+ | JSON | Python | +===============+===================+ | object | dict | +---------------+-------------------+ | array | list | +---------------+-------------------+ | string | unicode | +---------------+-------------------+ | number (int) | int, long | +---------------+-------------------+ | number (real) | float | +---------------+-------------------+ | true | True | +---------------+-------------------+ | false | False | +---------------+-------------------+ | null | None | +---------------+-------------------+ It also understands ``NaN``, ``Infinity``, and ``-Infinity`` as their corresponding ``float`` values, which is outside the JSON spec. cCs||_||_||_|p$t|_|p3t|_|pEtj|_ ||_ t |_ t |_t|_tj||_dS(s``encoding`` determines the encoding used to interpret any ``str`` objects decoded by this instance (utf-8 by default). It has no effect when decoding ``unicode`` objects. Note that currently only encodings that are a superset of ASCII work, strings of other encodings should be passed in as ``unicode``. ``object_hook``, if specified, will be called with the result of every JSON object decoded and its return value will be used in place of the given ``dict``. This can be used to provide custom deserializations (e.g. to support JSON-RPC class hinting). ``object_pairs_hook``, if specified will be called with the result of every JSON object decoded with an ordered list of pairs. The return value of ``object_pairs_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders that rely on the order that the key and value pairs are decoded (for example, collections.OrderedDict will remember the order of insertion). If ``object_hook`` is also defined, the ``object_pairs_hook`` takes priority. ``parse_float``, if specified, will be called with the string of every JSON float to be decoded. By default this is equivalent to float(num_str). This can be used to use another datatype or parser for JSON floats (e.g. decimal.Decimal). ``parse_int``, if specified, will be called with the string of every JSON int to be decoded. By default this is equivalent to int(num_str). This can be used to use another datatype or parser for JSON integers (e.g. float). ``parse_constant``, if specified, will be called with one of the following strings: -Infinity, Infinity, NaN. This can be used to raise an exception if invalid JSON numbers are encountered. If ``strict`` is false (true is the default), then control characters will be allowed inside strings. Control characters in this context are those with character codes in the 0-31 range, including ``'\t'`` (tab), ``'\n'``, ``'\r'`` and ``'\0'``. N(R4RKRLtfloatt parse_floatR"t parse_intt _CONSTANTSt __getitem__tparse_constantR5RUt parse_objectRXt parse_arrayRt parse_stringRt make_scannerRJ(tselfR4RKRZR[R^R5RL((s$/usr/lib64/python2.7/json/decoder.pyt__init__.s-       cCsy|j|d||dj\}}|||j}|t|kruttd||t|n|S(szReturn the Python representation of ``s`` (a ``str`` or ``unicode`` instance containing a JSON document) tidxis Extra data(t raw_decodeRR!R#R(RcR$RMtobjR((s$/usr/lib64/python2.7/json/decoder.pytdecodegs *$icCsFy|j||\}}Wntk r;tdnX||fS(sLDecode a JSON document from ``s`` (a ``str`` or ``unicode`` beginning with a JSON document) and return a 2-tuple of the Python representation and the index in ``s`` where the document ended. This can be used to decode a JSON document from a string that may have extraneous data at the end. sNo JSON object could be decoded(RJRGR#(RcR$ReRgR((s$/usr/lib64/python2.7/json/decoder.pyRfrs  N( t__name__t __module__t__doc__RRFRdt WHITESPACEtmatchRhRf(((s$/usr/lib64/python2.7/json/decoder.pyRs    7 (%RktreR0RtjsonRt_jsonRt c_scanstringt ImportErrorRt__all__tVERBOSEt MULTILINEtDOTALLtFLAGSRRtPosInftNegInfRRR\tcompilet STRINGCHUNKt BACKSLASHR(R&RFRmRARltWHITESPACE_STRRURXtobjectR(((s$/usr/lib64/python2.7/json/decoder.pyts@         & E W$PK!ĤBf6f6 __init__.pycnu[ {fc@s,dZdZddddddgZdZd d lmZd d lmZed ed e de de ddddddddZ ee e e ddddded Z ee e e ddddded Z eddddddZddddddddZddddddddZdS(s JSON (JavaScript Object Notation) is a subset of JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data interchange format. :mod:`json` exposes an API familiar to users of the standard library :mod:`marshal` and :mod:`pickle` modules. It is the externally maintained version of the :mod:`json` library contained in Python 2.6, but maintains compatibility with Python 2.4 and Python 2.5 and (currently) has significant performance advantages, even without using the optional C extension for speedups. Encoding basic Python object hierarchies:: >>> import json >>> json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}]) '["foo", {"bar": ["baz", null, 1.0, 2]}]' >>> print json.dumps("\"foo\bar") "\"foo\bar" >>> print json.dumps(u'\u1234') "\u1234" >>> print json.dumps('\\') "\\" >>> print json.dumps({"c": 0, "b": 0, "a": 0}, sort_keys=True) {"a": 0, "b": 0, "c": 0} >>> from StringIO import StringIO >>> io = StringIO() >>> json.dump(['streaming API'], io) >>> io.getvalue() '["streaming API"]' Compact encoding:: >>> import json >>> json.dumps([1,2,3,{'4': 5, '6': 7}], sort_keys=True, separators=(',',':')) '[1,2,3,{"4":5,"6":7}]' Pretty printing:: >>> import json >>> print json.dumps({'4': 5, '6': 7}, sort_keys=True, ... indent=4, separators=(',', ': ')) { "4": 5, "6": 7 } Decoding JSON:: >>> import json >>> obj = [u'foo', {u'bar': [u'baz', None, 1.0, 2]}] >>> json.loads('["foo", {"bar":["baz", null, 1.0, 2]}]') == obj True >>> json.loads('"\\"foo\\bar"') == u'"foo\x08ar' True >>> from StringIO import StringIO >>> io = StringIO('["streaming API"]') >>> json.load(io)[0] == 'streaming API' True Specializing JSON object decoding:: >>> import json >>> def as_complex(dct): ... if '__complex__' in dct: ... return complex(dct['real'], dct['imag']) ... return dct ... >>> json.loads('{"__complex__": true, "real": 1, "imag": 2}', ... object_hook=as_complex) (1+2j) >>> from decimal import Decimal >>> json.loads('1.1', parse_float=Decimal) == Decimal('1.1') True Specializing JSON object encoding:: >>> import json >>> def encode_complex(obj): ... if isinstance(obj, complex): ... return [obj.real, obj.imag] ... raise TypeError(repr(obj) + " is not JSON serializable") ... >>> json.dumps(2 + 1j, default=encode_complex) '[2.0, 1.0]' >>> json.JSONEncoder(default=encode_complex).encode(2 + 1j) '[2.0, 1.0]' >>> ''.join(json.JSONEncoder(default=encode_complex).iterencode(2 + 1j)) '[2.0, 1.0]' Using json.tool from the shell to validate and pretty-print:: $ echo '{"json":"obj"}' | python -m json.tool { "json": "obj" } $ echo '{ 1.2:3.4}' | python -m json.tool Expecting property name enclosed in double quotes: line 1 column 3 (char 2) s2.0.9tdumptdumpstloadtloadst JSONDecodert JSONEncodersBob Ippolito i(R(Rtskipkeyst ensure_asciitcheck_circulart allow_nantindentt separatorstencodingsutf-8tdefaultc Ks| ru|ru|ru|ru|d kru|d kru|d kru| dkru| d kru| ru| rutj|} n`|d krt}n|d|d|d|d|d|d|d| d | d | | j|} x| D]}|j|qWd S( s Serialize ``obj`` as a JSON formatted stream to ``fp`` (a ``.write()``-supporting file-like object). If ``skipkeys`` is true then ``dict`` keys that are not basic types (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``) will be skipped instead of raising a ``TypeError``. If ``ensure_ascii`` is true (the default), all non-ASCII characters in the output are escaped with ``\uXXXX`` sequences, and the result is a ``str`` instance consisting of ASCII characters only. If ``ensure_ascii`` is false, some chunks written to ``fp`` may be ``unicode`` instances. This usually happens because the input contains unicode strings or the ``encoding`` parameter is used. Unless ``fp.write()`` explicitly understands ``unicode`` (as in ``codecs.getwriter``) this is likely to cause an error. If ``check_circular`` is false, then the circular reference check for container types will be skipped and a circular reference will result in an ``OverflowError`` (or worse). If ``allow_nan`` is false, then it will be a ``ValueError`` to serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). If ``indent`` is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. ``None`` is the most compact representation. Since the default item separator is ``', '``, the output might include trailing whitespace when ``indent`` is specified. You can use ``separators=(',', ': ')`` to avoid this. If ``separators`` is an ``(item_separator, dict_separator)`` tuple then it will be used instead of the default ``(', ', ': ')`` separators. ``(',', ':')`` is the most compact JSON representation. ``encoding`` is the character encoding for str instances, default is UTF-8. ``default(obj)`` is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError. If *sort_keys* is true (default: ``False``), then the output of dictionaries will be sorted by key. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the ``.default()`` method to serialize additional types), specify it with the ``cls`` kwarg; otherwise ``JSONEncoder`` is used. sutf-8RRRR R R R R t sort_keysN(tNonet_default_encodert iterencodeRtwrite(tobjtfpRRRR tclsR R R R Rtkwtiterabletchunk((s%/usr/lib64/python2.7/json/__init__.pyRzs5  $&    c Ks| rp|rp|rp|rp|d krp|d krp|d krp|dkrp| d krp| rp| rptj|S|d krt}n|d|d|d|d|d|d|d|d | d | | j|S( sSerialize ``obj`` to a JSON formatted ``str``. If ``skipkeys`` is true then ``dict`` keys that are not basic types (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``) will be skipped instead of raising a ``TypeError``. If ``ensure_ascii`` is false, all non-ASCII characters are not escaped, and the return value may be a ``unicode`` instance. See ``dump`` for details. If ``check_circular`` is false, then the circular reference check for container types will be skipped and a circular reference will result in an ``OverflowError`` (or worse). If ``allow_nan`` is false, then it will be a ``ValueError`` to serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). If ``indent`` is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. ``None`` is the most compact representation. Since the default item separator is ``', '``, the output might include trailing whitespace when ``indent`` is specified. You can use ``separators=(',', ': ')`` to avoid this. If ``separators`` is an ``(item_separator, dict_separator)`` tuple then it will be used instead of the default ``(', ', ': ')`` separators. ``(',', ':')`` is the most compact JSON representation. ``encoding`` is the character encoding for str instances, default is UTF-8. ``default(obj)`` is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError. If *sort_keys* is true (default: ``False``), then the output of dictionaries will be sorted by key. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the ``.default()`` method to serialize additional types), specify it with the ``cls`` kwarg; otherwise ``JSONEncoder`` is used. sutf-8RRRR R R R R RN(RRtencodeR( RRRRR RR R R R RR((s%/usr/lib64/python2.7/json/__init__.pyRs/  $&    t object_hooktobject_pairs_hookc Ks=t|jd|d|d|d|d|d|d||S(sDeserialize ``fp`` (a ``.read()``-supporting file-like object containing a JSON document) to a Python object. If the contents of ``fp`` is encoded with an ASCII based encoding other than utf-8 (e.g. latin-1), then an appropriate ``encoding`` name must be specified. Encodings that are not ASCII based (such as UCS-2) are not allowed, and should be wrapped with ``codecs.getreader(fp)(encoding)``, or simply decoded to a ``unicode`` object and passed to ``loads()`` ``object_hook`` is an optional function that will be called with the result of any object literal decode (a ``dict``). The return value of ``object_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders (e.g. JSON-RPC class hinting). ``object_pairs_hook`` is an optional function that will be called with the result of any object literal decoded with an ordered list of pairs. The return value of ``object_pairs_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders that rely on the order that the key and value pairs are decoded (for example, collections.OrderedDict will remember the order of insertion). If ``object_hook`` is also defined, the ``object_pairs_hook`` takes priority. To use a custom ``JSONDecoder`` subclass, specify it with the ``cls`` kwarg; otherwise ``JSONDecoder`` is used. R RRt parse_floatt parse_inttparse_constantR(Rtread( RR RRRRRRR((s%/usr/lib64/python2.7/json/__init__.pyRs   c Ks|dkrh|dkrh|dkrh|dkrh|dkrh|dkrh|dkrh| rhtj|S|dkr}t}n|dk r||dcs6     E  ;  # PK!wDD version.rbnu[# frozen_string_literal: true module JSON VERSION = '2.18.0' end PK! ext.rbnu[# frozen_string_literal: true require 'json/common' module JSON # This module holds all the modules/classes that implement JSON's # functionality as C extensions. module Ext class Parser class << self def parse(...) new(...).parse end alias_method :parse, :parse # Allow redefinition by extensions end def initialize(source, opts = nil) @source = source @config = Config.new(opts) end def source @source.dup end def parse @config.parse(@source) end end require 'json/ext/parser' Ext::Parser::Config = Ext::ParserConfig JSON.parser = Ext::Parser if RUBY_ENGINE == 'truffleruby' require 'json/truffle_ruby/generator' JSON.generator = JSON::TruffleRuby::Generator else require 'json/ext/generator' JSON.generator = Generator end end JSON_LOADED = true unless defined?(JSON::JSON_LOADED) end PK!pl~~generic_object.rbnu[# frozen_string_literal: true begin require 'ostruct' rescue LoadError warn "JSON::GenericObject requires 'ostruct'. Please install it with `gem install ostruct`." end module JSON class GenericObject < OpenStruct class << self alias [] new def json_creatable? @json_creatable end attr_writer :json_creatable def json_create(data) data = data.dup data.delete JSON.create_id self[data] end def from_hash(object) case when object.respond_to?(:to_hash) result = new object.to_hash.each do |key, value| result[key] = from_hash(value) end result when object.respond_to?(:to_ary) object.to_ary.map { |a| from_hash(a) } else object end end def load(source, proc = nil, opts = {}) result = ::JSON.load(source, proc, opts.merge(:object_class => self)) result.nil? ? new : result end def dump(obj, *args) ::JSON.dump(obj, *args) end end self.json_creatable = false def to_hash table end def |(other) self.class[other.to_hash.merge(to_hash)] end def as_json(*) { JSON.create_id => self.class.name }.merge to_hash end def to_json(*a) as_json.to_json(*a) end end if defined?(::OpenStruct) end PK!aZ++ common.rbnu[# frozen_string_literal: true require 'json/version' module JSON autoload :GenericObject, 'json/generic_object' module ParserOptions # :nodoc: class << self def prepare(opts) if opts[:object_class] || opts[:array_class] opts = opts.dup on_load = opts[:on_load] on_load = object_class_proc(opts[:object_class], on_load) if opts[:object_class] on_load = array_class_proc(opts[:array_class], on_load) if opts[:array_class] opts[:on_load] = on_load end if opts.fetch(:create_additions, false) != false opts = create_additions_proc(opts) end opts end private def object_class_proc(object_class, on_load) ->(obj) do if Hash === obj object = object_class.new obj.each { |k, v| object[k] = v } obj = object end on_load.nil? ? obj : on_load.call(obj) end end def array_class_proc(array_class, on_load) ->(obj) do if Array === obj array = array_class.new obj.each { |v| array << v } obj = array end on_load.nil? ? obj : on_load.call(obj) end end # TODO: extract :create_additions support to another gem for version 3.0 def create_additions_proc(opts) if opts[:symbolize_names] raise ArgumentError, "options :symbolize_names and :create_additions cannot be used in conjunction" end opts = opts.dup create_additions = opts.fetch(:create_additions, false) on_load = opts[:on_load] object_class = opts[:object_class] || Hash opts[:on_load] = ->(object) do case object when String opts[:match_string]&.each do |pattern, klass| if match = pattern.match(object) create_additions_warning if create_additions.nil? object = klass.json_create(object) break end end when object_class if opts[:create_additions] != false if class_path = object[JSON.create_id] klass = begin Object.const_get(class_path) rescue NameError => e raise ArgumentError, "can't get const #{class_path}: #{e}" end if klass.respond_to?(:json_creatable?) ? klass.json_creatable? : klass.respond_to?(:json_create) create_additions_warning if create_additions.nil? object = klass.json_create(object) end end end end on_load.nil? ? object : on_load.call(object) end opts end def create_additions_warning JSON.deprecation_warning "JSON.load implicit support for `create_additions: true` is deprecated " \ "and will be removed in 3.0, use JSON.unsafe_load or explicitly " \ "pass `create_additions: true`" end end end class << self def deprecation_warning(message, uplevel = 3) # :nodoc: gem_root = File.expand_path("..", __dir__) + "/" caller_locations(uplevel, 10).each do |frame| if frame.path.nil? || frame.path.start_with?(gem_root) || frame.path.end_with?("/truffle/cext_ruby.rb", ".c") uplevel += 1 else break end end if RUBY_VERSION >= "3.0" warn(message, uplevel: uplevel, category: :deprecated) else warn(message, uplevel: uplevel) end end # :call-seq: # JSON[object] -> new_array or new_string # # If +object+ is a \String, # calls JSON.parse with +object+ and +opts+ (see method #parse): # json = '[0, 1, null]' # JSON[json]# => [0, 1, nil] # # Otherwise, calls JSON.generate with +object+ and +opts+ (see method #generate): # ruby = [0, 1, nil] # JSON[ruby] # => '[0,1,null]' def [](object, opts = nil) if object.is_a?(String) return JSON.parse(object, opts) elsif object.respond_to?(:to_str) str = object.to_str if str.is_a?(String) return JSON.parse(str, opts) end end JSON.generate(object, opts) end # Returns the JSON parser class that is used by JSON. attr_reader :parser # Set the JSON parser class _parser_ to be used by JSON. def parser=(parser) # :nodoc: @parser = parser remove_const :Parser if const_defined?(:Parser, false) const_set :Parser, parser end # Set the module _generator_ to be used by JSON. def generator=(generator) # :nodoc: old, $VERBOSE = $VERBOSE, nil @generator = generator generator_methods = generator::GeneratorMethods for const in generator_methods.constants klass = const_get(const) modul = generator_methods.const_get(const) klass.class_eval do instance_methods(false).each do |m| m.to_s == 'to_json' and remove_method m end include modul end end self.state = generator::State const_set :State, state ensure $VERBOSE = old end # Returns the JSON generator module that is used by JSON. attr_reader :generator # Sets or Returns the JSON generator state class that is used by JSON. attr_accessor :state private # Called from the extension when a hash has both string and symbol keys def on_mixed_keys_hash(hash, do_raise) set = {} hash.each_key do |key| key_str = key.to_s if set[key_str] message = "detected duplicate key #{key_str.inspect} in #{hash.inspect}" if do_raise raise GeneratorError, message else deprecation_warning("#{message}.\nThis will raise an error in json 3.0 unless enabled via `allow_duplicate_key: true`") end else set[key_str] = true end end end def deprecated_singleton_attr_accessor(*attrs) args = RUBY_VERSION >= "3.0" ? ", category: :deprecated" : "" attrs.each do |attr| singleton_class.class_eval <<~RUBY def #{attr} warn "JSON.#{attr} is deprecated and will be removed in json 3.0.0", uplevel: 1 #{args} @#{attr} end def #{attr}=(val) warn "JSON.#{attr}= is deprecated and will be removed in json 3.0.0", uplevel: 1 #{args} @#{attr} = val end def _#{attr} @#{attr} end RUBY end end end # Sets create identifier, which is used to decide if the _json_create_ # hook of a class should be called; initial value is +json_class+: # JSON.create_id # => 'json_class' def self.create_id=(new_value) Thread.current[:"JSON.create_id"] = new_value.dup.freeze end # Returns the current create identifier. # See also JSON.create_id=. def self.create_id Thread.current[:"JSON.create_id"] || 'json_class' end NaN = Float::NAN Infinity = Float::INFINITY MinusInfinity = -Infinity # The base exception for JSON errors. class JSONError < StandardError; end # This exception is raised if a parser error occurs. class ParserError < JSONError attr_reader :line, :column end # This exception is raised if the nesting of parsed data structures is too # deep. class NestingError < ParserError; end # This exception is raised if a generator or unparser error occurs. class GeneratorError < JSONError attr_reader :invalid_object def initialize(message, invalid_object = nil) super(message) @invalid_object = invalid_object end def detailed_message(...) # Exception#detailed_message doesn't exist until Ruby 3.2 super_message = defined?(super) ? super : message if @invalid_object.nil? super_message else "#{super_message}\nInvalid object: #{@invalid_object.inspect}" end end end # Fragment of JSON document that is to be included as is: # fragment = JSON::Fragment.new("[1, 2, 3]") # JSON.generate({ count: 3, items: fragments }) # # This allows to easily assemble multiple JSON fragments that have # been persisted somewhere without having to parse them nor resorting # to string interpolation. # # Note: no validation is performed on the provided string. It is the # responsibility of the caller to ensure the string contains valid JSON. Fragment = Struct.new(:json) do def initialize(json) unless string = String.try_convert(json) raise TypeError, " no implicit conversion of #{json.class} into String" end super(string) end def to_json(state = nil, *) json end end module_function # :call-seq: # JSON.parse(source, opts) -> object # # Returns the Ruby objects created by parsing the given +source+. # # Argument +source+ contains the \String to be parsed. # # Argument +opts+, if given, contains a \Hash of options for the parsing. # See {Parsing Options}[#module-JSON-label-Parsing+Options]. # # --- # # When +source+ is a \JSON array, returns a Ruby \Array: # source = '["foo", 1.0, true, false, null]' # ruby = JSON.parse(source) # ruby # => ["foo", 1.0, true, false, nil] # ruby.class # => Array # # When +source+ is a \JSON object, returns a Ruby \Hash: # source = '{"a": "foo", "b": 1.0, "c": true, "d": false, "e": null}' # ruby = JSON.parse(source) # ruby # => {"a"=>"foo", "b"=>1.0, "c"=>true, "d"=>false, "e"=>nil} # ruby.class # => Hash # # For examples of parsing for all \JSON data types, see # {Parsing \JSON}[#module-JSON-label-Parsing+JSON]. # # Parses nested JSON objects: # source = <<~JSON # { # "name": "Dave", # "age" :40, # "hats": [ # "Cattleman's", # "Panama", # "Tophat" # ] # } # JSON # ruby = JSON.parse(source) # ruby # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]} # # --- # # Raises an exception if +source+ is not valid JSON: # # Raises JSON::ParserError (783: unexpected token at ''): # JSON.parse('') # def parse(source, opts = nil) opts = ParserOptions.prepare(opts) unless opts.nil? Parser.parse(source, opts) end PARSE_L_OPTIONS = { max_nesting: false, allow_nan: true, }.freeze private_constant :PARSE_L_OPTIONS # :call-seq: # JSON.parse!(source, opts) -> object # # Calls # parse(source, opts) # with +source+ and possibly modified +opts+. # # Differences from JSON.parse: # - Option +max_nesting+, if not provided, defaults to +false+, # which disables checking for nesting depth. # - Option +allow_nan+, if not provided, defaults to +true+. def parse!(source, opts = nil) if opts.nil? parse(source, PARSE_L_OPTIONS) else parse(source, PARSE_L_OPTIONS.merge(opts)) end end # :call-seq: # JSON.load_file(path, opts={}) -> object # # Calls: # parse(File.read(path), opts) # # See method #parse. def load_file(filespec, opts = nil) parse(File.read(filespec, encoding: Encoding::UTF_8), opts) end # :call-seq: # JSON.load_file!(path, opts = {}) # # Calls: # JSON.parse!(File.read(path, opts)) # # See method #parse! def load_file!(filespec, opts = nil) parse!(File.read(filespec, encoding: Encoding::UTF_8), opts) end # :call-seq: # JSON.generate(obj, opts = nil) -> new_string # # Returns a \String containing the generated \JSON data. # # See also JSON.pretty_generate. # # Argument +obj+ is the Ruby object to be converted to \JSON. # # Argument +opts+, if given, contains a \Hash of options for the generation. # See {Generating Options}[#module-JSON-label-Generating+Options]. # # --- # # When +obj+ is an \Array, returns a \String containing a \JSON array: # obj = ["foo", 1.0, true, false, nil] # json = JSON.generate(obj) # json # => '["foo",1.0,true,false,null]' # # When +obj+ is a \Hash, returns a \String containing a \JSON object: # obj = {foo: 0, bar: 's', baz: :bat} # json = JSON.generate(obj) # json # => '{"foo":0,"bar":"s","baz":"bat"}' # # For examples of generating from other Ruby objects, see # {Generating \JSON from Other Objects}[#module-JSON-label-Generating+JSON+from+Other+Objects]. # # --- # # Raises an exception if any formatting option is not a \String. # # Raises an exception if +obj+ contains circular references: # a = []; b = []; a.push(b); b.push(a) # # Raises JSON::NestingError (nesting of 100 is too deep): # JSON.generate(a) # def generate(obj, opts = nil) if State === opts opts.generate(obj) else State.generate(obj, opts, nil) end end # :call-seq: # JSON.fast_generate(obj, opts) -> new_string # # Arguments +obj+ and +opts+ here are the same as # arguments +obj+ and +opts+ in JSON.generate. # # By default, generates \JSON data without checking # for circular references in +obj+ (option +max_nesting+ set to +false+, disabled). # # Raises an exception if +obj+ contains circular references: # a = []; b = []; a.push(b); b.push(a) # # Raises SystemStackError (stack level too deep): # JSON.fast_generate(a) def fast_generate(obj, opts = nil) if RUBY_VERSION >= "3.0" warn "JSON.fast_generate is deprecated and will be removed in json 3.0.0, just use JSON.generate", uplevel: 1, category: :deprecated else warn "JSON.fast_generate is deprecated and will be removed in json 3.0.0, just use JSON.generate", uplevel: 1 end generate(obj, opts) end PRETTY_GENERATE_OPTIONS = { indent: ' ', space: ' ', object_nl: "\n", array_nl: "\n", }.freeze private_constant :PRETTY_GENERATE_OPTIONS # :call-seq: # JSON.pretty_generate(obj, opts = nil) -> new_string # # Arguments +obj+ and +opts+ here are the same as # arguments +obj+ and +opts+ in JSON.generate. # # Default options are: # { # indent: ' ', # Two spaces # space: ' ', # One space # array_nl: "\n", # Newline # object_nl: "\n" # Newline # } # # Example: # obj = {foo: [:bar, :baz], bat: {bam: 0, bad: 1}} # json = JSON.pretty_generate(obj) # puts json # Output: # { # "foo": [ # "bar", # "baz" # ], # "bat": { # "bam": 0, # "bad": 1 # } # } # def pretty_generate(obj, opts = nil) return opts.generate(obj) if State === opts options = PRETTY_GENERATE_OPTIONS if opts unless opts.is_a?(Hash) if opts.respond_to? :to_hash opts = opts.to_hash elsif opts.respond_to? :to_h opts = opts.to_h else raise TypeError, "can't convert #{opts.class} into Hash" end end options = options.merge(opts) end State.generate(obj, options, nil) end # Sets or returns default options for the JSON.unsafe_load method. # Initially: # opts = JSON.load_default_options # opts # => {:max_nesting=>false, :allow_nan=>true, :allow_blank=>true, :create_additions=>true} deprecated_singleton_attr_accessor :unsafe_load_default_options @unsafe_load_default_options = { :max_nesting => false, :allow_nan => true, :allow_blank => true, :create_additions => true, } # Sets or returns default options for the JSON.load method. # Initially: # opts = JSON.load_default_options # opts # => {:max_nesting=>false, :allow_nan=>true, :allow_blank=>true, :create_additions=>true} deprecated_singleton_attr_accessor :load_default_options @load_default_options = { :allow_nan => true, :allow_blank => true, :create_additions => nil, } # :call-seq: # JSON.unsafe_load(source, options = {}) -> object # JSON.unsafe_load(source, proc = nil, options = {}) -> object # # Returns the Ruby objects created by parsing the given +source+. # # BEWARE: This method is meant to serialise data from trusted user input, # like from your own database server or clients under your control, it could # be dangerous to allow untrusted users to pass JSON sources into it. # # - Argument +source+ must be, or be convertible to, a \String: # - If +source+ responds to instance method +to_str+, # source.to_str becomes the source. # - If +source+ responds to instance method +to_io+, # source.to_io.read becomes the source. # - If +source+ responds to instance method +read+, # source.read becomes the source. # - If both of the following are true, source becomes the \String 'null': # - Option +allow_blank+ specifies a truthy value. # - The source, as defined above, is +nil+ or the empty \String ''. # - Otherwise, +source+ remains the source. # - Argument +proc+, if given, must be a \Proc that accepts one argument. # It will be called recursively with each result (depth-first order). # See details below. # - Argument +opts+, if given, contains a \Hash of options for the parsing. # See {Parsing Options}[#module-JSON-label-Parsing+Options]. # The default options can be changed via method JSON.unsafe_load_default_options=. # # --- # # When no +proc+ is given, modifies +source+ as above and returns the result of # parse(source, opts); see #parse. # # Source for following examples: # source = <<~JSON # { # "name": "Dave", # "age" :40, # "hats": [ # "Cattleman's", # "Panama", # "Tophat" # ] # } # JSON # # Load a \String: # ruby = JSON.unsafe_load(source) # ruby # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]} # # Load an \IO object: # require 'stringio' # object = JSON.unsafe_load(StringIO.new(source)) # object # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]} # # Load a \File object: # path = 't.json' # File.write(path, source) # File.open(path) do |file| # JSON.unsafe_load(file) # end # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]} # # --- # # When +proc+ is given: # - Modifies +source+ as above. # - Gets the +result+ from calling parse(source, opts). # - Recursively calls proc(result). # - Returns the final result. # # Example: # require 'json' # # # Some classes for the example. # class Base # def initialize(attributes) # @attributes = attributes # end # end # class User < Base; end # class Account < Base; end # class Admin < Base; end # # The JSON source. # json = <<-EOF # { # "users": [ # {"type": "User", "username": "jane", "email": "jane@example.com"}, # {"type": "User", "username": "john", "email": "john@example.com"} # ], # "accounts": [ # {"account": {"type": "Account", "paid": true, "account_id": "1234"}}, # {"account": {"type": "Account", "paid": false, "account_id": "1235"}} # ], # "admins": {"type": "Admin", "password": "0wn3d"} # } # EOF # # Deserializer method. # def deserialize_obj(obj, safe_types = %w(User Account Admin)) # type = obj.is_a?(Hash) && obj["type"] # safe_types.include?(type) ? Object.const_get(type).new(obj) : obj # end # # Call to JSON.unsafe_load # ruby = JSON.unsafe_load(json, proc {|obj| # case obj # when Hash # obj.each {|k, v| obj[k] = deserialize_obj v } # when Array # obj.map! {|v| deserialize_obj v } # end # obj # }) # pp ruby # Output: # {"users"=> # [#"User", "username"=>"jane", "email"=>"jane@example.com"}>, # #"User", "username"=>"john", "email"=>"john@example.com"}>], # "accounts"=> # [{"account"=> # #"Account", "paid"=>true, "account_id"=>"1234"}>}, # {"account"=> # #"Account", "paid"=>false, "account_id"=>"1235"}>}], # "admins"=> # #"Admin", "password"=>"0wn3d"}>} # def unsafe_load(source, proc = nil, options = nil) opts = if options.nil? if proc && proc.is_a?(Hash) options, proc = proc, nil options else _unsafe_load_default_options end else _unsafe_load_default_options.merge(options) end unless source.is_a?(String) if source.respond_to? :to_str source = source.to_str elsif source.respond_to? :to_io source = source.to_io.read elsif source.respond_to?(:read) source = source.read end end if opts[:allow_blank] && (source.nil? || source.empty?) source = 'null' end if proc opts = opts.dup opts[:on_load] = proc.to_proc end parse(source, opts) end # :call-seq: # JSON.load(source, options = {}) -> object # JSON.load(source, proc = nil, options = {}) -> object # # Returns the Ruby objects created by parsing the given +source+. # # BEWARE: This method is meant to serialise data from trusted user input, # like from your own database server or clients under your control, it could # be dangerous to allow untrusted users to pass JSON sources into it. # If you must use it, use JSON.unsafe_load instead to make it clear. # # Since JSON version 2.8.0, `load` emits a deprecation warning when a # non native type is deserialized, without `create_additions` being explicitly # enabled, and in JSON version 3.0, `load` will have `create_additions` disabled # by default. # # - Argument +source+ must be, or be convertible to, a \String: # - If +source+ responds to instance method +to_str+, # source.to_str becomes the source. # - If +source+ responds to instance method +to_io+, # source.to_io.read becomes the source. # - If +source+ responds to instance method +read+, # source.read becomes the source. # - If both of the following are true, source becomes the \String 'null': # - Option +allow_blank+ specifies a truthy value. # - The source, as defined above, is +nil+ or the empty \String ''. # - Otherwise, +source+ remains the source. # - Argument +proc+, if given, must be a \Proc that accepts one argument. # It will be called recursively with each result (depth-first order). # See details below. # - Argument +opts+, if given, contains a \Hash of options for the parsing. # See {Parsing Options}[#module-JSON-label-Parsing+Options]. # The default options can be changed via method JSON.load_default_options=. # # --- # # When no +proc+ is given, modifies +source+ as above and returns the result of # parse(source, opts); see #parse. # # Source for following examples: # source = <<~JSON # { # "name": "Dave", # "age" :40, # "hats": [ # "Cattleman's", # "Panama", # "Tophat" # ] # } # JSON # # Load a \String: # ruby = JSON.load(source) # ruby # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]} # # Load an \IO object: # require 'stringio' # object = JSON.load(StringIO.new(source)) # object # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]} # # Load a \File object: # path = 't.json' # File.write(path, source) # File.open(path) do |file| # JSON.load(file) # end # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]} # # --- # # When +proc+ is given: # - Modifies +source+ as above. # - Gets the +result+ from calling parse(source, opts). # - Recursively calls proc(result). # - Returns the final result. # # Example: # require 'json' # # # Some classes for the example. # class Base # def initialize(attributes) # @attributes = attributes # end # end # class User < Base; end # class Account < Base; end # class Admin < Base; end # # The JSON source. # json = <<-EOF # { # "users": [ # {"type": "User", "username": "jane", "email": "jane@example.com"}, # {"type": "User", "username": "john", "email": "john@example.com"} # ], # "accounts": [ # {"account": {"type": "Account", "paid": true, "account_id": "1234"}}, # {"account": {"type": "Account", "paid": false, "account_id": "1235"}} # ], # "admins": {"type": "Admin", "password": "0wn3d"} # } # EOF # # Deserializer method. # def deserialize_obj(obj, safe_types = %w(User Account Admin)) # type = obj.is_a?(Hash) && obj["type"] # safe_types.include?(type) ? Object.const_get(type).new(obj) : obj # end # # Call to JSON.load # ruby = JSON.load(json, proc {|obj| # case obj # when Hash # obj.each {|k, v| obj[k] = deserialize_obj v } # when Array # obj.map! {|v| deserialize_obj v } # end # obj # }) # pp ruby # Output: # {"users"=> # [#"User", "username"=>"jane", "email"=>"jane@example.com"}>, # #"User", "username"=>"john", "email"=>"john@example.com"}>], # "accounts"=> # [{"account"=> # #"Account", "paid"=>true, "account_id"=>"1234"}>}, # {"account"=> # #"Account", "paid"=>false, "account_id"=>"1235"}>}], # "admins"=> # #"Admin", "password"=>"0wn3d"}>} # def load(source, proc = nil, options = nil) if proc && options.nil? && proc.is_a?(Hash) options = proc proc = nil end opts = if options.nil? if proc && proc.is_a?(Hash) options, proc = proc, nil options else _load_default_options end else _load_default_options.merge(options) end unless source.is_a?(String) if source.respond_to? :to_str source = source.to_str elsif source.respond_to? :to_io source = source.to_io.read elsif source.respond_to?(:read) source = source.read end end if opts[:allow_blank] && (source.nil? || source.empty?) source = 'null' end if proc opts = opts.dup opts[:on_load] = proc.to_proc end parse(source, opts) end # Sets or returns the default options for the JSON.dump method. # Initially: # opts = JSON.dump_default_options # opts # => {:max_nesting=>false, :allow_nan=>true} deprecated_singleton_attr_accessor :dump_default_options @dump_default_options = { :max_nesting => false, :allow_nan => true, } # :call-seq: # JSON.dump(obj, io = nil, limit = nil) # # Dumps +obj+ as a \JSON string, i.e. calls generate on the object and returns the result. # # The default options can be changed via method JSON.dump_default_options. # # - Argument +io+, if given, should respond to method +write+; # the \JSON \String is written to +io+, and +io+ is returned. # If +io+ is not given, the \JSON \String is returned. # - Argument +limit+, if given, is passed to JSON.generate as option +max_nesting+. # # --- # # When argument +io+ is not given, returns the \JSON \String generated from +obj+: # obj = {foo: [0, 1], bar: {baz: 2, bat: 3}, bam: :bad} # json = JSON.dump(obj) # json # => "{\"foo\":[0,1],\"bar\":{\"baz\":2,\"bat\":3},\"bam\":\"bad\"}" # # When argument +io+ is given, writes the \JSON \String to +io+ and returns +io+: # path = 't.json' # File.open(path, 'w') do |file| # JSON.dump(obj, file) # end # => # # puts File.read(path) # Output: # {"foo":[0,1],"bar":{"baz":2,"bat":3},"bam":"bad"} def dump(obj, anIO = nil, limit = nil, kwargs = nil) if kwargs.nil? if limit.nil? if anIO.is_a?(Hash) kwargs = anIO anIO = nil end elsif limit.is_a?(Hash) kwargs = limit limit = nil end end unless anIO.nil? if anIO.respond_to?(:to_io) anIO = anIO.to_io elsif limit.nil? && !anIO.respond_to?(:write) anIO, limit = nil, anIO end end opts = JSON._dump_default_options opts = opts.merge(:max_nesting => limit) if limit opts = opts.merge(kwargs) if kwargs begin State.generate(obj, opts, anIO) rescue JSON::NestingError raise ArgumentError, "exceed depth limit" end end # :stopdoc: # All these were meant to be deprecated circa 2009, but were just set as undocumented # so usage still exist in the wild. def unparse(...) if RUBY_VERSION >= "3.0" warn "JSON.unparse is deprecated and will be removed in json 3.0.0, just use JSON.generate", uplevel: 1, category: :deprecated else warn "JSON.unparse is deprecated and will be removed in json 3.0.0, just use JSON.generate", uplevel: 1 end generate(...) end module_function :unparse def fast_unparse(...) if RUBY_VERSION >= "3.0" warn "JSON.fast_unparse is deprecated and will be removed in json 3.0.0, just use JSON.generate", uplevel: 1, category: :deprecated else warn "JSON.fast_unparse is deprecated and will be removed in json 3.0.0, just use JSON.generate", uplevel: 1 end generate(...) end module_function :fast_unparse def pretty_unparse(...) if RUBY_VERSION >= "3.0" warn "JSON.pretty_unparse is deprecated and will be removed in json 3.0.0, just use JSON.pretty_generate", uplevel: 1, category: :deprecated else warn "JSON.pretty_unparse is deprecated and will be removed in json 3.0.0, just use JSON.pretty_generate", uplevel: 1 end pretty_generate(...) end module_function :fast_unparse def restore(...) if RUBY_VERSION >= "3.0" warn "JSON.restore is deprecated and will be removed in json 3.0.0, just use JSON.load", uplevel: 1, category: :deprecated else warn "JSON.restore is deprecated and will be removed in json 3.0.0, just use JSON.load", uplevel: 1 end load(...) end module_function :restore class << self private def const_missing(const_name) case const_name when :PRETTY_STATE_PROTOTYPE if RUBY_VERSION >= "3.0" warn "JSON::PRETTY_STATE_PROTOTYPE is deprecated and will be removed in json 3.0.0, just use JSON.pretty_generate", uplevel: 1, category: :deprecated else warn "JSON::PRETTY_STATE_PROTOTYPE is deprecated and will be removed in json 3.0.0, just use JSON.pretty_generate", uplevel: 1 end state.new(PRETTY_GENERATE_OPTIONS) else super end end end # :startdoc: # JSON::Coder holds a parser and generator configuration. # # module MyApp # JSONC_CODER = JSON::Coder.new( # allow_trailing_comma: true # ) # end # # MyApp::JSONC_CODER.load(document) # class Coder # :call-seq: # JSON.new(options = nil, &block) # # Argument +options+, if given, contains a \Hash of options for both parsing and generating. # See {Parsing Options}[#module-JSON-label-Parsing+Options], and {Generating Options}[#module-JSON-label-Generating+Options]. # # For generation, the strict: true option is always set. When a Ruby object with no native \JSON counterpart is # encountered, the block provided to the initialize method is invoked, and must return a Ruby object that has a native # \JSON counterpart: # # module MyApp # API_JSON_CODER = JSON::Coder.new do |object| # case object # when Time # object.iso8601(3) # else # object # Unknown type, will raise # end # end # end # # puts MyApp::API_JSON_CODER.dump(Time.now.utc) # => "2025-01-21T08:41:44.286Z" # def initialize(options = nil, &as_json) if options.nil? options = { strict: true } else options = options.dup options[:strict] = true end options[:as_json] = as_json if as_json @state = State.new(options).freeze @parser_config = Ext::Parser::Config.new(ParserOptions.prepare(options)).freeze end # call-seq: # dump(object) -> String # dump(object, io) -> io # # Serialize the given object into a \JSON document. def dump(object, io = nil) @state.generate(object, io) end alias_method :generate, :dump # call-seq: # load(string) -> Object # # Parse the given \JSON document and return an equivalent Ruby object. def load(source) @parser_config.parse(source) end alias_method :parse, :load # call-seq: # load(path) -> Object # # Parse the given \JSON document and return an equivalent Ruby object. def load_file(path) load(File.read(path, encoding: Encoding::UTF_8)) end end end module ::Kernel private # Outputs _objs_ to STDOUT as JSON strings in the shortest form, that is in # one line. def j(*objs) if RUBY_VERSION >= "3.0" warn "Kernel#j is deprecated and will be removed in json 3.0.0", uplevel: 1, category: :deprecated else warn "Kernel#j is deprecated and will be removed in json 3.0.0", uplevel: 1 end objs.each do |obj| puts JSON.generate(obj, :allow_nan => true, :max_nesting => false) end nil end # Outputs _objs_ to STDOUT as JSON strings in a pretty format, with # indentation and over many lines. def jj(*objs) if RUBY_VERSION >= "3.0" warn "Kernel#jj is deprecated and will be removed in json 3.0.0", uplevel: 1, category: :deprecated else warn "Kernel#jj is deprecated and will be removed in json 3.0.0", uplevel: 1 end objs.each do |obj| puts JSON.pretty_generate(obj, :allow_nan => true, :max_nesting => false) end nil end # If _object_ is string-like, parse the string and return the parsed result as # a Ruby data structure. Otherwise, generate a JSON text from the Ruby data # structure object and return it. # # The _opts_ argument is passed through to generate/parse respectively. See # generate and parse for their documentation. def JSON(object, opts = nil) JSON[object, opts] end end PK!5add/rational.rbnu[# frozen_string_literal: true unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED require 'json' end class Rational # See #as_json. def self.json_create(object) Rational(object['n'], object['d']) end # Methods Rational#as_json and +Rational.json_create+ may be used # to serialize and deserialize a \Rational object; # see Marshal[rdoc-ref:Marshal]. # # \Method Rational#as_json serializes +self+, # returning a 2-element hash representing +self+: # # require 'json/add/rational' # x = Rational(2, 3).as_json # # => {"json_class"=>"Rational", "n"=>2, "d"=>3} # # \Method +JSON.create+ deserializes such a hash, returning a \Rational object: # # Rational.json_create(x) # # => (2/3) # def as_json(*) { JSON.create_id => self.class.name, 'n' => numerator, 'd' => denominator, } end # Returns a JSON string representing +self+: # # require 'json/add/rational' # puts Rational(2, 3).to_json # # Output: # # {"json_class":"Rational","n":2,"d":3} # def to_json(*args) as_json.to_json(*args) end end PK!ۛadd/exception.rbnu[# frozen_string_literal: true unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED require 'json' end class Exception # See #as_json. def self.json_create(object) result = new(object['m']) result.set_backtrace object['b'] result end # Methods Exception#as_json and +Exception.json_create+ may be used # to serialize and deserialize a \Exception object; # see Marshal[rdoc-ref:Marshal]. # # \Method Exception#as_json serializes +self+, # returning a 2-element hash representing +self+: # # require 'json/add/exception' # x = Exception.new('Foo').as_json # => {"json_class"=>"Exception", "m"=>"Foo", "b"=>nil} # # \Method +JSON.create+ deserializes such a hash, returning a \Exception object: # # Exception.json_create(x) # => # # def as_json(*) { JSON.create_id => self.class.name, 'm' => message, 'b' => backtrace, } end # Returns a JSON string representing +self+: # # require 'json/add/exception' # puts Exception.new('Foo').to_json # # Output: # # {"json_class":"Exception","m":"Foo","b":null} # def to_json(*args) as_json.to_json(*args) end end PK!eg add/symbol.rbnu[# frozen_string_literal: true unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED require 'json' end class Symbol # Methods Symbol#as_json and +Symbol.json_create+ may be used # to serialize and deserialize a \Symbol object; # see Marshal[rdoc-ref:Marshal]. # # \Method Symbol#as_json serializes +self+, # returning a 2-element hash representing +self+: # # require 'json/add/symbol' # x = :foo.as_json # # => {"json_class"=>"Symbol", "s"=>"foo"} # # \Method +JSON.create+ deserializes such a hash, returning a \Symbol object: # # Symbol.json_create(x) # => :foo # def as_json(*) { JSON.create_id => self.class.name, 's' => to_s, } end # Returns a JSON string representing +self+: # # require 'json/add/symbol' # puts :foo.to_json # # Output: # # # {"json_class":"Symbol","s":"foo"} # def to_json(state = nil, *a) state = ::JSON::State.from_state(state) if state.strict? super else as_json.to_json(state, *a) end end # See #as_json. def self.json_create(o) o['s'].to_sym end end PK!i22add/complex.rbnu[# frozen_string_literal: true unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED require 'json' end class Complex # See #as_json. def self.json_create(object) Complex(object['r'], object['i']) end # Methods Complex#as_json and +Complex.json_create+ may be used # to serialize and deserialize a \Complex object; # see Marshal[rdoc-ref:Marshal]. # # \Method Complex#as_json serializes +self+, # returning a 2-element hash representing +self+: # # require 'json/add/complex' # x = Complex(2).as_json # => {"json_class"=>"Complex", "r"=>2, "i"=>0} # y = Complex(2.0, 4).as_json # => {"json_class"=>"Complex", "r"=>2.0, "i"=>4} # # \Method +JSON.create+ deserializes such a hash, returning a \Complex object: # # Complex.json_create(x) # => (2+0i) # Complex.json_create(y) # => (2.0+4i) # def as_json(*) { JSON.create_id => self.class.name, 'r' => real, 'i' => imag, } end # Returns a JSON string representing +self+: # # require 'json/add/complex' # puts Complex(2).to_json # puts Complex(2.0, 4).to_json # # Output: # # {"json_class":"Complex","r":2,"i":0} # {"json_class":"Complex","r":2.0,"i":4} # def to_json(*args) as_json.to_json(*args) end end PK!   add/date.rbnu[# frozen_string_literal: true unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED require 'json' end require 'date' class Date # See #as_json. def self.json_create(object) civil(*object.values_at('y', 'm', 'd', 'sg')) end alias start sg unless method_defined?(:start) # Methods Date#as_json and +Date.json_create+ may be used # to serialize and deserialize a \Date object; # see Marshal[rdoc-ref:Marshal]. # # \Method Date#as_json serializes +self+, # returning a 2-element hash representing +self+: # # require 'json/add/date' # x = Date.today.as_json # # => {"json_class"=>"Date", "y"=>2023, "m"=>11, "d"=>21, "sg"=>2299161.0} # # \Method +JSON.create+ deserializes such a hash, returning a \Date object: # # Date.json_create(x) # # => # # def as_json(*) { JSON.create_id => self.class.name, 'y' => year, 'm' => month, 'd' => day, 'sg' => start, } end # Returns a JSON string representing +self+: # # require 'json/add/date' # puts Date.today.to_json # # Output: # # {"json_class":"Date","y":2023,"m":11,"d":21,"sg":2299161.0} # def to_json(*args) as_json.to_json(*args) end end PK!t%A, add/time.rbnu[# frozen_string_literal: true unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED require 'json' end class Time # See #as_json. def self.json_create(object) if usec = object.delete('u') # used to be tv_usec -> tv_nsec object['n'] = usec * 1000 end at(object['s'], Rational(object['n'], 1000)) end # Methods Time#as_json and +Time.json_create+ may be used # to serialize and deserialize a \Time object; # see Marshal[rdoc-ref:Marshal]. # # \Method Time#as_json serializes +self+, # returning a 2-element hash representing +self+: # # require 'json/add/time' # x = Time.now.as_json # # => {"json_class"=>"Time", "s"=>1700931656, "n"=>472846644} # # \Method +JSON.create+ deserializes such a hash, returning a \Time object: # # Time.json_create(x) # # => 2023-11-25 11:00:56.472846644 -0600 # def as_json(*) { JSON.create_id => self.class.name, 's' => tv_sec, 'n' => tv_nsec, } end # Returns a JSON string representing +self+: # # require 'json/add/time' # puts Time.now.to_json # # Output: # # {"json_class":"Time","s":1700931678,"n":980650786} # def to_json(*args) as_json.to_json(*args) end end PK!`DYY add/regexp.rbnu[# frozen_string_literal: true unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED require 'json' end class Regexp # See #as_json. def self.json_create(object) new(object['s'], object['o']) end # Methods Regexp#as_json and +Regexp.json_create+ may be used # to serialize and deserialize a \Regexp object; # see Marshal[rdoc-ref:Marshal]. # # \Method Regexp#as_json serializes +self+, # returning a 2-element hash representing +self+: # # require 'json/add/regexp' # x = /foo/.as_json # # => {"json_class"=>"Regexp", "o"=>0, "s"=>"foo"} # # \Method +JSON.create+ deserializes such a hash, returning a \Regexp object: # # Regexp.json_create(x) # => /foo/ # def as_json(*) { JSON.create_id => self.class.name, 'o' => options, 's' => source, } end # Returns a JSON string representing +self+: # # require 'json/add/regexp' # puts /foo/.to_json # # Output: # # {"json_class":"Regexp","o":0,"s":"foo"} # def to_json(*args) as_json.to_json(*args) end end PK!7add/bigdecimal.rbnu[# frozen_string_literal: true unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED require 'json' end begin require 'bigdecimal' rescue LoadError end class BigDecimal # See #as_json. def self.json_create(object) BigDecimal._load object['b'] end # Methods BigDecimal#as_json and +BigDecimal.json_create+ may be used # to serialize and deserialize a \BigDecimal object; # see Marshal[rdoc-ref:Marshal]. # # \Method BigDecimal#as_json serializes +self+, # returning a 2-element hash representing +self+: # # require 'json/add/bigdecimal' # x = BigDecimal(2).as_json # => {"json_class"=>"BigDecimal", "b"=>"27:0.2e1"} # y = BigDecimal(2.0, 4).as_json # => {"json_class"=>"BigDecimal", "b"=>"36:0.2e1"} # z = BigDecimal(Complex(2, 0)).as_json # => {"json_class"=>"BigDecimal", "b"=>"27:0.2e1"} # # \Method +JSON.create+ deserializes such a hash, returning a \BigDecimal object: # # BigDecimal.json_create(x) # => 0.2e1 # BigDecimal.json_create(y) # => 0.2e1 # BigDecimal.json_create(z) # => 0.2e1 # def as_json(*) { JSON.create_id => self.class.name, 'b' => _dump.force_encoding(Encoding::UTF_8), } end # Returns a JSON string representing +self+: # # require 'json/add/bigdecimal' # puts BigDecimal(2).to_json # puts BigDecimal(2.0, 4).to_json # puts BigDecimal(Complex(2, 0)).to_json # # Output: # # {"json_class":"BigDecimal","b":"27:0.2e1"} # {"json_class":"BigDecimal","b":"36:0.2e1"} # {"json_class":"BigDecimal","b":"27:0.2e1"} # def to_json(*args) as_json.to_json(*args) end end if defined?(::BigDecimal) PK!o/CCadd/date_time.rbnu[# frozen_string_literal: true unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED require 'json' end require 'date' class DateTime # See #as_json. def self.json_create(object) args = object.values_at('y', 'm', 'd', 'H', 'M', 'S') of_a, of_b = object['of'].split('/') if of_b and of_b != '0' args << Rational(of_a.to_i, of_b.to_i) else args << of_a end args << object['sg'] civil(*args) end alias start sg unless method_defined?(:start) # Methods DateTime#as_json and +DateTime.json_create+ may be used # to serialize and deserialize a \DateTime object; # see Marshal[rdoc-ref:Marshal]. # # \Method DateTime#as_json serializes +self+, # returning a 2-element hash representing +self+: # # require 'json/add/datetime' # x = DateTime.now.as_json # # => {"json_class"=>"DateTime", "y"=>2023, "m"=>11, "d"=>21, "sg"=>2299161.0} # # \Method +JSON.create+ deserializes such a hash, returning a \DateTime object: # # DateTime.json_create(x) # BUG? Raises Date::Error "invalid date" # def as_json(*) { JSON.create_id => self.class.name, 'y' => year, 'm' => month, 'd' => day, 'H' => hour, 'M' => min, 'S' => sec, 'of' => offset.to_s, 'sg' => start, } end # Returns a JSON string representing +self+: # # require 'json/add/datetime' # puts DateTime.now.to_json # # Output: # # {"json_class":"DateTime","y":2023,"m":11,"d":21,"sg":2299161.0} # def to_json(*args) as_json.to_json(*args) end end PK!D%D add/struct.rbnu[# frozen_string_literal: true unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED require 'json' end class Struct # See #as_json. def self.json_create(object) new(*object['v']) end # Methods Struct#as_json and +Struct.json_create+ may be used # to serialize and deserialize a \Struct object; # see Marshal[rdoc-ref:Marshal]. # # \Method Struct#as_json serializes +self+, # returning a 2-element hash representing +self+: # # require 'json/add/struct' # Customer = Struct.new('Customer', :name, :address, :zip) # x = Struct::Customer.new.as_json # # => {"json_class"=>"Struct::Customer", "v"=>[nil, nil, nil]} # # \Method +JSON.create+ deserializes such a hash, returning a \Struct object: # # Struct::Customer.json_create(x) # # => # # def as_json(*) klass = self.class.name klass.to_s.empty? and raise JSON::JSONError, "Only named structs are supported!" { JSON.create_id => klass, 'v' => values, } end # Returns a JSON string representing +self+: # # require 'json/add/struct' # Customer = Struct.new('Customer', :name, :address, :zip) # puts Struct::Customer.new.to_json # # Output: # # {"json_class":"Struct","t":{'name':'Rowdy',"age":null}} # def to_json(*args) as_json.to_json(*args) end end PK!r add/range.rbnu[# frozen_string_literal: true unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED require 'json' end class Range # See #as_json. def self.json_create(object) new(*object['a']) end # Methods Range#as_json and +Range.json_create+ may be used # to serialize and deserialize a \Range object; # see Marshal[rdoc-ref:Marshal]. # # \Method Range#as_json serializes +self+, # returning a 2-element hash representing +self+: # # require 'json/add/range' # x = (1..4).as_json # => {"json_class"=>"Range", "a"=>[1, 4, false]} # y = (1...4).as_json # => {"json_class"=>"Range", "a"=>[1, 4, true]} # z = ('a'..'d').as_json # => {"json_class"=>"Range", "a"=>["a", "d", false]} # # \Method +JSON.create+ deserializes such a hash, returning a \Range object: # # Range.json_create(x) # => 1..4 # Range.json_create(y) # => 1...4 # Range.json_create(z) # => "a".."d" # def as_json(*) { JSON.create_id => self.class.name, 'a' => [ first, last, exclude_end? ] } end # Returns a JSON string representing +self+: # # require 'json/add/range' # puts (1..4).to_json # puts (1...4).to_json # puts ('a'..'d').to_json # # Output: # # {"json_class":"Range","a":[1,4,false]} # {"json_class":"Range","a":[1,4,true]} # {"json_class":"Range","a":["a","d",false]} # def to_json(*args) as_json.to_json(*args) end end PK!vv add/core.rbnu[# frozen_string_literal: true # This file requires the implementations of ruby core's custom objects for # serialisation/deserialisation. require 'json/add/date' require 'json/add/date_time' require 'json/add/exception' require 'json/add/range' require 'json/add/regexp' require 'json/add/string' require 'json/add/struct' require 'json/add/symbol' require 'json/add/time' PK!A@ add/ostruct.rbnu[# frozen_string_literal: true unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED require 'json' end begin require 'ostruct' rescue LoadError end class OpenStruct # See #as_json. def self.json_create(object) new(object['t'] || object[:t]) end # Methods OpenStruct#as_json and +OpenStruct.json_create+ may be used # to serialize and deserialize a \OpenStruct object; # see Marshal[rdoc-ref:Marshal]. # # \Method OpenStruct#as_json serializes +self+, # returning a 2-element hash representing +self+: # # require 'json/add/ostruct' # x = OpenStruct.new('name' => 'Rowdy', :age => nil).as_json # # => {"json_class"=>"OpenStruct", "t"=>{:name=>'Rowdy', :age=>nil}} # # \Method +JSON.create+ deserializes such a hash, returning a \OpenStruct object: # # OpenStruct.json_create(x) # # => # # def as_json(*) klass = self.class.name klass.to_s.empty? and raise JSON::JSONError, "Only named structs are supported!" { JSON.create_id => klass, 't' => table, } end # Returns a JSON string representing +self+: # # require 'json/add/ostruct' # puts OpenStruct.new('name' => 'Rowdy', :age => nil).to_json # # Output: # # {"json_class":"OpenStruct","t":{'name':'Rowdy',"age":null}} # def to_json(*args) as_json.to_json(*args) end end if defined?(::OpenStruct) PK!<4f::)__pycache__/encoder.cpython-312.opt-1.pycnu[ ֦i> dZddlZ ddlmZ ddlmZ ddlmZ ejdZ ejdZ ejdZ d d d d d dddZedD])Zej#eedj'e+[edZdZexseZdZexseZGddeZeeeeeeee e!ejDf dZ#y#e$rdZYwxYw#e$rdZYwxYw#e$rdZ YwxYw)zImplementation of JSONEncoder N)encode_basestring_ascii)encode_basestring) make_encoderz[\x00-\x1f\\"\b\f\n\r\t]z([\\"]|[^\ -~])s[-]z\\z\"z\bz\fz\nz\rz\t)\"    \u{0:04x}infc@d}dtj||zdzS)z5Return a JSON representation of a Python string c2t|jdS)Nr) ESCAPE_DCTgroup)matchs %/usr/lib64/python3.12/json/encoder.pyreplacez%py_encode_basestring..replace)s%++a.))r)ESCAPEsubsrs rpy_encode_basestringr%s"* GQ' '# --rc@d}dtj||zdzS)zAReturn an ASCII-only JSON representation of a Python string c|jd} t|S#t$rPt|}|dkrdj |cYS|dz}d|dz dzz}d|dzz}dj ||cYSwxYw) Nriri iiz\u{0:04x}\u{1:04x})rrKeyErrorordformat)rrns1s2s rrz+py_encode_basestring_ascii..replace5s KKN =a=  =AA7{#**1--W R501q5y)-44R<< =s*A5*A54A5r) ESCAPE_ASCIIrrs rpy_encode_basestring_asciir'1s&= !!'1- - 33rc FeZdZdZdZdZddddddddddZd Zd Zd d Z y) JSONEncodera[Extensible JSON encoder for Python data structures. Supports the following objects and types by default: +-------------------+---------------+ | Python | JSON | +===================+===============+ | dict | object | +-------------------+---------------+ | list, tuple | array | +-------------------+---------------+ | str | string | +-------------------+---------------+ | int, float | number | +-------------------+---------------+ | True | true | +-------------------+---------------+ | False | false | +-------------------+---------------+ | None | null | +-------------------+---------------+ To extend this to recognize other objects, subclass and implement a ``.default()`` method with another method that returns a serializable object for ``o`` if possible, otherwise it should call the superclass implementation (to raise ``TypeError``). z, z: FTN)skipkeys ensure_asciicheck_circular allow_nan sort_keysindent separatorsdefaultc||_||_||_||_||_||_||\|_|_n |d|_|||_yy)aConstructor for JSONEncoder, with sensible defaults. If skipkeys is false, then it is a TypeError to attempt encoding of keys that are not str, int, float, bool or None. If skipkeys is True, such items are simply skipped. If ensure_ascii is true, the output is guaranteed to be str objects with all incoming non-ASCII characters escaped. If ensure_ascii is false, the output can contain non-ASCII characters. If check_circular is true, then lists, dicts, and custom encoded objects will be checked for circular references during encoding to prevent an infinite recursion (which would cause an RecursionError). Otherwise, no such check takes place. If allow_nan is true, then NaN, Infinity, and -Infinity will be encoded as such. This behavior is not JSON specification compliant, but is consistent with most JavaScript based encoders and decoders. Otherwise, it will be a ValueError to encode such floats. If sort_keys is true, then the output of dictionaries will be sorted by key; this is useful for regression tests to ensure that JSON serializations can be compared on a day-to-day basis. If indent is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. None is the most compact representation. If specified, separators should be an (item_separator, key_separator) tuple. The default is (', ', ': ') if *indent* is ``None`` and (',', ': ') otherwise. To get the most compact JSON representation, you should specify (',', ':') to eliminate whitespace. If specified, default is a function that gets called for objects that can't otherwise be serialized. It should return a JSON encodable version of the object or raise a ``TypeError``. N,) r*r+r,r-r.r/item_separator key_separatorr1) selfr*r+r,r-r.r/r0r1s r__init__zJSONEncoder.__init__isgV! (,""  !6@ 3D !3  "%D   "DL rcHtd|jjd)abImplement this method in a subclass such that it returns a serializable object for ``o``, or calls the base implementation (to raise a ``TypeError``). For example, to support arbitrary iterators, you could implement default like this:: def default(self, o): try: iterable = iter(o) except TypeError: pass else: return list(iterable) # Let the base class default method raise the TypeError return super().default(o) zObject of type z is not JSON serializable) TypeError __class____name__)r6os rr1zJSONEncoder.defaults-&/!++*>*>)?@345 5rct|tr"|jr t|St |S|j |d}t|t tfs t |}dj|S)zReturn a JSON string representation of a Python data structure. >>> from json.encoder import JSONEncoder >>> JSONEncoder().encode({"foo": ["bar", "baz"]}) '{"foo": ["bar", "baz"]}' T) _one_shot) isinstancestrr+rr iterencodelisttuplejoin)r6r<chunkss rencodezJSONEncoder.encodesf a   .q11(++d3&4-0&\Fwwvrc 6|jri}nd}|jrt}nt}|jt j tt fd}|rltf|jZt||j||j|j|j|j|j|j }nPt||j||j||j|j|j|j| }||dS)zEncode the given object and yield each string representation as available. For example:: for chunk in JSONEncoder().iterencode(bigobject): mysocket.write(chunk) Ncx||k7rd}n||k(rd}n||k(rd}n||S|stdt|z|S)NNaNInfinityz -Infinityz2Out of range float values are not JSON compliant: ) ValueErrorrepr)r<r-_repr_inf_neginftexts rfloatstrz(JSONEncoder.iterencode..floatstrsW Avd!g"Qx HGKrr)r,r+rrr-float__repr__INFINITYc_make_encoderr/r1r5r4r.r*_make_iterencode)r6r<r>markers_encoderrR _iterencodes rrBzJSONEncoder.iterencodes   GG   .H(H"&..nn8hY . .4KK'(x""D$7$7 t~~/K +xh""D$7$7 y*K1a  r)F) r; __module__ __qualname____doc__r4r5r7r1rGrBrrr)r)Js;8NM#(t45D$6#p5,,5!rr)c sdz  fd  fd  fdS)N c38K|sdy|}|vr d||<d} |dz }d |zz}|z}||z }nd}}d}|D]}|rd}n|}|r| |z!||dz+|dur|d z7|dur|d zC|r| |zZ|r| |zq||fr ||}n|r ||}n ||}|Ed{||dz}d |zzd =yy7"w) Nz[]Circular reference detected[r TFnulltruefalse]r^)lst_current_indent_levelmarkeridbufnewline_indent separatorfirstvaluerFrLrY _floatstr_indent_intstr_item_separatorrZ_iterencode_dict_iterencode_listdictrSidintr@rCrXrArDs rrvz*_make_iterencode.._iterencode_listsJ   #wH7" !>?? #GH    !Q & !!G.C$CCN'.8I > !C!N'IE%%HUO++Fl"$Fl"%Gm#E3'GEN**E5)Ie,,, edE]3-e5JKFt,-e5JKF(0EFF!!!;<  % !Q & !#888 8  !  "sC2D5D6#Dc3\K|sdy|}|vr d||<d |dz }d |zz}|z}|nd}}d}rt|j}n|j}|D]\}}|rn\|r  |}nJ|durd}nC|durd }n<|d }n7|r |}n%rKtd |jj|rd}n| ||r  ||d |durd|durd |r ||r  ||fr ||} n|r ||} n ||} | Ed{||dz}d |zzd =yy7#w) Nz{}rb{rdr TrfFrgrez0keys must be str, int, float, bool or None, not })sorteditemsr9r:r;)dctrjrkrmr4ror~keyrprFrLrYrqrrrsrtrZrurv_key_separator _skipkeys _sort_keysrwrSrxryr@rCrXrArDs rruz*_make_iterencode.._iterencode_dictNs?J   #wH7" !>?? #GH    !Q & !!G.C$CCN,~=N !N,N 399;'EIIKEJC#s#C'nC%cl#''*}}'='=&>!@AA$$3-  %%uo% $ % E3'en$E5)&&edE]3-e5JKFt,-e5JKF(0EFF!!!c d  % !Q & !#888 8  !  "sFF,F*$F,c3K|r |y|dy|durdy|durdy|r |y| r |y|fr ||Ed{y| r ||Ed{y |}|vrd||<|}||Ed{=yy7[7B7w)NreTrfFrgrbr^)r<rjrkrL_defaultrYrqrsrZrurvrwrSrxryr@rCrXrArDs rrZz%_make_iterencode.._iterencodes  a 1+  YL $YL %ZM 3 !*  5 !A,  D%= )'+@A A A 4 '+@A A A"a5w&$%BCC$%! A"1&;< < <"H%# B A =s6A-C0C 1C C 4CC CCCr^)rXrrYrrrqrrtrrr>rLrwrSrxryr@rCrArDrsrZrurvs````````` ``````````@@@rrWrWs_:gs#;-6"6"6"pN"N"N"N"`&&&: r)$r]re_jsonrc_encode_basestring_ascii ImportErrorrc_encode_basestringrrVcompilerr&HAS_UTF8rrangei setdefaultchrr"rSrUrr'objectr)rLrwrxryr@rCrArDrTrWr^rrrsV %J>4 / 0rzz,- 2::n %         tA#a&,"5"5a"89  <.)@,@4.;!;x!&x!z     w{% $%Ns3CCC)CCC&%C&)C32C3PK!@ )__pycache__/scanner.cpython-312.opt-2.pycnu[ ֦i  ddlZ ddlmZdgZej dejejzejzZ dZ exse Zy#e$rdZYMwxYw)N) make_scannerrz2(-?(?:0|[1-9][0-9]*))(\.[0-9]+)?([eE][-+]?[0-9]+)?c Z |j |j|j tj|j |j |j |j|j|j|j f dfd}|S)Nc ||}|dk(r ||dzS|dk(r||dzf S|dk(r ||dzfS|dk(r|||dzdk(rd|dzfS|dk(r|||dzd k(rd |dzfS|d k(r|||d zd k(rd|d zfS ||}|I|j\}}}|s|r||xsdz|xsdz}n|}||jfS|dk(r|||dzdk(r d|dzfS|dk(r|||dzdk(r d|dzfS|dk(r|||dzdk(r d|dzfSt|#t$r t|dwxYw)N"{[nnullttrueTffalseFNNaNIInfinity- z -Infinity) IndexError StopIterationgroupsend)stringidxnextcharmintegerfracexpres _scan_once match_numbermemo object_hookobject_pairs_hook parse_arrayparse_constant parse_float parse_int parse_object parse_stringstricts %/usr/lib64/python3.12/json/scanner.pyr'z#py_make_scanner.._scan_onces /c{H s?a8 8 _q 16K):DB B _a0*= = _C!G!4!>q= _C!G!4!>q= _C!G!4!?#'> !  % =!" GT3s!'TZR"8CI2"FG(<  _C!G!4!=!%(#'1 1 _C!G!4 !B!*-sQw6 6 _C!G!4 !C!+.a7 7$ $A /$$ . /s D??Ecb ||jS#jwxYw)N)clear)rr r'r)s r3 scan_oncez"py_make_scanner..scan_onceAs% fc* JJLDJJLs.) r0r,r1 NUMBER_REmatchr2r.r/r-r*r+r))contextr6r'r(r)r*r+r,r-r.r/r0r1r2s @@@@@@@@@@@@r3py_make_scannerr:s''L%%K''L??L ^^F%%K!!I++N%%K11 <rFst 4   BJJ9ZZ",,* - 8t0 GNsAAAPK!>I=&&)__pycache__/decoder.cpython-312.opt-2.pycnu[ ֦i0  ddlZddlmZ ddlmZddgZejejzejzZ e dZ e dZe dZGd deZeee d Zej&d e Zej&d e Zd ddddddddZej.fdZdeej.fdZexseZej&de ZdZdej.efdZej.efdZGddeZy#e$rdZYwxYw)N)scanner) scanstring JSONDecoderJSONDecodeErrornaninfz-infceZdZ dZdZy)rc|jdd|dz}||jdd|z }d||||fz}tj||||_||_||_||_||_y)N rz%s: line %d column %d (char %d)) countrfind ValueError__init__msgdocposlinenocolno)selfrrrrrerrmsgs %/usr/lib64/python3.12/json/decoder.pyrzJSONDecodeError.__init__sv4C(1,ciia--2c65#5NND&)  c`|j|j|j|jffSN) __class__rrr)rs r __reduce__zJSONDecodeError.__reduce__*s$~~$((DHH===rN)__name__ __module__ __qualname__rrrrrrs >r)z -InfinityInfinityNaNz[0-9A-Fa-f]{4}z(.*?)(["\\\x00-\x1f])"\/ r   )r$r%r&bfnrtc|||dz}| t|jdSd}t|||#t$rYwxYw)Nr zInvalid \uXXXX escape)intgrouprr)sr_mescrs r _decode_uXXXXr7<sX Qa.C  syy{B' ' #C #q# &&   s9 AATc g}|j}|dz } |||}| td|||j}|j\} } | r|| | dk(rn| dk7r)|rdj | } t| |||| z ||} | dk7r || } |dz }nht||}|dz }d |cxkrd krAnn>|||d zd k(r3t||dz}d |cxkrdkrnnd|d z dz|d z zz}|dz }t|} || dj||fS#t $rtd||dwxYw#t $rdj | } t| ||wxYw)Nr zUnterminated string starting atr$r%z"Invalid control character {0!r} atuzInvalid \escape: {0!r}iiz\uiii ) appendrendgroupsformat IndexErrorKeyErrorr7chrjoin)r4r@strict_br5chunks_appendbeginchunkcontent terminatorrr6charuniuni2s r py_scanstringrRFsFmmG !GE 1c  =!"CQN Niik#lln  G     4 :AA*M%c1c22 # 6C&C #: 3#w 1HC3'C 1HC&&1Sq>U+B$Qa0T+V+!sV|&:tf}%MNC1HCs8D W X 776?C + 6!"C"#U,15 6 6 3/66s;%c1c22 3sD+E+E(E.z [ \t\n\r]*z cL|\}} g} | j} |i}|j} || | dz} | dk7r^| |vr||| j} || | dz} | dk(r$||| }|| dzfSi} ||| } | | dzfS| dk7r td|| | dz } t || |\}} | ||}|| | dzdk7r/||| j} || | dzdk7r td|| | dz } || |vr&| dz } || |vr||| dzj} ||| \}} | ||f || } | |vr||| dzj} || } | dz } | dk(rnP| d k7rtd || dz ||| j} || | dz} | dz } | dk7rtd|| dz !| || }|| fSt| } ||| } | | fS#t $rYwxYw#t $r}td||jdd}~wwxYw#t $rd} YwxYw) Nr r$}z1Expecting property name enclosed in double quotes:zExpecting ':' delimiterExpecting valuer>,Expecting ',' delimiter) r? setdefaultr@rrrC StopIterationvaluedict) s_and_endrG scan_once object_hookobject_pairs_hookmemo_w_wsr4r@pairs pairs_appendmemo_getnextcharresultkeyr[errs r JSONObjectrks FAs E< ! _!CQM M1HC af-SsC  Sq>S Q*.."CS1W~$%&?CHH q v}qS6S=Qa.,,.C M"1c*JE3 c5\" vH3C!Gn((*S6 q s?  _!";QaH HCjnnSq> q s?!CQaQ QS V$"5)s{ KEE" #:C     M!"3Q B L M H s<.-G G,3(H G)(G), H5H  H H#"H#c:|\}}g}|||dz}||vr"|||dzj}|||dz}|dk(r||dzfS|j} |||\} }|| |||dz}||vr"|||dzj}|||dz}|dz }|dk(r ||fS|dk7rtd||dz  |||vr&|dz }|||vr|||dzj}#t$r} td|| jdd} ~ wwxYw#t $rY5wxYw)Nr ]rVrWrX)r@r?rZrr[rC) r]r^rbrcr4r@valuesrgrJr[rjs r JSONArrayros FAs FS1W~H3C!Gn  "Sq>3sQwmmG  M"1c*JE3 Sq> s?Qa.$$&CS1W~H q s?  3;_!";QaH H v}qS6S=Qa.,,.C'  M!"3Q B L M"   s* C%7-D% D .DD  DDcJeZdZ ddddddddZej fdZddZy)rNT)r_ parse_float parse_intparse_constantrGr`c" ||_|xst|_|xst|_|xst j |_||_||_ t|_ t|_ t|_i|_t#j$||_yr)r_floatrqr2rr _CONSTANTS __getitem__rsrGr`rk parse_objectro parse_arrayr parse_stringrar make_scannerr^)rr_rqrrrsrGr`s rrzJSONDecoder.__init__s~ @'&/%")c,F 0F0F !2&$&  --d3rc |j|||dj\}}|||j}|t|k7r td|||S)Nr)idxz Extra data) raw_decoder@lenr)rr4rbobjr@s rdecodezJSONDecoder.decodeMs\ ??1"Q(,,.?9SCjnn #a&=!,37 7 rc |j||\}}||fS#t$r}td||jdd}~wwxYw)NrV)r^rZrr[)rr4r}rr@rjs rr~zJSONDecoder.raw_decodeXsV  M~~a-HCCx M!"3Q B L Ms A=A)r)rrr r WHITESPACEmatchrr~r!rrrrs3:'+4"-4`&++  r) rejsonr_jsonr c_scanstring ImportError__all__VERBOSE MULTILINEDOTALLFLAGSrur#PosInfNegInfrrrvcompile HEXDIGITS STRINGCHUNK BACKSLASHrr7rRrWHITESPACE_STRrkroobjectrr!rrrsO 0 + , R\\!BII- El u v>j>6   BJJ(% 0 bjj159 Ds Dt$T  '__'"& **9 z *] RZZ u - Z-->Ob(2'7'7^"Jf&foLsC??D D PK!Q툈  #__pycache__/scanner.cpython-312.pycnu[ ֦i dZddlZ ddlmZdgZejdejejzejzZ dZ exse Zy#e$rdZYMwxYw)zJSON token scanner N) make_scannerrz2(-?(?:0|[1-9][0-9]*))(\.[0-9]+)?([eE][-+]?[0-9]+)?c Z |j |j|j tj|j |j |j |j|j|j|j f dfd}|S)Nc ||}|dk(r ||dzS|dk(r||dzf S|dk(r ||dzfS|dk(r|||dzdk(rd|dzfS|dk(r|||dzd k(rd |dzfS|d k(r|||d zd k(rd|d zfS ||}|I|j\}}}|s|r||xsdz|xsdz}n|}||jfS|dk(r|||dzdk(r d|dzfS|dk(r|||dzdk(r d|dzfS|dk(r|||dzdk(r d|dzfSt|#t$r t|dwxYw)N"{[nnullttrueTffalseFNNaNIInfinity- z -Infinity) IndexError StopIterationgroupsend)stringidxnextcharmintegerfracexpres _scan_once match_numbermemo object_hookobject_pairs_hook parse_arrayparse_constant parse_float parse_int parse_object parse_stringstricts %/usr/lib64/python3.12/json/scanner.pyr'z#py_make_scanner.._scan_onces /c{H s?a8 8 _q 16K):DB B _a0*= = _C!G!4!>q= _C!G!4!>q= _C!G!4!?#'> !  % =!" GT3s!'TZR"8CI2"FG(<  _C!G!4!=!%(#'1 1 _C!G!4 !B!*-sQw6 6 _C!G!4 !C!+.a7 7$ $A /$$ . /s D??Ecb ||jS#jwxYw)N)clear)rr r'r)s r3 scan_oncez"py_make_scanner..scan_onceAs% fc* JJLDJJLs.) r0r,r1 NUMBER_REmatchr2r.r/r-r*r+r))contextr6r'r(r)r*r+r,r-r.r/r0r1r2s @@@@@@@@@@@@r3py_make_scannerr:s''L%%K''L??L ^^F%%K!!I++N%%K11 <rGst 4   BJJ9ZZ",,* - 8t0 GNsAAAPK!<4f::#__pycache__/encoder.cpython-312.pycnu[ ֦i> dZddlZ ddlmZ ddlmZ ddlmZ ejdZ ejdZ ejdZ d d d d d dddZedD])Zej#eedj'e+[edZdZexseZdZexseZGddeZeeeeeeee e!ejDf dZ#y#e$rdZYwxYw#e$rdZYwxYw#e$rdZ YwxYw)zImplementation of JSONEncoder N)encode_basestring_ascii)encode_basestring) make_encoderz[\x00-\x1f\\"\b\f\n\r\t]z([\\"]|[^\ -~])s[-]z\\z\"z\bz\fz\nz\rz\t)\"    \u{0:04x}infc@d}dtj||zdzS)z5Return a JSON representation of a Python string c2t|jdS)Nr) ESCAPE_DCTgroup)matchs %/usr/lib64/python3.12/json/encoder.pyreplacez%py_encode_basestring..replace)s%++a.))r)ESCAPEsubsrs rpy_encode_basestringr%s"* GQ' '# --rc@d}dtj||zdzS)zAReturn an ASCII-only JSON representation of a Python string c|jd} t|S#t$rPt|}|dkrdj |cYS|dz}d|dz dzz}d|dzz}dj ||cYSwxYw) Nriri iiz\u{0:04x}\u{1:04x})rrKeyErrorordformat)rrns1s2s rrz+py_encode_basestring_ascii..replace5s KKN =a=  =AA7{#**1--W R501q5y)-44R<< =s*A5*A54A5r) ESCAPE_ASCIIrrs rpy_encode_basestring_asciir'1s&= !!'1- - 33rc FeZdZdZdZdZddddddddddZd Zd Zd d Z y) JSONEncodera[Extensible JSON encoder for Python data structures. Supports the following objects and types by default: +-------------------+---------------+ | Python | JSON | +===================+===============+ | dict | object | +-------------------+---------------+ | list, tuple | array | +-------------------+---------------+ | str | string | +-------------------+---------------+ | int, float | number | +-------------------+---------------+ | True | true | +-------------------+---------------+ | False | false | +-------------------+---------------+ | None | null | +-------------------+---------------+ To extend this to recognize other objects, subclass and implement a ``.default()`` method with another method that returns a serializable object for ``o`` if possible, otherwise it should call the superclass implementation (to raise ``TypeError``). z, z: FTN)skipkeys ensure_asciicheck_circular allow_nan sort_keysindent separatorsdefaultc||_||_||_||_||_||_||\|_|_n |d|_|||_yy)aConstructor for JSONEncoder, with sensible defaults. If skipkeys is false, then it is a TypeError to attempt encoding of keys that are not str, int, float, bool or None. If skipkeys is True, such items are simply skipped. If ensure_ascii is true, the output is guaranteed to be str objects with all incoming non-ASCII characters escaped. If ensure_ascii is false, the output can contain non-ASCII characters. If check_circular is true, then lists, dicts, and custom encoded objects will be checked for circular references during encoding to prevent an infinite recursion (which would cause an RecursionError). Otherwise, no such check takes place. If allow_nan is true, then NaN, Infinity, and -Infinity will be encoded as such. This behavior is not JSON specification compliant, but is consistent with most JavaScript based encoders and decoders. Otherwise, it will be a ValueError to encode such floats. If sort_keys is true, then the output of dictionaries will be sorted by key; this is useful for regression tests to ensure that JSON serializations can be compared on a day-to-day basis. If indent is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. None is the most compact representation. If specified, separators should be an (item_separator, key_separator) tuple. The default is (', ', ': ') if *indent* is ``None`` and (',', ': ') otherwise. To get the most compact JSON representation, you should specify (',', ':') to eliminate whitespace. If specified, default is a function that gets called for objects that can't otherwise be serialized. It should return a JSON encodable version of the object or raise a ``TypeError``. N,) r*r+r,r-r.r/item_separator key_separatorr1) selfr*r+r,r-r.r/r0r1s r__init__zJSONEncoder.__init__isgV! (,""  !6@ 3D !3  "%D   "DL rcHtd|jjd)abImplement this method in a subclass such that it returns a serializable object for ``o``, or calls the base implementation (to raise a ``TypeError``). For example, to support arbitrary iterators, you could implement default like this:: def default(self, o): try: iterable = iter(o) except TypeError: pass else: return list(iterable) # Let the base class default method raise the TypeError return super().default(o) zObject of type z is not JSON serializable) TypeError __class____name__)r6os rr1zJSONEncoder.defaults-&/!++*>*>)?@345 5rct|tr"|jr t|St |S|j |d}t|t tfs t |}dj|S)zReturn a JSON string representation of a Python data structure. >>> from json.encoder import JSONEncoder >>> JSONEncoder().encode({"foo": ["bar", "baz"]}) '{"foo": ["bar", "baz"]}' T) _one_shot) isinstancestrr+rr iterencodelisttuplejoin)r6r<chunkss rencodezJSONEncoder.encodesf a   .q11(++d3&4-0&\Fwwvrc 6|jri}nd}|jrt}nt}|jt j tt fd}|rltf|jZt||j||j|j|j|j|j|j }nPt||j||j||j|j|j|j| }||dS)zEncode the given object and yield each string representation as available. For example:: for chunk in JSONEncoder().iterencode(bigobject): mysocket.write(chunk) Ncx||k7rd}n||k(rd}n||k(rd}n||S|stdt|z|S)NNaNInfinityz -Infinityz2Out of range float values are not JSON compliant: ) ValueErrorrepr)r<r-_repr_inf_neginftexts rfloatstrz(JSONEncoder.iterencode..floatstrsW Avd!g"Qx HGKrr)r,r+rrr-float__repr__INFINITYc_make_encoderr/r1r5r4r.r*_make_iterencode)r6r<r>markers_encoderrR _iterencodes rrBzJSONEncoder.iterencodes   GG   .H(H"&..nn8hY . .4KK'(x""D$7$7 t~~/K +xh""D$7$7 y*K1a  r)F) r; __module__ __qualname____doc__r4r5r7r1rGrBrrr)r)Js;8NM#(t45D$6#p5,,5!rr)c sdz  fd  fd  fdS)N c38K|sdy|}|vr d||<d} |dz }d |zz}|z}||z }nd}}d}|D]}|rd}n|}|r| |z!||dz+|dur|d z7|dur|d zC|r| |zZ|r| |zq||fr ||}n|r ||}n ||}|Ed{||dz}d |zzd =yy7"w) Nz[]Circular reference detected[r TFnulltruefalse]r^)lst_current_indent_levelmarkeridbufnewline_indent separatorfirstvaluerFrLrY _floatstr_indent_intstr_item_separatorrZ_iterencode_dict_iterencode_listdictrSidintr@rCrXrArDs rrvz*_make_iterencode.._iterencode_listsJ   #wH7" !>?? #GH    !Q & !!G.C$CCN'.8I > !C!N'IE%%HUO++Fl"$Fl"%Gm#E3'GEN**E5)Ie,,, edE]3-e5JKFt,-e5JKF(0EFF!!!;<  % !Q & !#888 8  !  "sC2D5D6#Dc3\K|sdy|}|vr d||<d |dz }d |zz}|z}|nd}}d}rt|j}n|j}|D]\}}|rn\|r  |}nJ|durd}nC|durd }n<|d }n7|r |}n%rKtd |jj|rd}n| ||r  ||d |durd|durd |r ||r  ||fr ||} n|r ||} n ||} | Ed{||dz}d |zzd =yy7#w) Nz{}rb{rdr TrfFrgrez0keys must be str, int, float, bool or None, not })sorteditemsr9r:r;)dctrjrkrmr4ror~keyrprFrLrYrqrrrsrtrZrurv_key_separator _skipkeys _sort_keysrwrSrxryr@rCrXrArDs rruz*_make_iterencode.._iterencode_dictNs?J   #wH7" !>?? #GH    !Q & !!G.C$CCN,~=N !N,N 399;'EIIKEJC#s#C'nC%cl#''*}}'='=&>!@AA$$3-  %%uo% $ % E3'en$E5)&&edE]3-e5JKFt,-e5JKF(0EFF!!!c d  % !Q & !#888 8  !  "sFF,F*$F,c3K|r |y|dy|durdy|durdy|r |y| r |y|fr ||Ed{y| r ||Ed{y |}|vrd||<|}||Ed{=yy7[7B7w)NreTrfFrgrbr^)r<rjrkrL_defaultrYrqrsrZrurvrwrSrxryr@rCrXrArDs rrZz%_make_iterencode.._iterencodes  a 1+  YL $YL %ZM 3 !*  5 !A,  D%= )'+@A A A 4 '+@A A A"a5w&$%BCC$%! A"1&;< < <"H%# B A =s6A-C0C 1C C 4CC CCCr^)rXrrYrrrqrrtrrr>rLrwrSrxryr@rCrArDrsrZrurvs````````` ``````````@@@rrWrWs_:gs#;-6"6"6"pN"N"N"N"`&&&: r)$r]re_jsonrc_encode_basestring_ascii ImportErrorrc_encode_basestringrrVcompilerr&HAS_UTF8rrangei setdefaultchrr"rSrUrr'objectr)rLrwrxryr@rCrArDrTrWr^rrrsV %J>4 / 0rzz,- 2::n %         tA#a&,"5"5a"89  <.)@,@4.;!;x!&x!z     w{% $%Ns3CCC)CCC&%C&)C32C3PK!g;V)*)*)__pycache__/encoder.cpython-312.opt-2.pycnu[ ֦i>  ddlZ ddlmZ ddlmZ ddlmZejdZ ejdZ ejdZ dd d d d d ddZ edD])Ze j!eedj%e+[edZdZexseZdZexseZGddeZeeeeeeeee ejBf dZ"y#e$rdZYwxYw#e$rdZYwxYw#e$rdZYwxYw)N)encode_basestring_ascii)encode_basestring) make_encoderz[\x00-\x1f\\"\b\f\n\r\t]z([\\"]|[^\ -~])s[-]z\\z\"z\bz\fz\nz\rz\t)\"    \u{0:04x}infcB d}dtj||zdzS)Nc2t|jdS)Nr) ESCAPE_DCTgroup)matchs %/usr/lib64/python3.12/json/encoder.pyreplacez%py_encode_basestring..replace)s%++a.))r)ESCAPEsubsrs rpy_encode_basestringr%s'* GQ' '# --rcB d}dtj||zdzS)Nc|jd} t|S#t$rPt|}|dkrdj |cYS|dz}d|dz dzz}d|dzz}dj ||cYSwxYw) Nriri iiz\u{0:04x}\u{1:04x})rrKeyErrorordformat)rrns1s2s rrz+py_encode_basestring_ascii..replace5s KKN =a=  =AA7{#**1--W R501q5y)-44R<< =s*A5*A54A5r) ESCAPE_ASCIIrrs rpy_encode_basestring_asciir'1s+= !!'1- - 33rc DeZdZ dZdZddddddddddZdZd Zd d Zy) JSONEncoderz, z: FTN)skipkeys ensure_asciicheck_circular allow_nan sort_keysindent separatorsdefaultc ||_||_||_||_||_||_||\|_|_n |d|_|||_yy)N,) r*r+r,r-r.r/item_separator key_separatorr1) selfr*r+r,r-r.r/r0r1s r__init__zJSONEncoder.__init__isl& P! (,""  !6@ 3D !3  "%D   "DL rcJ td|jjd)NzObject of type z is not JSON serializable) TypeError __class____name__)r6os rr1zJSONEncoder.defaults2 $/!++*>*>)?@345 5rc t|tr"|jr t|St |S|j |d}t|t tfs t |}dj|S)NT) _one_shot) isinstancestrr+rr iterencodelisttuplejoin)r6r<chunkss rencodezJSONEncoder.encodesk  a   .q11(++d3&4-0&\Fwwvrc 8 |jri}nd}|jrt}nt}|jt j tt fd}|rltf|jZt||j||j|j|j|j|j|j }nPt||j||j||j|j|j|j| }||dS)Ncx||k7rd}n||k(rd}n||k(rd}n||S|stdt|z|S)NNaNInfinityz -Infinityz2Out of range float values are not JSON compliant: ) ValueErrorrepr)r<r-_repr_inf_neginftexts rfloatstrz(JSONEncoder.iterencode..floatstrsW Avd!g"Qx HGKrr)r,r+rrr-float__repr__INFINITYc_make_encoderr/r1r5r4r.r*_make_iterencode)r6r<r>markers_encoderrR _iterencodes rrBzJSONEncoder.iterencodes    GG   .H(H"&..nn8hY . .4KK'(x""D$7$7 t~~/K +xh""D$7$7 y*K1a  r)F) r; __module__ __qualname__r4r5r7r1rGrBrrr)r)Js;8NM#(t45D$6#p5,,5!rr)c sdz  fd  fd  fdS)N c38K|sdy|}|vr d||<d} |dz }d |zz}|z}||z }nd}}d}|D]}|rd}n|}|r| |z!||dz+|dur|d z7|dur|d zC|r| |zZ|r| |zq||fr ||}n|r ||}n ||}|Ed{||dz}d |zzd =yy7"w) Nz[]Circular reference detected[r TFnulltruefalse]r])lst_current_indent_levelmarkeridbufnewline_indent separatorfirstvaluerFrLrY _floatstr_indent_intstr_item_separatorrZ_iterencode_dict_iterencode_listdictrSidintr@rCrXrArDs rruz*_make_iterencode.._iterencode_listsJ   #wH7" !>?? #GH    !Q & !!G.C$CCN'.8I > !C!N'IE%%HUO++Fl"$Fl"%Gm#E3'GEN**E5)Ie,,, edE]3-e5JKFt,-e5JKF(0EFF!!!;<  % !Q & !#888 8  !  "sC2D5D6#Dc3\K|sdy|}|vr d||<d |dz }d |zz}|z}|nd}}d}rt|j}n|j}|D]\}}|rn\|r  |}nJ|durd}nC|durd }n<|d }n7|r |}n%rKtd |jj|rd}n| ||r  ||d |durd|durd |r ||r  ||fr ||} n|r ||} n ||} | Ed{||dz}d |zzd =yy7#w) Nz{}ra{rcr TreFrfrdz0keys must be str, int, float, bool or None, not })sorteditemsr9r:r;)dctrirjrlr4rnr}keyrorFrLrYrprqrrrsrZrtru_key_separator _skipkeys _sort_keysrvrSrwrxr@rCrXrArDs rrtz*_make_iterencode.._iterencode_dictNs?J   #wH7" !>?? #GH    !Q & !!G.C$CCN,~=N !N,N 399;'EIIKEJC#s#C'nC%cl#''*}}'='=&>!@AA$$3-  %%uo% $ % E3'en$E5)&&edE]3-e5JKFt,-e5JKF(0EFF!!!c d  % !Q & !#888 8  !  "sFF,F*$F,c3K|r |y|dy|durdy|durdy|r |y| r |y|fr ||Ed{y| r ||Ed{y |}|vrd||<|}||Ed{=yy7[7B7w)NrdTreFrfrar])r<rirjrL_defaultrYrprrrZrtrurvrSrwrxr@rCrXrArDs rrZz%_make_iterencode.._iterencodes  a 1+  YL $YL %ZM 3 !*  5 !A,  D%= )'+@A A A 4 '+@A A A"a5w&$%BCC$%! A"1&;< < <"H%# B A =s6A-C0C 1C C 4CC CCCr])rXrrYrqrprrsrrr>rLrvrSrwrxr@rCrArDrrrZrtrus````````` ``````````@@@rrWrWs_:gs#;-6"6"6"pN"N"N"N"`&&&: r)#re_jsonrc_encode_basestring_ascii ImportErrorrc_encode_basestringrrVcompilerr&HAS_UTF8rrangei setdefaultchrr"rSrUrr'objectr)rLrvrwrxr@rCrArDrTrWr]rrrsV %J>4 / 0rzz,- 2::n %         tA#a&,"5"5a"89  <.)@,@4.;!;x!&x!z     w{% $%Ns3CCC(CCC%$C%(C21C2PK!t&__pycache__/tool.cpython-312.opt-2.pycnu[ ֦i  ddlZddlZddlZddlmZdZedk(r eyy#e$r&ZejejYdZ[ydZ[wwxYw)N)Pathcd}d}tj||}|jddtjddtj |jd dt d d |jd d dd|jdddd|jdd dd|j}|jddtd|jddddd !|jd"dddd#!|jd$d d%&|j}|j|j|jd'}|jr d|d<d(|d)<|j5} |jr d*|D}nt!j"|f}|j$tj&}n|j$j)d+d}|5} |D]*} t!j*| | fi|| j-d,, ddddddy#1swYxYw#t.$r} t1| d} ~ wwxYw#1swYyxYw)-Nzpython -m json.toolzZA simple command line interface for json module to validate and pretty-print JSON objects.)prog descriptioninfile?zutf-8)encodingz-a JSON file to be validated or pretty-printed)nargstypehelpdefaultoutfilez%write the output of infile to outfilez --sort-keys store_trueFz5sort the output of dictionaries alphabetically by key)actionr r z--no-ensure-ascii ensure_ascii store_falsez(disable escaping of non-ASCII characters)destrr z --json-linesznparse input using the JSON Lines format. Use with --no-indent or --compact to produce valid JSON Lines output.z--indentzJseparate items with newlines and use this number of spaces for indentation)r r r z--tab store_constindent z9separate items with newlines and use tabs for indentation)rrconstr z --no-indentz/separate items with spaces rather than newlinesz --compactz1suppress all whitespace separation (most compact))rr ) sort_keysrr),: separatorsc3FK|]}tj|yw)N)jsonloads).0lines "/usr/lib64/python3.12/json/tool.py zmain..AsrJs^  ; | z  s&AA  APK!]1515$__pycache__/__init__.cpython-312.pycnu[ ֦i6 dZdZgdZdZddlmZmZddlmZddl Z ed d d d ddd Z d d d d ddddd d d Z d d d d ddddd d dZ eddZ dZddddddddZddddddddZy)a JSON (JavaScript Object Notation) is a subset of JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data interchange format. :mod:`json` exposes an API familiar to users of the standard library :mod:`marshal` and :mod:`pickle` modules. It is derived from a version of the externally maintained simplejson library. Encoding basic Python object hierarchies:: >>> import json >>> json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}]) '["foo", {"bar": ["baz", null, 1.0, 2]}]' >>> print(json.dumps("\"foo\bar")) "\"foo\bar" >>> print(json.dumps('\u1234')) "\u1234" >>> print(json.dumps('\\')) "\\" >>> print(json.dumps({"c": 0, "b": 0, "a": 0}, sort_keys=True)) {"a": 0, "b": 0, "c": 0} >>> from io import StringIO >>> io = StringIO() >>> json.dump(['streaming API'], io) >>> io.getvalue() '["streaming API"]' Compact encoding:: >>> import json >>> mydict = {'4': 5, '6': 7} >>> json.dumps([1,2,3,mydict], separators=(',', ':')) '[1,2,3,{"4":5,"6":7}]' Pretty printing:: >>> import json >>> print(json.dumps({'4': 5, '6': 7}, sort_keys=True, indent=4)) { "4": 5, "6": 7 } Decoding JSON:: >>> import json >>> obj = ['foo', {'bar': ['baz', None, 1.0, 2]}] >>> json.loads('["foo", {"bar":["baz", null, 1.0, 2]}]') == obj True >>> json.loads('"\\"foo\\bar"') == '"foo\x08ar' True >>> from io import StringIO >>> io = StringIO('["streaming API"]') >>> json.load(io)[0] == 'streaming API' True Specializing JSON object decoding:: >>> import json >>> def as_complex(dct): ... if '__complex__' in dct: ... return complex(dct['real'], dct['imag']) ... return dct ... >>> json.loads('{"__complex__": true, "real": 1, "imag": 2}', ... object_hook=as_complex) (1+2j) >>> from decimal import Decimal >>> json.loads('1.1', parse_float=Decimal) == Decimal('1.1') True Specializing JSON object encoding:: >>> import json >>> def encode_complex(obj): ... if isinstance(obj, complex): ... return [obj.real, obj.imag] ... raise TypeError(f'Object of type {obj.__class__.__name__} ' ... f'is not JSON serializable') ... >>> json.dumps(2 + 1j, default=encode_complex) '[2.0, 1.0]' >>> json.JSONEncoder(default=encode_complex).encode(2 + 1j) '[2.0, 1.0]' >>> ''.join(json.JSONEncoder(default=encode_complex).iterencode(2 + 1j)) '[2.0, 1.0]' Using json.tool from the shell to validate and pretty-print:: $ echo '{"json":"obj"}' | python -m json.tool { "json": "obj" } $ echo '{ 1.2:3.4}' | python -m json.tool Expecting property name enclosed in double quotes: line 1 column 3 (char 2) z2.0.9)dumpdumpsloadloads JSONDecoderJSONDecodeError JSONEncoderzBob Ippolito )rr)rNFT)skipkeys ensure_asciicheck_circular allow_nanindent separatorsdefault) r r r rclsrrr sort_keysc |s(|r&|r$|r"| ||| | s| stj|} n(|t}|d||||||| | d| j|} | D]} |j| y)aSerialize ``obj`` as a JSON formatted stream to ``fp`` (a ``.write()``-supporting file-like object). If ``skipkeys`` is true then ``dict`` keys that are not basic types (``str``, ``int``, ``float``, ``bool``, ``None``) will be skipped instead of raising a ``TypeError``. If ``ensure_ascii`` is false, then the strings written to ``fp`` can contain non-ASCII characters if they appear in strings contained in ``obj``. Otherwise, all such characters are escaped in JSON strings. If ``check_circular`` is false, then the circular reference check for container types will be skipped and a circular reference will result in an ``RecursionError`` (or worse). If ``allow_nan`` is false, then it will be a ``ValueError`` to serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). If ``indent`` is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. ``None`` is the most compact representation. If specified, ``separators`` should be an ``(item_separator, key_separator)`` tuple. The default is ``(', ', ': ')`` if *indent* is ``None`` and ``(',', ': ')`` otherwise. To get the most compact JSON representation, you should specify ``(',', ':')`` to eliminate whitespace. ``default(obj)`` is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError. If *sort_keys* is true (default: ``False``), then the output of dictionaries will be sorted by key. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the ``.default()`` method to serialize additional types), specify it with the ``cls`` kwarg; otherwise ``JSONEncoder`` is used. Nr r r rrrrr)_default_encoder iterencoderwrite)objfpr r r rrrrrrkwiterablechunks &/usr/lib64/python3.12/json/__init__.pyrrxsZ 9 :+= "#..s3 ;C8|)Yv!y85789C 3   c |s'|r%|r#|r!||||| s| stj|S|t}|d|||||||| d| j|S)avSerialize ``obj`` to a JSON formatted ``str``. If ``skipkeys`` is true then ``dict`` keys that are not basic types (``str``, ``int``, ``float``, ``bool``, ``None``) will be skipped instead of raising a ``TypeError``. If ``ensure_ascii`` is false, then the return value can contain non-ASCII characters if they appear in strings contained in ``obj``. Otherwise, all such characters are escaped in JSON strings. If ``check_circular`` is false, then the circular reference check for container types will be skipped and a circular reference will result in an ``RecursionError`` (or worse). If ``allow_nan`` is false, then it will be a ``ValueError`` to serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). If ``indent`` is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. ``None`` is the most compact representation. If specified, ``separators`` should be an ``(item_separator, key_separator)`` tuple. The default is ``(', ', ': ')`` if *indent* is ``None`` and ``(',', ': ')`` otherwise. To get the most compact JSON representation, you should specify ``(',', ':')`` to eliminate whitespace. ``default(obj)`` is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError. If *sort_keys* is true (default: ``False``), then the output of dictionaries will be sorted by key. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the ``.default()`` method to serialize additional types), specify it with the ``cls`` kwarg; otherwise ``JSONEncoder`` is used. rr)rencoder) rr r r rrrrrrrs rrrs{X 9 :+= "&&s++ {   %6w)   fSk r ) object_hookobject_pairs_hookcz|j}|tjtjfry|tjtj fry|tj ryt|dk\r"|ds |drdSdS|ds|d s|d rd Sd Sy t|d k(r |dsy|dsy y )Nzutf-32zutf-16z utf-8-sigr r z utf-16-bez utf-32-bez utf-16-lez utf-32-lezutf-8) startswithcodecs BOM_UTF32_BE BOM_UTF32_LE BOM_UTF16_BE BOM_UTF16_LEBOM_UTF8len)b bstartswiths rdetect_encodingr3s,,KF'')<)<=>F'')<)<=>6??# 1v{t#$A$; 7K 7t#$A$!A$; ?K ?  Q1tt r rr# parse_float parse_intparse_constantr$c Dt|jf||||||d|S)aDeserialize ``fp`` (a ``.read()``-supporting file-like object containing a JSON document) to a Python object. ``object_hook`` is an optional function that will be called with the result of any object literal decode (a ``dict``). The return value of ``object_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders (e.g. JSON-RPC class hinting). ``object_pairs_hook`` is an optional function that will be called with the result of any object literal decoded with an ordered list of pairs. The return value of ``object_pairs_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders. If ``object_hook`` is also defined, the ``object_pairs_hook`` takes priority. To use a custom ``JSONDecoder`` subclass, specify it with the ``cls`` kwarg; otherwise ``JSONDecoder`` is used. r4)rread)rrr#r5r6r7r$rs rrrs>&  R [9%9J ROQ RRr c t|tr|jdr`td|dt|tt fs"t d|jj|jt|d}|!||||||stj|S|t}|||d<|||d<|||d<|||d <|||d <|d i|j|S) aRDeserialize ``s`` (a ``str``, ``bytes`` or ``bytearray`` instance containing a JSON document) to a Python object. ``object_hook`` is an optional function that will be called with the result of any object literal decode (a ``dict``). The return value of ``object_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders (e.g. JSON-RPC class hinting). ``object_pairs_hook`` is an optional function that will be called with the result of any object literal decoded with an ordered list of pairs. The return value of ``object_pairs_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders. If ``object_hook`` is also defined, the ``object_pairs_hook`` takes priority. ``parse_float``, if specified, will be called with the string of every JSON float to be decoded. By default this is equivalent to float(num_str). This can be used to use another datatype or parser for JSON floats (e.g. decimal.Decimal). ``parse_int``, if specified, will be called with the string of every JSON int to be decoded. By default this is equivalent to int(num_str). This can be used to use another datatype or parser for JSON integers (e.g. float). ``parse_constant``, if specified, will be called with one of the following strings: -Infinity, Infinity, NaN. This can be used to raise an exception if invalid JSON numbers are encountered. To use a custom ``JSONDecoder`` subclass, specify it with the ``cls`` kwarg; otherwise ``JSONDecoder`` is used. uz-Unexpected UTF-8 BOM (decode using utf-8-sig)r z5the JSON object must be str, bytes or bytearray, not surrogatepassr#r$r5r6r7r) isinstancestrr)rbytes bytearray TypeError __class____name__decoder3_default_decoderr)srr#r5r6r7r$rs rrr+s#D!S << !!"Q"#Q( (!eY/0##$;;#7#7"8:; ; HH_Q' 9 +  +"5  "'8'@&&q)) {'=$"3 '=#;!-  99  A r )__doc__ __version____all__ __author__decoderrrencoderrr*rrrrDr3rrrr rrLs`B   - 1    $$tD$<~!tDD$7t44H<dttR2dtt<r PK!V&__pycache__/tool.cpython-312.opt-1.pycnu[ ֦i dZddlZddlZddlZddlmZdZedk(r eyy#e$r&Z eje jYdZ [ ydZ [ wwxYw)aCommand-line tool to validate and pretty-print JSON Usage:: $ echo '{"json":"obj"}' | python -m json.tool { "json": "obj" } $ echo '{ 1.2:3.4}' | python -m json.tool Expecting property name enclosed in double quotes: line 1 column 3 (char 2) N)Pathcd}d}tj||}|jddtjddtj |jd dt d d |jd d dd|jdddd|jdd dd|j}|jddtd|jddddd !|jd"dddd#!|jd$d d%&|j}|j|j|jd'}|jr d|d<d(|d)<|j5} |jr d*|D}nt!j"|f}|j$tj&}n|j$j)d+d}|5} |D]*} t!j*| | fi|| j-d,, ddddddy#1swYxYw#t.$r} t1| d} ~ wwxYw#1swYyxYw)-Nzpython -m json.toolzZA simple command line interface for json module to validate and pretty-print JSON objects.)prog descriptioninfile?zutf-8)encodingz-a JSON file to be validated or pretty-printed)nargstypehelpdefaultoutfilez%write the output of infile to outfilez --sort-keys store_trueFz5sort the output of dictionaries alphabetically by key)actionr r z--no-ensure-ascii ensure_ascii store_falsez(disable escaping of non-ASCII characters)destrr z --json-linesznparse input using the JSON Lines format. Use with --no-indent or --compact to produce valid JSON Lines output.z--indentzJseparate items with newlines and use this number of spaces for indentation)r r r z--tab store_constindent z9separate items with newlines and use tabs for indentation)rrconstr z --no-indentz/separate items with spaces rather than newlinesz --compactz1suppress all whitespace separation (most compact))rr ) sort_keysrr),: separatorsc3FK|]}tj|yw)N)jsonloads).0lines "/usr/lib64/python3.12/json/tool.py zmain..AsrKs^  ; | z  s'AA  APK!]1515*__pycache__/__init__.cpython-312.opt-1.pycnu[ ֦i6 dZdZgdZdZddlmZmZddlmZddl Z ed d d d ddd Z d d d d ddddd d d Z d d d d ddddd d dZ eddZ dZddddddddZddddddddZy)a JSON (JavaScript Object Notation) is a subset of JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data interchange format. :mod:`json` exposes an API familiar to users of the standard library :mod:`marshal` and :mod:`pickle` modules. It is derived from a version of the externally maintained simplejson library. Encoding basic Python object hierarchies:: >>> import json >>> json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}]) '["foo", {"bar": ["baz", null, 1.0, 2]}]' >>> print(json.dumps("\"foo\bar")) "\"foo\bar" >>> print(json.dumps('\u1234')) "\u1234" >>> print(json.dumps('\\')) "\\" >>> print(json.dumps({"c": 0, "b": 0, "a": 0}, sort_keys=True)) {"a": 0, "b": 0, "c": 0} >>> from io import StringIO >>> io = StringIO() >>> json.dump(['streaming API'], io) >>> io.getvalue() '["streaming API"]' Compact encoding:: >>> import json >>> mydict = {'4': 5, '6': 7} >>> json.dumps([1,2,3,mydict], separators=(',', ':')) '[1,2,3,{"4":5,"6":7}]' Pretty printing:: >>> import json >>> print(json.dumps({'4': 5, '6': 7}, sort_keys=True, indent=4)) { "4": 5, "6": 7 } Decoding JSON:: >>> import json >>> obj = ['foo', {'bar': ['baz', None, 1.0, 2]}] >>> json.loads('["foo", {"bar":["baz", null, 1.0, 2]}]') == obj True >>> json.loads('"\\"foo\\bar"') == '"foo\x08ar' True >>> from io import StringIO >>> io = StringIO('["streaming API"]') >>> json.load(io)[0] == 'streaming API' True Specializing JSON object decoding:: >>> import json >>> def as_complex(dct): ... if '__complex__' in dct: ... return complex(dct['real'], dct['imag']) ... return dct ... >>> json.loads('{"__complex__": true, "real": 1, "imag": 2}', ... object_hook=as_complex) (1+2j) >>> from decimal import Decimal >>> json.loads('1.1', parse_float=Decimal) == Decimal('1.1') True Specializing JSON object encoding:: >>> import json >>> def encode_complex(obj): ... if isinstance(obj, complex): ... return [obj.real, obj.imag] ... raise TypeError(f'Object of type {obj.__class__.__name__} ' ... f'is not JSON serializable') ... >>> json.dumps(2 + 1j, default=encode_complex) '[2.0, 1.0]' >>> json.JSONEncoder(default=encode_complex).encode(2 + 1j) '[2.0, 1.0]' >>> ''.join(json.JSONEncoder(default=encode_complex).iterencode(2 + 1j)) '[2.0, 1.0]' Using json.tool from the shell to validate and pretty-print:: $ echo '{"json":"obj"}' | python -m json.tool { "json": "obj" } $ echo '{ 1.2:3.4}' | python -m json.tool Expecting property name enclosed in double quotes: line 1 column 3 (char 2) z2.0.9)dumpdumpsloadloads JSONDecoderJSONDecodeError JSONEncoderzBob Ippolito )rr)rNFT)skipkeys ensure_asciicheck_circular allow_nanindent separatorsdefault) r r r rclsrrr sort_keysc |s(|r&|r$|r"| ||| | s| stj|} n(|t}|d||||||| | d| j|} | D]} |j| y)aSerialize ``obj`` as a JSON formatted stream to ``fp`` (a ``.write()``-supporting file-like object). If ``skipkeys`` is true then ``dict`` keys that are not basic types (``str``, ``int``, ``float``, ``bool``, ``None``) will be skipped instead of raising a ``TypeError``. If ``ensure_ascii`` is false, then the strings written to ``fp`` can contain non-ASCII characters if they appear in strings contained in ``obj``. Otherwise, all such characters are escaped in JSON strings. If ``check_circular`` is false, then the circular reference check for container types will be skipped and a circular reference will result in an ``RecursionError`` (or worse). If ``allow_nan`` is false, then it will be a ``ValueError`` to serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). If ``indent`` is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. ``None`` is the most compact representation. If specified, ``separators`` should be an ``(item_separator, key_separator)`` tuple. The default is ``(', ', ': ')`` if *indent* is ``None`` and ``(',', ': ')`` otherwise. To get the most compact JSON representation, you should specify ``(',', ':')`` to eliminate whitespace. ``default(obj)`` is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError. If *sort_keys* is true (default: ``False``), then the output of dictionaries will be sorted by key. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the ``.default()`` method to serialize additional types), specify it with the ``cls`` kwarg; otherwise ``JSONEncoder`` is used. Nr r r rrrrr)_default_encoder iterencoderwrite)objfpr r r rrrrrrkwiterablechunks &/usr/lib64/python3.12/json/__init__.pyrrxsZ 9 :+= "#..s3 ;C8|)Yv!y85789C 3   c |s'|r%|r#|r!||||| s| stj|S|t}|d|||||||| d| j|S)avSerialize ``obj`` to a JSON formatted ``str``. If ``skipkeys`` is true then ``dict`` keys that are not basic types (``str``, ``int``, ``float``, ``bool``, ``None``) will be skipped instead of raising a ``TypeError``. If ``ensure_ascii`` is false, then the return value can contain non-ASCII characters if they appear in strings contained in ``obj``. Otherwise, all such characters are escaped in JSON strings. If ``check_circular`` is false, then the circular reference check for container types will be skipped and a circular reference will result in an ``RecursionError`` (or worse). If ``allow_nan`` is false, then it will be a ``ValueError`` to serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). If ``indent`` is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. ``None`` is the most compact representation. If specified, ``separators`` should be an ``(item_separator, key_separator)`` tuple. The default is ``(', ', ': ')`` if *indent* is ``None`` and ``(',', ': ')`` otherwise. To get the most compact JSON representation, you should specify ``(',', ':')`` to eliminate whitespace. ``default(obj)`` is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError. If *sort_keys* is true (default: ``False``), then the output of dictionaries will be sorted by key. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the ``.default()`` method to serialize additional types), specify it with the ``cls`` kwarg; otherwise ``JSONEncoder`` is used. rr)rencoder) rr r r rrrrrrrs rrrs{X 9 :+= "&&s++ {   %6w)   fSk r ) object_hookobject_pairs_hookcz|j}|tjtjfry|tjtj fry|tj ryt|dk\r"|ds |drdSdS|ds|d s|d rd Sd Sy t|d k(r |dsy|dsy y )Nzutf-32zutf-16z utf-8-sigr r z utf-16-bez utf-32-bez utf-16-lez utf-32-lezutf-8) startswithcodecs BOM_UTF32_BE BOM_UTF32_LE BOM_UTF16_BE BOM_UTF16_LEBOM_UTF8len)b bstartswiths rdetect_encodingr3s,,KF'')<)<=>F'')<)<=>6??# 1v{t#$A$; 7K 7t#$A$!A$; ?K ?  Q1tt r rr# parse_float parse_intparse_constantr$c Dt|jf||||||d|S)aDeserialize ``fp`` (a ``.read()``-supporting file-like object containing a JSON document) to a Python object. ``object_hook`` is an optional function that will be called with the result of any object literal decode (a ``dict``). The return value of ``object_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders (e.g. JSON-RPC class hinting). ``object_pairs_hook`` is an optional function that will be called with the result of any object literal decoded with an ordered list of pairs. The return value of ``object_pairs_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders. If ``object_hook`` is also defined, the ``object_pairs_hook`` takes priority. To use a custom ``JSONDecoder`` subclass, specify it with the ``cls`` kwarg; otherwise ``JSONDecoder`` is used. r4)rread)rrr#r5r6r7r$rs rrrs>&  R [9%9J ROQ RRr c t|tr|jdr`td|dt|tt fs"t d|jj|jt|d}|!||||||stj|S|t}|||d<|||d<|||d<|||d <|||d <|d i|j|S) aRDeserialize ``s`` (a ``str``, ``bytes`` or ``bytearray`` instance containing a JSON document) to a Python object. ``object_hook`` is an optional function that will be called with the result of any object literal decode (a ``dict``). The return value of ``object_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders (e.g. JSON-RPC class hinting). ``object_pairs_hook`` is an optional function that will be called with the result of any object literal decoded with an ordered list of pairs. The return value of ``object_pairs_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders. If ``object_hook`` is also defined, the ``object_pairs_hook`` takes priority. ``parse_float``, if specified, will be called with the string of every JSON float to be decoded. By default this is equivalent to float(num_str). This can be used to use another datatype or parser for JSON floats (e.g. decimal.Decimal). ``parse_int``, if specified, will be called with the string of every JSON int to be decoded. By default this is equivalent to int(num_str). This can be used to use another datatype or parser for JSON integers (e.g. float). ``parse_constant``, if specified, will be called with one of the following strings: -Infinity, Infinity, NaN. This can be used to raise an exception if invalid JSON numbers are encountered. To use a custom ``JSONDecoder`` subclass, specify it with the ``cls`` kwarg; otherwise ``JSONDecoder`` is used. uz-Unexpected UTF-8 BOM (decode using utf-8-sig)r z5the JSON object must be str, bytes or bytearray, not surrogatepassr#r$r5r6r7r) isinstancestrr)rbytes bytearray TypeError __class____name__decoder3_default_decoderr)srr#r5r6r7r$rs rrr+s#D!S << !!"Q"#Q( (!eY/0##$;;#7#7"8:; ; HH_Q' 9 +  +"5  "'8'@&&q)) {'=$"3 '=#;!-  99  A r )__doc__ __version____all__ __author__decoderrrencoderrr*rrrrDr3rrrr rrLs`B   - 1    $$tD$<~!tDD$7t44H<dttR2dtt<r PK!9*__pycache__/__init__.cpython-312.opt-2.pycnu[ ֦i6 dZgdZdZddlmZmZddlmZddlZedd d d ddd Z dd d d dddddd d Z dd d d dddddd d Z eddZ dZ ddddddddZddddddddZy)z2.0.9)dumpdumpsloadloads JSONDecoderJSONDecodeError JSONEncoderzBob Ippolito )rr)rNFT)skipkeys ensure_asciicheck_circular allow_nanindent separatorsdefault) r r r rclsrrr sort_keysc |s(|r&|r$|r"| ||| | s| stj|} n(|t}|d||||||| | d| j|} | D]} |j| yN)r r r rrrrr)_default_encoder iterencoderwrite)objfpr r r rrrrrrkwiterablechunks &/usr/lib64/python3.12/json/__init__.pyrrxs(T 9 :+= "#..s3 ;C8|)Yv!y85789C 3   c |s'|r%|r#|r!||||| s| stj|S|t}|d|||||||| d| j|Sr)rencoder) rr r r rrrrrrrs rrrs'R 9 :+= "&&s++ {   %6w)   fSk r ) object_hookobject_pairs_hookcz|j}|tjtjfry|tjtj fry|tj ryt|dk\r"|ds |drdSdS|ds|d s|d rd Sd Sy t|d k(r |dsy|dsy y )Nzutf-32zutf-16z utf-8-sigr r z utf-16-bez utf-32-bez utf-16-lez utf-32-lezutf-8) startswithcodecs BOM_UTF32_BE BOM_UTF32_LE BOM_UTF16_BE BOM_UTF16_LEBOM_UTF8len)b bstartswiths rdetect_encodingr3s,,KF'')<)<=>F'')<)<=>6??# 1v{t#$A$; 7K 7t#$A$!A$; ?K ?  Q1tt r rr# parse_float parse_intparse_constantr$c F t|jf||||||d|S)Nr4)rread)rrr#r5r6r7r$rs rrrsC"  R [9%9J ROQ RRr c  t|tr|jdr`td|dt|tt fs"t d|jj|jt|d}|!||||||stj|S|t}|||d<|||d<|||d<|||d <|||d <|d i|j|S) Nuz-Unexpected UTF-8 BOM (decode using utf-8-sig)r z5the JSON object must be str, bytes or bytearray, not surrogatepassr#r$r5r6r7r) isinstancestrr)rbytes bytearray TypeError __class____name__decoder3_default_decoderr)srr#r5r6r7r$rs rrr+s(@!S << !!"Q"#Q( (!eY/0##$;;#7#7"8:; ; HH_Q' 9 +  +"5  "'8'@&&q)) {'=$"3 '=#;!-  99  A r ) __version____all__ __author__decoderrrencoderrr*rrrrDr3rrrr rrKs`B   - 1    $$tD$<~!tDD$7t44H<dttR2dtt<r PK!V __pycache__/tool.cpython-312.pycnu[ ֦i dZddlZddlZddlZddlmZdZedk(r eyy#e$r&Z eje jYdZ [ ydZ [ wwxYw)aCommand-line tool to validate and pretty-print JSON Usage:: $ echo '{"json":"obj"}' | python -m json.tool { "json": "obj" } $ echo '{ 1.2:3.4}' | python -m json.tool Expecting property name enclosed in double quotes: line 1 column 3 (char 2) N)Pathcd}d}tj||}|jddtjddtj |jd dt d d |jd d dd|jdddd|jdd dd|j}|jddtd|jddddd !|jd"dddd#!|jd$d d%&|j}|j|j|jd'}|jr d|d<d(|d)<|j5} |jr d*|D}nt!j"|f}|j$tj&}n|j$j)d+d}|5} |D]*} t!j*| | fi|| j-d,, ddddddy#1swYxYw#t.$r} t1| d} ~ wwxYw#1swYyxYw)-Nzpython -m json.toolzZA simple command line interface for json module to validate and pretty-print JSON objects.)prog descriptioninfile?zutf-8)encodingz-a JSON file to be validated or pretty-printed)nargstypehelpdefaultoutfilez%write the output of infile to outfilez --sort-keys store_trueFz5sort the output of dictionaries alphabetically by key)actionr r z--no-ensure-ascii ensure_ascii store_falsez(disable escaping of non-ASCII characters)destrr z --json-linesznparse input using the JSON Lines format. Use with --no-indent or --compact to produce valid JSON Lines output.z--indentzJseparate items with newlines and use this number of spaces for indentation)r r r z--tab store_constindent z9separate items with newlines and use tabs for indentation)rrconstr z --no-indentz/separate items with spaces rather than newlinesz --compactz1suppress all whitespace separation (most compact))rr ) sort_keysrr),: separatorsc3FK|]}tj|yw)N)jsonloads).0lines "/usr/lib64/python3.12/json/tool.py zmain..AsrKs^  ; | z  s'AA  APK!r[6[6#__pycache__/decoder.cpython-312.pycnu[ ֦i0 dZddlZddlmZ ddlmZddgZejejzejzZ e dZe dZe d ZGd deZeeed Zej(d e Zej(d e ZdddddddddZej0fdZdeej0fdZexseZej(de ZdZdej0efdZej0efdZGddeZ y#e$rdZYwxYw)zImplementation of JSONDecoder N)scanner) scanstring JSONDecoderJSONDecodeErrornaninfz-infceZdZdZdZdZy)ra Subclass of ValueError with the following additional properties: msg: The unformatted error message doc: The JSON document being parsed pos: The start index of doc where parsing failed lineno: The line corresponding to pos colno: The column corresponding to pos c|jdd|dz}||jdd|z }d||||fz}tj||||_||_||_||_||_y)N rz%s: line %d column %d (char %d)) countrfind ValueError__init__msgdocposlinenocolno)selfrrrrrerrmsgs %/usr/lib64/python3.12/json/decoder.pyrzJSONDecodeError.__init__sv4C(1,ciia--2c65#5NND&)  c`|j|j|j|jffS)N) __class__rrr)rs r __reduce__zJSONDecodeError.__reduce__*s$~~$((DHH===rN)__name__ __module__ __qualname____doc__rrrrrrs >r)z -InfinityInfinityNaNz[0-9A-Fa-f]{4}z(.*?)(["\\\x00-\x1f])"\/ r   )r$r%r&bfnrtc|||dz}| t|jdSd}t|||#t$rYwxYw)Nr zInvalid \uXXXX escape)intgrouprr)sr_mescrs r _decode_uXXXXr7<sX Qa.C  syy{B' ' #C #q# &&   s9 AATcg}|j}|dz } |||}| td|||j}|j\} } | r|| | dk(rn| dk7r)|rdj | } t| |||| z ||} | dk7r || } |dz }nht||}|d z }d |cxkrd krAnn>|||d zd k(r3t||dz}d|cxkrdkrnnd|d z dz|dz zz}|dz }t|} || dj||fS#t $rtd||dwxYw#t $rdj | } t| ||wxYw)aScan the string s for a JSON string. End is the index of the character in s after the quote that started the JSON string. Unescapes all valid JSON string escape sequences and raises ValueError on attempt to decode an invalid string. If strict is False then literal control characters are allowed in the string. Returns a tuple of the decoded string and the index of the character in s after the end quote.r NzUnterminated string starting atr$r%z"Invalid control character {0!r} atuzInvalid \escape: {0!r}iiz\uiii ) appendrendgroupsformat IndexErrorKeyErrorr7chrjoin)r4r@strict_br5chunks_appendbeginchunkcontent terminatorrr6charuniuni2s r py_scanstringrRFsFmmG !GE 1c  =!"CQN Niik#lln  G     4 :AA*M%c1c22 # 6C&C #: 3#w 1HC3'C 1HC&&1Sq>U+B$Qa0T+V+!sV|&:tf}%MNC1HCs8D W X 776?C + 6!"C"#U,15 6 6 3/66s;%c1c22 3sD*E*E(E-z [ \t\n\r]*z cL|\}} g} | j} |i}|j} || | dz} | dk7r^| |vr||| j} || | dz} | dk(r$||| }|| dzfSi} ||| } | | dzfS| dk7r td|| | dz } t || |\}} | ||}|| | dzdk7r/||| j} || | dzdk7r td|| | dz } || |vr&| dz } || |vr||| dzj} ||| \}} | ||f || } | |vr||| dzj} || } | dz } | dk(rnP| d k7rtd || dz ||| j} || | dz} | dz } | dk7rtd|| dz !| || }|| fSt| } ||| } | | fS#t $rYwxYw#t $r}td||jdd}~wwxYw#t $rd} YwxYw) Nr r$}z1Expecting property name enclosed in double quotes:zExpecting ':' delimiterExpecting valuer>,Expecting ',' delimiter) r? setdefaultr@rrrC StopIterationvaluedict) s_and_endrG scan_once object_hookobject_pairs_hookmemo_w_wsr4r@pairs pairs_appendmemo_getnextcharresultkeyr[errs r JSONObjectrks FAs E< ! _!CQM M1HC af-SsC  Sq>S Q*.."CS1W~$%&?CHH q v}qS6S=Qa.,,.C M"1c*JE3 c5\" vH3C!Gn((*S6 q s?  _!";QaH HCjnnSq> q s?!CQaQ QS V$"5)s{ KEE" #:C     M!"3Q B L M H s<.-G G,3(H G)(G), H5H  H H#"H#c:|\}}g}|||dz}||vr"|||dzj}|||dz}|dk(r||dzfS|j} |||\} }|| |||dz}||vr"|||dzj}|||dz}|dz }|dk(r ||fS|dk7rtd||dz  |||vr&|dz }|||vr|||dzj}#t$r} td|| jdd} ~ wwxYw#t $rY5wxYw)Nr ]rVrWrX)r@r?rZrr[rC) r]r^rbrcr4r@valuesrgrJr[rjs r JSONArrayros FAs FS1W~H3C!Gn  "Sq>3sQwmmG  M"1c*JE3 Sq> s?Qa.$$&CS1W~H q s?  3;_!";QaH H v}qS6S=Qa.,,.C'  M!"3Q B L M"   s* C%7-D% D .DD  DDcLeZdZdZddddddddZej fdZddZy) raSimple JSON decoder Performs the following translations in decoding by default: +---------------+-------------------+ | JSON | Python | +===============+===================+ | object | dict | +---------------+-------------------+ | array | list | +---------------+-------------------+ | string | str | +---------------+-------------------+ | number (int) | int | +---------------+-------------------+ | number (real) | float | +---------------+-------------------+ | true | True | +---------------+-------------------+ | false | False | +---------------+-------------------+ | null | None | +---------------+-------------------+ It also understands ``NaN``, ``Infinity``, and ``-Infinity`` as their corresponding ``float`` values, which is outside the JSON spec. NT)r_ parse_float parse_intparse_constantrGr`c ||_|xst|_|xst|_|xst j |_||_||_ t|_ t|_ t|_i|_t#j$||_y)a``object_hook``, if specified, will be called with the result of every JSON object decoded and its return value will be used in place of the given ``dict``. This can be used to provide custom deserializations (e.g. to support JSON-RPC class hinting). ``object_pairs_hook``, if specified will be called with the result of every JSON object decoded with an ordered list of pairs. The return value of ``object_pairs_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders. If ``object_hook`` is also defined, the ``object_pairs_hook`` takes priority. ``parse_float``, if specified, will be called with the string of every JSON float to be decoded. By default this is equivalent to float(num_str). This can be used to use another datatype or parser for JSON floats (e.g. decimal.Decimal). ``parse_int``, if specified, will be called with the string of every JSON int to be decoded. By default this is equivalent to int(num_str). This can be used to use another datatype or parser for JSON integers (e.g. float). ``parse_constant``, if specified, will be called with one of the following strings: -Infinity, Infinity, NaN. This can be used to raise an exception if invalid JSON numbers are encountered. If ``strict`` is false (true is the default), then control characters will be allowed inside strings. Control characters in this context are those with character codes in the 0-31 range, including ``'\t'`` (tab), ``'\n'``, ``'\r'`` and ``'\0'``. N)r_floatrqr2rr _CONSTANTS __getitem__rsrGr`rk parse_objectro parse_arrayr parse_stringrar make_scannerr^)rr_rqrrrsrGr`s rrzJSONDecoder.__init__syF'&/%")c,F 0F0F !2&$&  --d3rc|j|||dj\}}|||j}|t|k7r td|||S)zlReturn the Python representation of ``s`` (a ``str`` instance containing a JSON document). r)idxz Extra data) raw_decoder@lenr)rr4rbobjr@s rdecodezJSONDecoder.decodeMsW ??1"Q(,,.?9SCjnn #a&=!,37 7 rc |j||\}}||fS#t$r}td||jdd}~wwxYw)a=Decode a JSON document from ``s`` (a ``str`` beginning with a JSON document) and return a 2-tuple of the Python representation and the index in ``s`` where the document ended. This can be used to decode a JSON document from a string that may have extraneous data at the end. rVN)r^rZrr[)rr4r}rr@rjs rr~zJSONDecoder.raw_decodeXsQ M~~a-HCCx M!"3Q B L Ms A<A)r) rrrr r WHITESPACEmatchrr~r!rrrrs3:'+4"-4`&++  r)!r rejsonr_jsonr c_scanstring ImportError__all__VERBOSE MULTILINEDOTALLFLAGSrur#PosInfNegInfrrrvcompile HEXDIGITS STRINGCHUNK BACKSLASHrr7rRrWHITESPACE_STRrkroobjectrr!rrrsO 0 + , R\\!BII- El u v>j>6   BJJ(% 0 bjj159 Ds Dt$T  '__'"& **9 z *] RZZ u - Z-->Ob(2'7'7^"Jf&foLsDD  D PK!r[6[6)__pycache__/decoder.cpython-312.opt-1.pycnu[ ֦i0 dZddlZddlmZ ddlmZddgZejejzejzZ e dZe dZe d ZGd deZeeed Zej(d e Zej(d e ZdddddddddZej0fdZdeej0fdZexseZej(de ZdZdej0efdZej0efdZGddeZ y#e$rdZYwxYw)zImplementation of JSONDecoder N)scanner) scanstring JSONDecoderJSONDecodeErrornaninfz-infceZdZdZdZdZy)ra Subclass of ValueError with the following additional properties: msg: The unformatted error message doc: The JSON document being parsed pos: The start index of doc where parsing failed lineno: The line corresponding to pos colno: The column corresponding to pos c|jdd|dz}||jdd|z }d||||fz}tj||||_||_||_||_||_y)N rz%s: line %d column %d (char %d)) countrfind ValueError__init__msgdocposlinenocolno)selfrrrrrerrmsgs %/usr/lib64/python3.12/json/decoder.pyrzJSONDecodeError.__init__sv4C(1,ciia--2c65#5NND&)  c`|j|j|j|jffS)N) __class__rrr)rs r __reduce__zJSONDecodeError.__reduce__*s$~~$((DHH===rN)__name__ __module__ __qualname____doc__rrrrrrs >r)z -InfinityInfinityNaNz[0-9A-Fa-f]{4}z(.*?)(["\\\x00-\x1f])"\/ r   )r$r%r&bfnrtc|||dz}| t|jdSd}t|||#t$rYwxYw)Nr zInvalid \uXXXX escape)intgrouprr)sr_mescrs r _decode_uXXXXr7<sX Qa.C  syy{B' ' #C #q# &&   s9 AATcg}|j}|dz } |||}| td|||j}|j\} } | r|| | dk(rn| dk7r)|rdj | } t| |||| z ||} | dk7r || } |dz }nht||}|d z }d |cxkrd krAnn>|||d zd k(r3t||dz}d|cxkrdkrnnd|d z dz|dz zz}|dz }t|} || dj||fS#t $rtd||dwxYw#t $rdj | } t| ||wxYw)aScan the string s for a JSON string. End is the index of the character in s after the quote that started the JSON string. Unescapes all valid JSON string escape sequences and raises ValueError on attempt to decode an invalid string. If strict is False then literal control characters are allowed in the string. Returns a tuple of the decoded string and the index of the character in s after the end quote.r NzUnterminated string starting atr$r%z"Invalid control character {0!r} atuzInvalid \escape: {0!r}iiz\uiii ) appendrendgroupsformat IndexErrorKeyErrorr7chrjoin)r4r@strict_br5chunks_appendbeginchunkcontent terminatorrr6charuniuni2s r py_scanstringrRFsFmmG !GE 1c  =!"CQN Niik#lln  G     4 :AA*M%c1c22 # 6C&C #: 3#w 1HC3'C 1HC&&1Sq>U+B$Qa0T+V+!sV|&:tf}%MNC1HCs8D W X 776?C + 6!"C"#U,15 6 6 3/66s;%c1c22 3sD*E*E(E-z [ \t\n\r]*z cL|\}} g} | j} |i}|j} || | dz} | dk7r^| |vr||| j} || | dz} | dk(r$||| }|| dzfSi} ||| } | | dzfS| dk7r td|| | dz } t || |\}} | ||}|| | dzdk7r/||| j} || | dzdk7r td|| | dz } || |vr&| dz } || |vr||| dzj} ||| \}} | ||f || } | |vr||| dzj} || } | dz } | dk(rnP| d k7rtd || dz ||| j} || | dz} | dz } | dk7rtd|| dz !| || }|| fSt| } ||| } | | fS#t $rYwxYw#t $r}td||jdd}~wwxYw#t $rd} YwxYw) Nr r$}z1Expecting property name enclosed in double quotes:zExpecting ':' delimiterExpecting valuer>,Expecting ',' delimiter) r? setdefaultr@rrrC StopIterationvaluedict) s_and_endrG scan_once object_hookobject_pairs_hookmemo_w_wsr4r@pairs pairs_appendmemo_getnextcharresultkeyr[errs r JSONObjectrks FAs E< ! _!CQM M1HC af-SsC  Sq>S Q*.."CS1W~$%&?CHH q v}qS6S=Qa.,,.C M"1c*JE3 c5\" vH3C!Gn((*S6 q s?  _!";QaH HCjnnSq> q s?!CQaQ QS V$"5)s{ KEE" #:C     M!"3Q B L M H s<.-G G,3(H G)(G), H5H  H H#"H#c:|\}}g}|||dz}||vr"|||dzj}|||dz}|dk(r||dzfS|j} |||\} }|| |||dz}||vr"|||dzj}|||dz}|dz }|dk(r ||fS|dk7rtd||dz  |||vr&|dz }|||vr|||dzj}#t$r} td|| jdd} ~ wwxYw#t $rY5wxYw)Nr ]rVrWrX)r@r?rZrr[rC) r]r^rbrcr4r@valuesrgrJr[rjs r JSONArrayros FAs FS1W~H3C!Gn  "Sq>3sQwmmG  M"1c*JE3 Sq> s?Qa.$$&CS1W~H q s?  3;_!";QaH H v}qS6S=Qa.,,.C'  M!"3Q B L M"   s* C%7-D% D .DD  DDcLeZdZdZddddddddZej fdZddZy) raSimple JSON decoder Performs the following translations in decoding by default: +---------------+-------------------+ | JSON | Python | +===============+===================+ | object | dict | +---------------+-------------------+ | array | list | +---------------+-------------------+ | string | str | +---------------+-------------------+ | number (int) | int | +---------------+-------------------+ | number (real) | float | +---------------+-------------------+ | true | True | +---------------+-------------------+ | false | False | +---------------+-------------------+ | null | None | +---------------+-------------------+ It also understands ``NaN``, ``Infinity``, and ``-Infinity`` as their corresponding ``float`` values, which is outside the JSON spec. NT)r_ parse_float parse_intparse_constantrGr`c ||_|xst|_|xst|_|xst j |_||_||_ t|_ t|_ t|_i|_t#j$||_y)a``object_hook``, if specified, will be called with the result of every JSON object decoded and its return value will be used in place of the given ``dict``. This can be used to provide custom deserializations (e.g. to support JSON-RPC class hinting). ``object_pairs_hook``, if specified will be called with the result of every JSON object decoded with an ordered list of pairs. The return value of ``object_pairs_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders. If ``object_hook`` is also defined, the ``object_pairs_hook`` takes priority. ``parse_float``, if specified, will be called with the string of every JSON float to be decoded. By default this is equivalent to float(num_str). This can be used to use another datatype or parser for JSON floats (e.g. decimal.Decimal). ``parse_int``, if specified, will be called with the string of every JSON int to be decoded. By default this is equivalent to int(num_str). This can be used to use another datatype or parser for JSON integers (e.g. float). ``parse_constant``, if specified, will be called with one of the following strings: -Infinity, Infinity, NaN. This can be used to raise an exception if invalid JSON numbers are encountered. If ``strict`` is false (true is the default), then control characters will be allowed inside strings. Control characters in this context are those with character codes in the 0-31 range, including ``'\t'`` (tab), ``'\n'``, ``'\r'`` and ``'\0'``. N)r_floatrqr2rr _CONSTANTS __getitem__rsrGr`rk parse_objectro parse_arrayr parse_stringrar make_scannerr^)rr_rqrrrsrGr`s rrzJSONDecoder.__init__syF'&/%")c,F 0F0F !2&$&  --d3rc|j|||dj\}}|||j}|t|k7r td|||S)zlReturn the Python representation of ``s`` (a ``str`` instance containing a JSON document). r)idxz Extra data) raw_decoder@lenr)rr4rbobjr@s rdecodezJSONDecoder.decodeMsW ??1"Q(,,.?9SCjnn #a&=!,37 7 rc |j||\}}||fS#t$r}td||jdd}~wwxYw)a=Decode a JSON document from ``s`` (a ``str`` beginning with a JSON document) and return a 2-tuple of the Python representation and the index in ``s`` where the document ended. This can be used to decode a JSON document from a string that may have extraneous data at the end. rVN)r^rZrr[)rr4r}rr@rjs rr~zJSONDecoder.raw_decodeXsQ M~~a-HCCx M!"3Q B L Ms A<A)r) rrrr r WHITESPACEmatchrr~r!rrrrs3:'+4"-4`&++  r)!r rejsonr_jsonr c_scanstring ImportError__all__VERBOSE MULTILINEDOTALLFLAGSrur#PosInfNegInfrrrvcompile HEXDIGITS STRINGCHUNK BACKSLASHrr7rRrWHITESPACE_STRrkroobjectrr!rrrsO 0 + , R\\!BII- El u v>j>6   BJJ(% 0 bjj159 Ds Dt$T  '__'"& **9 z *] RZZ u - Z-->Ob(2'7'7^"Jf&foLsDD  D PK!Q툈  )__pycache__/scanner.cpython-312.opt-1.pycnu[ ֦i dZddlZ ddlmZdgZejdejejzejzZ dZ exse Zy#e$rdZYMwxYw)zJSON token scanner N) make_scannerrz2(-?(?:0|[1-9][0-9]*))(\.[0-9]+)?([eE][-+]?[0-9]+)?c Z |j |j|j tj|j |j |j |j|j|j|j f dfd}|S)Nc ||}|dk(r ||dzS|dk(r||dzf S|dk(r ||dzfS|dk(r|||dzdk(rd|dzfS|dk(r|||dzd k(rd |dzfS|d k(r|||d zd k(rd|d zfS ||}|I|j\}}}|s|r||xsdz|xsdz}n|}||jfS|dk(r|||dzdk(r d|dzfS|dk(r|||dzdk(r d|dzfS|dk(r|||dzdk(r d|dzfSt|#t$r t|dwxYw)N"{[nnullttrueTffalseFNNaNIInfinity- z -Infinity) IndexError StopIterationgroupsend)stringidxnextcharmintegerfracexpres _scan_once match_numbermemo object_hookobject_pairs_hook parse_arrayparse_constant parse_float parse_int parse_object parse_stringstricts %/usr/lib64/python3.12/json/scanner.pyr'z#py_make_scanner.._scan_onces /c{H s?a8 8 _q 16K):DB B _a0*= = _C!G!4!>q= _C!G!4!>q= _C!G!4!?#'> !  % =!" GT3s!'TZR"8CI2"FG(<  _C!G!4!=!%(#'1 1 _C!G!4 !B!*-sQw6 6 _C!G!4 !C!+.a7 7$ $A /$$ . /s D??Ecb ||jS#jwxYw)N)clear)rr r'r)s r3 scan_oncez"py_make_scanner..scan_onceAs% fc* JJLDJJLs.) r0r,r1 NUMBER_REmatchr2r.r/r-r*r+r))contextr6r'r(r)r*r+r,r-r.r/r0r1r2s @@@@@@@@@@@@r3py_make_scannerr:s''L%%K''L??L ^^F%%K!!I++N%%K11 <rGst 4   BJJ9ZZ",,* - 8t0 GNsAAAPK!n˧XX add/set.rbnu[unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED require 'json' end defined?(::Set) or require 'set' class Set # See #as_json. def self.json_create(object) new object['a'] end # Methods Set#as_json and +Set.json_create+ may be used # to serialize and deserialize a \Set object; # see Marshal[rdoc-ref:Marshal]. # # \Method Set#as_json serializes +self+, # returning a 2-element hash representing +self+: # # require 'json/add/set' # x = Set.new(%w/foo bar baz/).as_json # # => {"json_class"=>"Set", "a"=>["foo", "bar", "baz"]} # # \Method +JSON.create+ deserializes such a hash, returning a \Set object: # # Set.json_create(x) # => # # def as_json(*) { JSON.create_id => self.class.name, 'a' => to_a, } end # Returns a JSON string representing +self+: # # require 'json/add/set' # puts Set.new(%w/foo bar baz/).to_json # # Output: # # {"json_class":"Set","a":["foo","bar","baz"]} # def to_json(*args) as_json.to_json(*args) end end PK!u֋o o php_json_scanner.hnu[/* +----------------------------------------------------------------------+ | PHP Version 7 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2018 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: Jakub Zelenka | +----------------------------------------------------------------------+ */ #ifndef PHP_JSON_SCANNER_H #define PHP_JSON_SCANNER_H #include "php.h" #include "php_json.h" typedef unsigned char php_json_ctype; typedef struct _php_json_scanner { php_json_ctype *cursor; /* cursor position */ php_json_ctype *token; /* token position */ php_json_ctype *limit; /* the last read character + 1 position */ php_json_ctype *marker; /* marker position for backtracking */ php_json_ctype *ctxmarker; /* marker position for context backtracking */ php_json_ctype *str_start; /* start position of the string */ php_json_ctype *pstr; /* string pointer for escapes conversion */ zval value; /* value */ int str_esc; /* number of extra characters for escaping */ int state; /* condition state */ int options; /* options */ php_json_error_code errcode; /* error type if there is an error */ int utf8_invalid; /* whether utf8 is invalid */ int utf8_invalid_count; /* number of extra character for invalid utf8 */ } php_json_scanner; void php_json_scanner_init(php_json_scanner *scanner, char *str, size_t str_len, int options); int php_json_scan(php_json_scanner *s); #endif /* PHP_JSON_SCANNER_H */ PK!> php_json_parser.hnu[/* +----------------------------------------------------------------------+ | PHP Version 7 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2018 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: Jakub Zelenka | +----------------------------------------------------------------------+ */ #ifndef PHP_JSON_PARSER_H #define PHP_JSON_PARSER_H #include "php.h" #include "php_json_scanner.h" typedef struct _php_json_parser php_json_parser; typedef int (*php_json_parser_func_array_create_t)( php_json_parser *parser, zval *array); typedef int (*php_json_parser_func_array_append_t)( php_json_parser *parser, zval *array, zval *zvalue); typedef int (*php_json_parser_func_array_start_t)( php_json_parser *parser); typedef int (*php_json_parser_func_array_end_t)( php_json_parser *parser, zval *object); typedef int (*php_json_parser_func_object_create_t)( php_json_parser *parser, zval *object); typedef int (*php_json_parser_func_object_update_t)( php_json_parser *parser, zval *object, zend_string *key, zval *zvalue); typedef int (*php_json_parser_func_object_start_t)( php_json_parser *parser); typedef int (*php_json_parser_func_object_end_t)( php_json_parser *parser, zval *object); typedef struct _php_json_parser_methods { php_json_parser_func_array_create_t array_create; php_json_parser_func_array_append_t array_append; php_json_parser_func_array_start_t array_start; php_json_parser_func_array_end_t array_end; php_json_parser_func_object_create_t object_create; php_json_parser_func_object_update_t object_update; php_json_parser_func_object_start_t object_start; php_json_parser_func_object_end_t object_end; } php_json_parser_methods; struct _php_json_parser { php_json_scanner scanner; zval *return_value; int depth; int max_depth; php_json_parser_methods methods; }; PHP_JSON_API void php_json_parser_init_ex( php_json_parser *parser, zval *return_value, char *str, size_t str_len, int options, int max_depth, const php_json_parser_methods *methods); PHP_JSON_API void php_json_parser_init( php_json_parser *parser, zval *return_value, char *str, size_t str_len, int options, int max_depth); PHP_JSON_API php_json_error_code php_json_parser_error_code(const php_json_parser *parser); PHP_JSON_API int php_json_parse(php_json_parser *parser); int php_json_yyparse(php_json_parser *parser); #endif /* PHP_JSON_PARSER_H */ PK!Q_k php_json.hnu[/* +----------------------------------------------------------------------+ | PHP Version 7 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2018 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: Omar Kilani | | Jakub Zelenka | +----------------------------------------------------------------------+ */ #ifndef PHP_JSON_H #define PHP_JSON_H #define PHP_JSON_VERSION "1.6.0" #include "zend_smart_str_public.h" extern zend_module_entry json_module_entry; #define phpext_json_ptr &json_module_entry #if defined(PHP_WIN32) && defined(JSON_EXPORTS) #define PHP_JSON_API __declspec(dllexport) #else #define PHP_JSON_API PHPAPI #endif #ifdef ZTS #include "TSRM.h" #endif extern PHP_JSON_API zend_class_entry *php_json_serializable_ce; /* error codes */ typedef enum { PHP_JSON_ERROR_NONE = 0, PHP_JSON_ERROR_DEPTH, PHP_JSON_ERROR_STATE_MISMATCH, PHP_JSON_ERROR_CTRL_CHAR, PHP_JSON_ERROR_SYNTAX, PHP_JSON_ERROR_UTF8, PHP_JSON_ERROR_RECURSION, PHP_JSON_ERROR_INF_OR_NAN, PHP_JSON_ERROR_UNSUPPORTED_TYPE, PHP_JSON_ERROR_INVALID_PROPERTY_NAME, PHP_JSON_ERROR_UTF16 } php_json_error_code; /* json_decode() options */ #define PHP_JSON_OBJECT_AS_ARRAY (1<<0) #define PHP_JSON_BIGINT_AS_STRING (1<<1) /* json_encode() options */ #define PHP_JSON_HEX_TAG (1<<0) #define PHP_JSON_HEX_AMP (1<<1) #define PHP_JSON_HEX_APOS (1<<2) #define PHP_JSON_HEX_QUOT (1<<3) #define PHP_JSON_FORCE_OBJECT (1<<4) #define PHP_JSON_NUMERIC_CHECK (1<<5) #define PHP_JSON_UNESCAPED_SLASHES (1<<6) #define PHP_JSON_PRETTY_PRINT (1<<7) #define PHP_JSON_UNESCAPED_UNICODE (1<<8) #define PHP_JSON_PARTIAL_OUTPUT_ON_ERROR (1<<9) #define PHP_JSON_PRESERVE_ZERO_FRACTION (1<<10) #define PHP_JSON_UNESCAPED_LINE_TERMINATORS (1<<11) /* json_decode() and json_encode() common options */ #define PHP_JSON_INVALID_UTF8_IGNORE (1<<20) #define PHP_JSON_INVALID_UTF8_SUBSTITUTE (1<<21) /* Internal flags */ #define PHP_JSON_OUTPUT_ARRAY 0 #define PHP_JSON_OUTPUT_OBJECT 1 /* default depth */ #define PHP_JSON_PARSER_DEFAULT_DEPTH 512 ZEND_BEGIN_MODULE_GLOBALS(json) int encoder_depth; int encode_max_depth; php_json_error_code error_code; ZEND_END_MODULE_GLOBALS(json) PHP_JSON_API ZEND_EXTERN_MODULE_GLOBALS(json) #define JSON_G(v) ZEND_MODULE_GLOBALS_ACCESSOR(json, v) #if defined(ZTS) && defined(COMPILE_DL_JSON) ZEND_TSRMLS_CACHE_EXTERN() #endif PHP_JSON_API int php_json_encode_ex(smart_str *buf, zval *val, int options, zend_long depth); PHP_JSON_API int php_json_encode(smart_str *buf, zval *val, int options); PHP_JSON_API int php_json_decode_ex(zval *return_value, char *str, size_t str_len, zend_long options, zend_long depth); static inline int php_json_decode(zval *return_value, char *str, int str_len, zend_bool assoc, zend_long depth) { return php_json_decode_ex(return_value, str, str_len, assoc ? PHP_JSON_OBJECT_AS_ARRAY : 0, depth); } #endif /* PHP_JSON_H */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: * vim600: noet sw=4 ts=4 fdm=marker * vim<600: noet sw=4 ts=4 */ PK!c ext/generator/state.rbnu[# frozen_string_literal: true module JSON module Ext module Generator class State # call-seq: new(opts = {}) # # Instantiates a new State object, configured by _opts_. # # Argument +opts+, if given, contains a \Hash of options for the generation. # See {Generating Options}[#module-JSON-label-Generating+Options]. def initialize(opts = nil) if opts && !opts.empty? configure(opts) end end # call-seq: configure(opts) # # Configure this State instance with the Hash _opts_, and return # itself. def configure(opts) unless opts.is_a?(Hash) if opts.respond_to?(:to_hash) opts = opts.to_hash elsif opts.respond_to?(:to_h) opts = opts.to_h else raise TypeError, "can't convert #{opts.class} into Hash" end end _configure(opts) end alias_method :merge, :configure # call-seq: to_h # # Returns the configuration instance variables as a hash, that can be # passed to the configure method. def to_h result = { indent: indent, space: space, space_before: space_before, object_nl: object_nl, array_nl: array_nl, as_json: as_json, allow_nan: allow_nan?, ascii_only: ascii_only?, max_nesting: max_nesting, script_safe: script_safe?, strict: strict?, depth: depth, buffer_initial_length: buffer_initial_length, } allow_duplicate_key = allow_duplicate_key? unless allow_duplicate_key.nil? result[:allow_duplicate_key] = allow_duplicate_key end instance_variables.each do |iv| iv = iv.to_s[1..-1] result[iv.to_sym] = self[iv] end result end alias_method :to_hash, :to_h # call-seq: [](name) # # Returns the value returned by method +name+. def [](name) ::JSON.deprecation_warning("JSON::State#[] is deprecated and will be removed in json 3.0.0") if respond_to?(name) __send__(name) else instance_variable_get("@#{name}") if instance_variables.include?("@#{name}".to_sym) # avoid warning end end # call-seq: []=(name, value) # # Sets the attribute name to value. def []=(name, value) ::JSON.deprecation_warning("JSON::State#[]= is deprecated and will be removed in json 3.0.0") if respond_to?(name_writer = "#{name}=") __send__ name_writer, value else instance_variable_set "@#{name}", value end end end end end end PK!_  add/string.rbnu[# frozen_string_literal: true unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED require 'json' end class String # call-seq: json_create(o) # # Raw Strings are JSON Objects (the raw bytes are stored in an array for the # key "raw"). The Ruby String can be created by this class method. def self.json_create(object) object["raw"].pack("C*") end # call-seq: to_json_raw_object() # # This method creates a raw object hash, that can be nested into # other data structures and will be generated as a raw string. This # method should be used, if you want to convert raw strings to JSON # instead of UTF-8 strings, e. g. binary data. def to_json_raw_object { JSON.create_id => self.class.name, "raw" => unpack("C*"), } end # call-seq: to_json_raw(*args) # # This method creates a JSON text from the result of a call to # to_json_raw_object of this String. def to_json_raw(...) to_json_raw_object.to_json(...) end end PK!~wXpXp ext/parser.sonuȯPK!?9pppext/generator.sonuȯPK!@EEyaml_events.rbnu[PK!p6xx pstream.rbnu[PK!|!ruby_events.rbnu[PK!?OGG)tree_builder.rbnu[PK!@@ encoder.pynu[PK!ߤ99 ;__init__.pynu[PK!3)utool.pynu[PK! ;) )y__pycache__/__init__.cpython-36.opt-2.pycnu[PK!](օ__pycache__/scanner.cpython-36.opt-2.pycnu[PK!NTM++(__pycache__/encoder.cpython-36.opt-1.pycnu[PK!=տ  %__pycache__/tool.cpython-36.opt-1.pycnu[PK!NTM++"q__pycache__/encoder.cpython-36.pycnu[PK!(__pycache__/scanner.cpython-36.opt-1.pycnu[PK!f n(__pycache__/decoder.cpython-36.opt-2.pycnu[PK!ީi% __pycache__/tool.cpython-36.opt-2.pycnu[PK!(__pycache__/encoder.cpython-36.opt-2.pycnu[PK!=տ  b,__pycache__/tool.cpython-36.pycnu[PK!.kW&&"2__pycache__/decoder.cpython-36.pycnu[PK!~tc1c1#Y__pycache__/__init__.cpython-36.pycnu[PK!~tc1c1)__pycache__/__init__.cpython-36.opt-1.pycnu[PK!.kW&&(e__pycache__/decoder.cpython-36.opt-1.pycnu[PK!"__pycache__/scanner.cpython-36.pycnu[PK!Bs55 decoder.pynu[PK!A d"scanner.pynu[PK!]Ɗ(+__pycache__/scanner.cpython-38.opt-1.pycnu[PK!ɂjj3__pycache__/tool.cpython-38.pycnu[PK!#ӽx}}(I;__pycache__/scanner.cpython-38.opt-2.pycnu[PK!OEB1B1)C__pycache__/__init__.cpython-38.opt-1.pycnu[PK!(#EE%t__pycache__/tool.cpython-38.opt-2.pycnu[PK!E )S{__pycache__/__init__.cpython-38.opt-2.pycnu[PK!e4"v&v&(M__pycache__/decoder.cpython-38.opt-1.pycnu[PK!n0++(__pycache__/encoder.cpython-38.opt-1.pycnu[PK!E(__pycache__/decoder.cpython-38.opt-2.pycnu[PK!ɂjj%Q__pycache__/tool.cpython-38.opt-1.pycnu[PK!n0++"__pycache__/encoder.cpython-38.pycnu[PK!{(&__pycache__/encoder.cpython-38.opt-2.pycnu[PK!e4"v&v&"A__pycache__/decoder.cpython-38.pycnu[PK!]Ɗ"g__pycache__/scanner.cpython-38.pycnu[PK!OEB1B1#o__pycache__/__init__.cpython-38.pycnu[PK!ze Uscanner.pycnu[PK!RC55 Eencoder.pycnu[PK!ĤBf6f6 __init__.pyonu[PK!7y9tool.pycnu[PK!RC55 encoder.pyonu[PK!ze Qscanner.pyonu[PK!~.. Zdecoder.pycnu[PK!7y9tool.pyonu[PK!~.. decoder.pyonu[PK!ĤBf6f6 __init__.pycnu[PK!wDD version.rbnu[PK! ext.rbnu[PK!pl~~generic_object.rbnu[PK!aZ++ common.rbnu[PK!5:add/rational.rbnu[PK!ۛadd/exception.rbnu[PK!eg add/symbol.rbnu[PK!i22Зadd/complex.rbnu[PK!   @add/date.rbnu[PK!t%A, add/time.rbnu[PK!`DYY çadd/regexp.rbnu[PK!7Yadd/bigdecimal.rbnu[PK!o/CCBadd/date_time.rbnu[PK!D%D Źadd/struct.rbnu[PK!r add/range.rbnu[PK!vv add/core.rbnu[PK!A@ 8add/ostruct.rbnu[PK!<4f::)__pycache__/encoder.cpython-312.opt-1.pycnu[PK!@ )b__pycache__/scanner.cpython-312.opt-2.pycnu[PK!>I=&&)__pycache__/decoder.cpython-312.opt-2.pycnu[PK!Q툈  #<__pycache__/scanner.cpython-312.pycnu[PK!<4f::# jphp_json_parser.hnu[PK!Q_k Uphp_json.hnu[PK!c w ext/generator/state.rbnu[PK!_  J add/string.rbnu[PKYY h