+
    üÐjÚ   ã            
       ó¬  € R t ^ RIHtHt ^ RIHtHtHtHtH	t	H
t
HtHt ^ RIHt ^ RIHt ^ RIHt ^RIHt ^RIHt ^RIHt ^R	IHt ^R
IHt ]! 4       t]]]3,          tR R lt R R lt!R ]! R4      R R 3R ]! R4      ] ]!3.t"]" U UUUu/ uF  w  rr#WbK
  	  upppp t#R R lt$R R lt%R R lt&R R lt'R"R R llt(R#R  R! llt)R# u upppp i )$zA
Tools for saving and loading log events in a structured format.
)ÚdumpsÚloads)ÚIOÚAnyÚAnyStrÚDictÚIterableÚOptionalÚUnionÚcast)ÚUUID)ÚNamedConstant)ÚFailure©ÚFileLogObserver)ÚflattenEvent)ÚLogEvent)ÚLogLevel)ÚLoggerc                ó0   € V ^8„  d   QhR\         R\        /# )é   ÚfailureÚreturn)r   ÚJSONDict)Úformats   "Ú6/usr/lib/python3/dist-packages/twisted/logger/_json.pyÚ__annotate__r      s   € ÷ ñ œ7ð ¤xñ ó    c                óž   € \        V P                  4       \        V P                  P                  V P                  P                  R7      R7      # )zÂ
Convert a failure to a JSON-serializable data structure.

@param failure: A failure to serialize.

@return: a mapping of strings to ... stuff, mostly reminiscent of
    L{Failure.__getstate__}
)Ú
__module__Ú__name__)Útype)ÚdictÚ__getstate__r!   r   r    )r   s   &r   ÚfailureAsJSONr$      s?   € ô Ø×ÑÓÜØ—|‘|×.Ñ.Ø—\‘\×*Ñ*ô
ôð r   c                ó0   € V ^8„  d   QhR\         R\        /# )r   ÚfailureDictr   )r   r   )r   s   "r   r   r   .   s   € ÷ ñ ¤ð ¬gñ r   c                óœ   € \         P                  ! \         4      pV R,          p\        VR,          RV4      V R&   VP                  V 4       V# )z¸
Load a L{Failure} from a dictionary deserialized from JSON.

@param failureDict: a JSON-deserialized object like one previously returned
    by L{failureAsJSON}.

@return: L{Failure}
r!   r    © )r   Ú__new__r!   Ú__setstate__)r&   ÚfÚtypeInfos   &  r   ÚfailureFromJSONr-   .   sE   € ô 	�ŠœÓ €AØ˜6Õ"€HÜ˜x¨
Õ3°R¸ÓB€K�ÑØ‡N�N�;ÔØ€Hr   c                 ól   € \        V \        4      ;'       d    \        \        V P                  R 4      V J # ©N)Ú
isinstancer   Úgetattrr   Úname©Úlevels   &r   Ú<lambda>r5   @   s0   € Ü�uœmÓ,÷ =ð =Üœ %§*¡*¨dÓ3°uÐ<ð=r   z$02E59486-F24D-46AD-8224-3ACDF2A5732Ac                 ó.   € \        V P                  R 7      # ))r2   )r"   r2   r3   s   &r   r5   r5   E   s   € ”d §
¡
Õ+r   c                 ó2   € \        \        V R ,          R4      # )r2   N)r1   r   r3   s   &r   r5   r5   F   s   € ”gœh¨¨f­°tÔ<r   c                 ó"   € \        V \        4      # r/   )r0   r   )Úos   &r   r5   r5   I   s   € ”*˜Q¤Ô(r   z$E76887E2-20ED-49BF-A8F8-BA25CC586F2Dc                ó0   € V ^8„  d   QhR\         R\        /# )r   ÚaDictr   )r   Úobject)r   s   "r   r   r   T   s   € ÷ ñ œ(ð ¤vñ r   c                óZ   € RV 9   d$   \         \        V R,          4      ,          ! V 4      # V # )a  
Dictionary-to-object-translation hook for certain value types used within
the logging system.

@see: the C{object_hook} parameter to L{json.load}

@param aDict: A dictionary loaded from a JSON object.

@return: C{aDict} itself, or the object represented by C{aDict}
Ú__class_uuid__)ÚuuidToLoaderr   )r;   s   &r   ÚobjectLoadHookr@   T   s,   € ð ˜5Ô ÜœD Ð'7Õ!8Ó9Ö:¸5ÓAÐAØ€Lr   c                ó0   € V ^8„  d   QhR\         R\        /# )r   ÚpythonObjectr   )r<   r   )r   s   "r   r   r   d   s   € ÷ #ñ #¤ð #¬Hñ #r   c                óz   € \          F.  w  rr4V! V 4      '       g   K  V! V 4      p\        V4      VR&   Vu # 	  RR/# )am  
Object-to-serializable hook for certain value types used within the logging
system.

@see: the C{default} parameter to L{json.dump}

@param pythonObject: Any object.

