fddlZddlmZddlmZddlmZmZmZm Z m Z m Z m Z m Z mZddlmZmZddlmZGdd ej(ZGd d ej,Zy) N)suppress)PurePath) AnyCallableClassVarDictListMappingOptionalSequenceTuple) _import_classget_filesystem_class)AbstractFileSystemcNeZdZUdZeeed<dedeffd ZdedefdZ xZ S)FilesystemJSONEncoderTinclude_passwordoreturnct|tr|j|jSt|tr2t |}|j d|jt|dSt|)|S)N)r.)clsstr) isinstancerto_dictrrtype __module____name__rsuperdefault)selfrr __class__s T/var/lib/jenkins/workspace/mettalog/venv/lib/python3.12/site-packages/fsspec/json.pyr!zFilesystemJSONEncoder.defaultsj a+ ,99d.C.C9D D a "q'C!nn-Qs||n=c!fM Mwq!!objcbt|ttttfr|St|t r3|j Dcic]\}}||j|c}}St|tr|Dcgc]}|j|c}S|j|Scc}}wcc}w)z Recursively converts an object so that it can be JSON serialized via :func:`json.dumps` and :func:`json.dump`, without actually calling said functions. ) rrintfloatboolr itemsmake_serializabler r!r"r&kvs r$r,z'FilesystemJSONEncoder.make_serializable s cCeT2 3J c7 #=@YY[ITQAt--a00I I c8 $7:;!D**1-; ;||C  J;s B&:B,) rr __qualname__rrr*__annotations__rr!r, __classcell__r#s@r$rrs8'+htn+""" !S !S !r%rc&eZdZddddddddeeeeefgefdeeegefdeeegefdeeegefded eee e eefgefd dffd Z e d eeeffd Z e d eeeffdZd eeeffdZded efdZxZS)FilesystemJSONDecoderNT object_hook parse_float parse_intparse_constantstrictobject_pairs_hookr7r8r9r:r;r<rcR||_t| |j|||||y)Nr6)original_object_hookr __init__custom_object_hook)r"r7r8r9r:r;r<r#s r$r?zFilesystemJSONDecoder.__init__1s7%0! //#)/  r%dctctt5|d}t|}t|tr |cdddS dddy#1swYyxYw)Nr)r Exceptionr issubclassr)rrAfqppath_clss r$try_resolve_path_clsz*FilesystemJSONDecoder.try_resolve_path_clsFsS i  e*C$S)H(H-   .   s "AActt5d|vr+ t|d}t|tr |cdddS dddy#t$rd|vrt |dcYcdddSwxYw#1swYyxYw)Nrprotocol)rrCrrDrr)rrAfs_clss r$try_resolve_fs_clsz(FilesystemJSONDecoder.try_resolve_fs_clsRs i |*3u:6F!&*<=%  >  !!S(3C ODD    s-A4A A4 A1$A4/A11A44A=cd|vrF|j|x}tj|S|j|x} ||dS|j|j |S|S)Nrr)rKr from_dictrGr>)r"rAobj_clss r$r@z(FilesystemJSONDecoder.custom_object_hookbsw C<22377D)33C8844S99Fs5z**  $ $ 0,,S1 1 r%r&cNt|tr|j|}t|tr3|jDcic]\}}||j |c}}St|t t fr|Dcgc]}|j |c}S|Scc}}wcc}w)zV Inverse function of :meth:`FilesystemJSONEncoder.make_serializable`. )rdictr@r+unmake_serializablelisttupler-s r$rQz)FilesystemJSONDecoder.unmake_serializablens c4 ))#.C c4 ?Byy{Ktq!At//22K K cD%= )9<=AD,,Q/= = L=s B?B")rrr0r rrrrr*r r r? classmethodrGrKr@rQr2r3s@r$r5r50s:BF6:489=NR hS#X'7'<=> hucz23  HcUCZ01  !3%*!56   $Hd5c?.C-Dc-I$JK   * tCH~   T#s(^   d38n  s s r%r5)json contextlibrpathlibrtypingrrrrr r r r r registryrrspecr JSONEncoderr JSONDecoderr5r%r$r^sK    :$!D,,!8ID,,Ir%