+
    üÐj‚  ã                   óˆ   € R t ^ RIHt ^ RIHt ^ RIHtHtHt ^RI	H
t
 ]! 4       t ! R R4      tR R ltR	 R
 ltR R ltR# )z¡
Code related to "flattening" events; that is, extracting a description of all
relevant fields from the format string and persisting them for later
examination.
)Údefaultdict)Ú	Formatter)ÚAnyÚDictÚOptional©ÚLogEventc                   óH   a € ] tR t^t o RtV 3R lR ltV 3R lR ltRtV tR# )ÚKeyFlattenerz�
A L{KeyFlattener} computes keys for the things within curly braces in
PEP-3101-style format strings as parsed by L{string.Formatter.parse}.
c                ó   <€ V ^8„  d   QhRR/# )é   ÚreturnN© )ÚformatÚ__classdict__s   "€Ú9/usr/lib/python3/dist-packages/twisted/logger/_flatten.pyÚ__annotate__ÚKeyFlattener.__annotate__   s   ø€ ÷ ;ñ ;˜$ñ ;ó    c                ó(   € \        R 4      V n        R# )z
Initialize a L{KeyFlattener}.
c                  ó   € ^ # )é    r   r   r   r   Ú<lambda>Ú'KeyFlattener.__init__.<locals>.<lambda>   s   € ¹r   N)r   Úkeys)Úselfs   &r   Ú__init__ÚKeyFlattener.__init__   s   € ô %0±	Ó$:ˆŽ	r   c                óR   <€ V ^8„  d   QhRS[ RS[S[ ,          RS[S[ ,          RS[ /# )r   Ú	fieldNameÚ
formatSpecÚ
conversionr   )Ústrr   )r   r   s   "€r   r   r       s5   ø€ ÷ ñ ÙðÙ*2±3­-ðÙEMÉcÅ]ðá	ñr   c                ó  € Vf   RpVf   RpRP                  VVVR7      pV P                  V;;,          ^,          uu&   V P                  V,          pV^8w  d+   VR\        V P                  V,          4      ,           ,          pV# )aZ  
Compute a string key for a given field/format/conversion.

@param fieldName: A format field name.
@param formatSpec: A format spec.
@param conversion: A format field conversion type.

@return: A key specific to the given field, format and conversion, as
    well as the occurrence of that combination within this
    L{KeyFlattener}'s lifetime.
Ú z%{fieldName}!{conversion}:{formatSpec})r   r    r!   Ú/)r   r   r"   )r   r   r    r!   ÚresultÚns   &&&&  r   ÚflatKeyÚKeyFlattener.flatKey    s†   € ð ÒØˆJàÒØˆJà8×?Ñ?ØØ!Ø!ð @ó 
ˆð
 	�	‰	�&×˜QÕÓØ�I‰I�fÕˆØ�Œ6Ø�cœC §	¡	¨&Õ 1Ó2Õ2Õ2ˆFØˆr   )r   N)	Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r(   Ú__static_attributes__Ú__classdictcell__)r   s   @r   r
   r
      s   ø‡ € ñ÷
;ð ;÷ö r   r
   c                ó(   € V ^8„  d   QhR\         RR/# )r   Úeventr   Nr   )r   s   "r   r   r   @   s   € ÷ 8(ñ 8(œð 8( Tñ 8(r   c                ó2  € V P                  RR4      f   R# RV 9   d   V R,          pM/ p\        4       p\        P                  V R,          4       Fµ  w  r4rVVf   K  VR8w  d   RpVP	                  WEV4      pVP	                  WER4      pWq9   d   KA  VP                  R4      '       d	   VRR
 pRp	MR	p	\        P                  VRV 4      p
V
^ ,          pVR8X  d   \        pM\        pV	'       d   V! 4       pV! V4      pWÑV&   W±V&   K·  	  V'       d   WR&   R# R# )zÄ
Flatten the given event by pre-associating format fields with specific
objects and callable results in a L{dict} put into the C{"log_flattened"}
key in the event.

@param event: A logging event.
Ú
log_formatNÚlog_flattenedÚrÚsr$   z()TFéþÿÿÿr   )	Úgetr
   Ú