@return: If the object is one of the special types the logging system
    supports, a specially-formatted dictionary; otherwise, a marker
    dictionary indicating that it could not be serialized.
r>   ÚunpersistableT)Ú	classInfoÚstr)rB   Ú	predicateÚuuidÚsaverÚloaderÚresults   &     r   ÚobjectSaveHookrL   d   sI   € ÷ +4Ñ&ˆ	˜Ù�\×"Ô"Ù˜<Ó(ˆFÜ'*¨4£yˆFÐ#Ñ$ØŠMñ	 +4ð
 ˜TÐ"Ð"r   c                ó0   € V ^8„  d   QhR\         R\        /# )r   Úeventr   )r   rF   )r   s   "r   r   r   y   s   € ÷ 8ñ 8”xð 8¤Cñ 8r   c                ó>   € R R lp\        V 4       \        WRR7      # )at  
Encode an event as JSON, flattening it if necessary to preserve as much
structure as possible.

Not all structure from the log event will be preserved when it is
serialized.

@param event: A log event dictionary.

@return: A string of the serialized JSON; note that this will contain no
    newline characters, and may thus safely be stored in a line-delimited
    file.
c                óR   € V ^8„  d   QhR\         R\        \        \        3,          /# )r   Úunencodabler   )r<   r
   r   rF   )r   s   "r   r   Ú!eventAsJSON.<locals>.__annotate__ˆ   s#   € ÷ 
+ñ 
+œVð 
+¬¬h¼¨mÕ(<ñ 
+r   c                óf   € \        V \        4      '       d   V P                  R4      # \        V 4      # )zŽ
Serialize an object not otherwise serializable by L{dumps}.

@param unencodable: An unencodable object.

@return: C{unencodable}, serialized
Úcharmap)r0   ÚbytesÚdecoderL   )rQ   s   &r   ÚdefaultÚeventAsJSON.<locals>.defaultˆ   s-   € ô �k¤5×)Ò)Ø×%Ñ% iÓ0Ð0Ü˜kÓ*Ð*r   T)rW   Úskipkeys)r   r   )rN   rW   s   & r   ÚeventAsJSONrZ   y   s   € õ
+ô �ÔÜ�°$Ô7Ð7r   c                ó0   € V ^8„  d   QhR\         R\        /# )r   Ú	eventTextr   )rF   r   )r   s   "r   r   r   ˜   s   € ÷ Hñ HœSð H¤Xñ Hr   c                ó@   € \        \        \        V \        R7      4      # )z–
Decode a log event from JSON.

@param eventText: The output of a previous call to L{eventAsJSON}

@return: A reconstructed version of the log event.
)Úobject_hook)r   r   r   r@   )r\   s   &r   ÚeventFromJSONr_   ˜   s   € ô ”œ% 	´~ÔFÓGÐGr   c                óR   € V ^8„  d   QhR\         \        ,          R\        R\        /# )r   ÚoutFileÚrecordSeparatorr   )r   r   rF   r   )r   s   "r   r   r   £   s(   € ÷ ñ Ü”�WðÜ'*ðäñr   c                ó$   a€ \        V V3R l4      # )a›  
Create a L{FileLogObserver} that emits JSON-serialized events to a
specified (writable) file-like object.

Events are written in the following form::

    RS + JSON + NL

C{JSON} is the serialized event, which is JSON text.  C{NL} is a newline
(C{"\n"}).  C{RS} is a record separator.  By default, this is a single
RS character (C{"\x1e"}), which makes the default output conform to the
IETF draft document "draft-ietf-json-text-sequence-13".

@param outFile: A file-like object.  Ideally one should be passed which
    accepts L{str} data.  Otherwise, UTF-8 L{bytes} will be used.
@param recordSeparator: The record separator to use.

@return: A file log observer.
c                 ó$   <€ S \        V 4       R 2# )Ú
)rZ   )rN   rb   s   &€r   r5   Ú%jsonFileLogObserver.<locals>.<lambda>º   s   ø€  /Ð!2´;¸uÓ3EÐ2FÀbÑIr   r   )ra   rb   s   &fr   ÚjsonFileLogObserverrg   £   s   ø€ ô, ØÔIóð r   Nc          	      óŠ   € V ^8„  d   QhR\         \        ,          R\        \        ,          R\        R\
        \        ,          /# )r   ÚinFilerb   Ú
bufferSizer   )r   r   r	   rF   Úintr   r   )r   s   "r   r   r   ¾   sC   € ÷ _ñ _ÜŒs�Gð_äœc•]ð_ô ð_ô ŒhÕñ	_r   c              #  óô  a"  € R R lpR R loVf%   V! V P                  ^4      4      pVR8X  d   TpMRpM
V! V4      pRpVR8X  d   RpSpM	R	 V3R
 llp\        V4      p V P                  V4      pV'       g#   \        V4      ^ 8”  d   V! V4      p	V	e   V	x € R# Ws! V4      ,          pVP                  V4      p
V
RR  F'  p\        V4      ^ 8”  g   K  V! V4      p	V	f   K#  V	x € K)  	  V
R,          pK–  5i)a!  
Load events from a file previously saved with L{jsonFileLogObserver}.
Event records that are truncated or otherwise unreadable are ignored.