aFormatterÚparser(   ÚendswithÚ	get_fieldÚreprr"   )r2   ÚfieldsÚkeyFlattenerÚliteralTextr   r    r!   ÚflattenedKeyÚstructuredKeyÚcallitÚfieldÚ
fieldValueÚconversionFunctionÚflattenedValues   &             r   ÚflattenEventrI   @   s,  € ð ‡y�y�˜tÓ$Ò,Ùà˜%ÔØ�Õ'‰àˆä“>€Lä:D×:JÑ:JØˆlÕö;Ñ6ˆ 
ð ÒÙà˜ÔØˆJà#×+Ñ+¨IÀ:ÓNˆØ$×,Ñ,¨YÀBÓGˆàÔ!áà×Ñ˜d×#Ò#Ø! # 2˜ˆIØ‰FàˆFä×$Ñ$ Y°°EÓ:ˆØ˜1•Xˆ
à˜ÔÜ!%Ñä!$ÐçÙ#›ˆJá+¨JÓ7ˆØ-ˆ|ÑØ *ˆ}ÓñG;÷J Ø!'ˆoÓñ r   c                ó<   € V ^8„  d   QhR\         R\        R\        /# )r   rE   r2   r   )r"   r   r   )r   s   "r   r   r   {   s!   € ÷ 'ñ 'œð '¤Hð '´ñ 'r   c                óÚ   € \        4       p\        P                  RV ,           R,           4      w  w  r4rVVf   Q hVP                  WEV4      pRV9  d   \	        V4       VR,          V,          # )a  
Extract a given format field from the given event.

@param field: A string describing a format field or log key.  This is the
    text that would normally fall between a pair of curly braces in a
    format string: for example, C{"key[2].attribute"}.  If a conversion is
    specified (the thing after the C{"!"} character in a format field) then
    the result will always be str.
@param event: A log event.

@return: A value extracted from the field.

@raise KeyError: if the field is not found in the given event.
Ú{Ú}r5   )r
   r:   r;   r(   rI   )rE   r2   r@   rA   r   r    r!   Úkeys   &&      r   ÚextractFieldrO   {   so   € ô  “>€Lä9C×9IÑ9IØˆe��cÕó:Ñ6Ñ5€k˜jð Ò Ð Ð à
×
Ñ
˜y°jÓ
A€Cà˜eÔ#Ü�UÔà�Õ! #Õ&Ð&r   c                ó0   € V ^8„  d   QhR\         R\        /# )r   r2   r   )r   r"   )r   s   "r   r   r   š   s   € ÷ ñ ”hð ¤3ñ r   c                ó@  € V R,          p\        4       p. p\        P                  V R,          4       FY  w  rErgVP                  V4       Vf   K  TP	                  YVT;'       g    R4      pVP                  \        W,          4      4       K[  	  RP                  V4      # )z~
Format an event which has been flattened with L{flattenEvent}.

@param event: A logging event.

@return: A formatted string.
r5   r4   r7   r$   )r
   r:   r;   Úappendr(   r"   Újoin)	r2   ÚfieldValuesr@   r7   rA   r   r    r!   rN   s	   &        r   Ú
flatFormatrU   š   sŽ   € ð ˜Õ(€KÜ“>€LØ
€Aä:D×:JÑ:JØˆlÕö;Ñ6ˆ 
ð 	
�‰�ÔàÔ Ø×&Ñ& y¸j×>OÐ>OÈCÓPˆCØ�H‰H”S˜Õ)Ó*Ö+ñ;ð �7‰7�1‹:Ðr   N)r.   Úcollectionsr   Ústringr   Útypingr   r   r   Ú_interfacesr   r:   r
   rI   rO   rU   r   r   r   Ú<module>rZ      s=   ðñ
õ $Ý ß &Ñ &å !á‹[€
÷)ñ )õX8(õv'÷>r   