@param inFile: A (readable) file-like object.  Data read from C{inFile}
    should be L{str} or UTF-8 L{bytes}.
@param recordSeparator: The expected record separator.
    If L{None}, attempt to automatically detect the record separator from
    one of C{"\x1e"} or C{""}.
@param bufferSize: The size of the read buffer used while reading from
    C{inFile}.

@return: Log events as read from C{inFile}.
c                ó0   € V ^8„  d   QhR\         R\        /# )r   Úsr   )r   rU   )r   s   "r   r   Ú+eventsFromJSONLogFile.<locals>.__annotate__Ò   s   € ÷ %ñ %”6ð %œeñ %r   c                 óT   € \        V \        4      '       d   V # V P                  R 4      # )úutf-8)r0   rU   Úencode)rn   s   &r   ÚasBytesÚ&eventsFromJSONLogFile.<locals>.asBytesÒ   s#   € Ü�aœ×ÒØˆHà—8‘8˜GÓ$Ð$r   c                óF   € V ^8„  d   QhR\         R\        \        ,          /# ©r   Úrecordr   ©Ú	bytearrayr	   r   )r   s   "r   r   ro   Ø   s   € ÷ ñ ¤9ð ´¼(Õ1Cñ r   c                 ó  €  \        V 4      P                  R 4      p \        T4      #   \         d%    \        P	                  R\        T 4      R7        R# i ; i  \         d%    \        P	                  R\        T 4      R7        R# i ; i)rq   z2Unable to decode UTF-8 for JSON record: {record!r}©rw   Nz&Unable to read JSON record: {record!r})rU   rV   ÚUnicodeDecodeErrorÚlogÚerrorr_   Ú
ValueError)rw   Útexts   & r   ÚeventFromBytearrayÚ1eventsFromJSONLogFile.<locals>.eventFromBytearrayØ   s„   € ð	Ü˜“=×'Ñ'¨Ó0ˆDð	Ü  Ó&Ð&øô "ô 	Ü�I‰IØDÜ˜V“}ð ô ò ð	ûô ô 	Ü�I‰IÐ>ÄuÈVÃ}ˆIÔUÚð	ús    ‚( �
A ¨+AÁAÁ+B	ÂB	Nó   r   ó   
c                óF   € V ^8„  d   QhR\         R\        \        ,          /# rv   rx   )r   s   "r   r   ro   þ   s   € ÷ 	ñ 	¤Ið 	´(¼8Õ2Dñ 	r   c                 ó†   <€ V R,          \        R4      8X  d	   S! V 4      # \        P                  R\        V 4      R7       R# )é   re   z0Unable to read truncated JSON record: {record!r}r{   Néÿÿÿÿ)Úordr}   r~   rU   )rw   r�   s   &€r   ÚeventFromRecordÚ.eventsFromJSONLogFile.<locals>.eventFromRecordþ   s>   ø€ Ø�b�zœS ›YÔ&Ù)¨&Ó1Ð1ä—	‘	ØFÜ  ›=ð ô ñ r   rˆ   )Úreadry   ÚlenÚsplit)ri   rb   rj   rs   ÚfirstÚrecordSeparatorBytesrŠ   ÚbufferÚnewDatarN   Úrecordsrw   r�   s   &&&         @r   ÚeventsFromJSONLogFiler”   ¾   s  øé € õ(%õð  ÒÙ˜Ÿ™ A›Ó'ˆà�GÔà#(Ñ ð $'Ñ ñ  ' Ó7ÐØˆà˜sÔ"Ø$Ðà,‰÷	ð 	ô �uÓ€Fà
Ø—+‘+˜jÓ)ˆçÜ�6‹{˜QŒÙ'¨Ó/�ØÒ$Ø’KÙà�'˜'Ó"Õ"ˆØ—,‘,Ð3Ó4ˆà˜c˜r“lˆFÜ�6‹{˜QŽÙ'¨Ó/�ØÔ$Ø”Kñ	 #ð ˜•Šùs   ƒA8C8Á<AC8Ã	C8Ã%C8)Ú)Ni   )*Ú__doc__Újsonr   r   Útypingr   r   r   r   r   r	   r
   r   rH   r   Ú
constantlyr   Útwisted.python.failurer   Ú_filer   Ú_flattenr   Ú_interfacesr   Ú_levelsr   Ú_loggerr   r}   rF   r   r$   r-   rE   r?   r@   rL   rZ   r_   rg   r”   )rG   rH   rI   rJ   s   0000r   Ú<module>r       s×   ðñ
÷ ß I× IÓ IÝ å $å *Ý "Ý "Ý !Ý Ý áƒh€ð ��S��>€õõ$ñ$	
ñ 	Ð3Ó4Ù+Ù<ðñ 	)ÙÐ3Ó4ØØð	ð€	ñ& FOÖOÁYÑ!A )°5�’ÁYÔO€õõ #õ*8õ>H÷÷6_ñ _ùõ[ Ps   ÂC
