+
    oFj                       a  R^ t40 t R t^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	t^ RI
t^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIHtHtHt ^ RIHt RtRtRt ! R R]4      t ! R	 R
]4      t ! R R]4      tR R lt R R lt!R R lt"R R lt#R R lt$R R lt%R R lt&R t'R R lt(R R lt)]PT                   ! R  R!4      4       t+ ! R" R#4      t,]-]+,          ],,          ].,          ]/,          t0] ^ k 0 R$kR%kR&kR'kR(kR)kR*kR+kR,kR-kR.kR/kR0kR1kR2kR3kR4kR5kR6kR7kR8kR9kR:kR;kR<kR=kR>kR?kR@kRAkRBkRCkRDkREkRFkRGkRHkRIkRJkRKkRLkRMkRNkROkRPkRQkRRkRSkRTkRUkRVkRWkRXkRYkRZkR[kt1 ! R\ R]]Pd                  4      t3R# )_z(Store, load, and handle problem reports.N)	GeneratorIterableIterator)	TypeAliasi   s   s   (/c                   B   a a ] tR t^'t oRtV3R lV 3R lltRtVtV ;t# )MalformedProblemReportzRaised when a problem report violates the crash report format.

This exception might be raised when the keys of the report are not ASCII.
c                &   < V ^8  d   QhRS[ RS[/# )   messageargs)strobject)format__classdict__s   "0/usr/lib/python3/dist-packages/problem_report.py__annotate__#MalformedProblemReport.__annotate__-   s     
 
 
F 
    c                4   < \         SV `  ! R V R2.VO5!   R# )zMalformed problem report: z$. Is this a proper .crash text file?N)super__init__)selfr
   r   	__class__s   &&*r   r   MalformedProblemReport.__init__-   s+    (	 22 3	
 	
r    )	__name__
__module____qualname____firstlineno____doc__r   __static_attributes____classdictcell____classcell__r   r   s   @@r   r   r   '   s     

 
 
r   r   c                       ] tR t^5tRtRtR# )_SizeLimitExceededz>Raised internally to signal a value that is too big to encode.r   N)r   r   r   r   r   r    r   r   r   r%   r%   5   s    Hr   r%   c                   Z   a  ] tR t^9t o RtV 3R lR ltV 3R lR ltV 3R lR ltRtV t	R	# )
_EntryParserzIterator over entries in RFC822 formatted files.

This iterator reads ahead one line to determine the boundaries between
the entries. Each returned entry is a line-based iterator.
c                4   < V ^8  d   QhRS[ S[,          RR/# )r	   iteratorreturnNr   bytes)r   r   s   "r   r   _EntryParser.__annotate__@   s      % T r   c                .    Wn         R V n        RV n        R # )NT)r)   	next_line
entry_read)r   r)   s   &&r   r   _EntryParser.__init__@   s     '+r   c                0   < V ^8  d   QhRS[ S[,          /# r	   r*   r+   )r   r   s   "r   r   r-   E   s       r   c              #     "   V P                   '       g   Q hV P                   x  RV n         V P                   F&  pVP                  R4      '       d   Vx  K   Wn          M	  RV n        R# 5i)z$Iterate over all lines of one entry.N    T)r/   r)   
startswithr0   )r   lines   & r   entry_iterator_EntryParser.entry_iteratorE   sW     ~~~~nnMMDt$$
!% " s   A)A+c                0   < V ^8  d   QhRS[ S[,          /# r3   r+   )r   r   s   "r   r   r-   R   s     % %(5/ %r   c                    V P                   '       g   V P                  4        F  pK  	  V P                  '       g   \        V P                  4      V n        R V n         V P                  4       # F)r0   r8   r/   nextr)   )r   _s   & r   __next___EntryParser.__next__R   sP    ((* +~~~!$--0DN""$$r   )r0   r)   r/   N)
r   r   r   r   r   r   r8   r?   r    r!   r   s   @r   r'   r'   9   s(      
 % %r   r'   c                <    V ^8  d   QhR\         R\         R\         /# )r	   filename	extensionr*   r   )r   s   "r   r   r   \   s!     $ $ $ $ $r   c                 @    V P                  V4      '       d   V # V  V 2# N)endswith)rC   rD   s   &&r   _add_extension_if_missingrI   \   s'    ##Z	{##r   c                \    V ^8  d   QhR\         \        ,          R\        \        ,          /# r	   entryr*   )r   r,   r   )r   s   "r   r   r   b   s"     ? ?8E? ?x ?r   c              #      "   V  F  p \         P                  ! V4      x  K  	  R #   \        P                   d   p\	        \        T4      4      R hR p?ii ; i5irG   )base64	b64decodebinasciiErrorr   r   )rL   r7   errors   &  r   _base64_decoderrS   b   sK     	?""4((  ~~ 	?(U4$>	?s$   A'AAAAAc                x    V ^8  d   QhR\         R\        R\        P                  P                  P
                  /# r	   namevaluer*   )r   r,   emailmimebaseMIMEBase)r   s   "r   r   r   j   s/       E ejjoo>V>V r   c                    \        W4      w  r#\        W4      p\        P                  P                  P                  R V4      pVP                  RRVR7       VP                  V4       \        P                  P                  V4       V# )applicationContent-Disposition
attachmentrC   )
_derive_compressionrI   rX   rY   rZ   r[   
add_headerset_payloadencodersencode_base64)rV   rW   mime_subtyperD   rC   r_   s   &&    r   _create_compressed_attachmentrg   j   so    1$>L(9H))-FJ/Q5!	NN  ,r   c                x    V ^8  d   QhR\         R\         R\        P                  P                  P                  /# rU   )r   rX   rY   rZ   r[   )r   s   "r   r   r   t   s/      # c ejjoo6N6N r   c                     \        V R 4      p\        P                  P                  P	                  VRR7      pVP                  RRVR7       V# )z.txtUTF-8_charsetr^   r_   r`   )rI   rX   rY   textMIMETextrb   )rV   rW   rC   r_   s   &&  r   _create_text_attachmentro   t   sG    (v6H))%')BJ/Qr   c                ^    V ^8  d   QhR\         R\        R\        \         \         3,          /# rU   )r   r,   tuple)r   s   "r   r   r   {   s)     8 8c 8% 8E#s(O 8r   c                     VP                  \        4      '       d   R# VP                  \        4      '       d   R# \        RV  24      h)gzipzUnknown compression for )rs   .gz)zstdz.zst)r6   GZIP_HEADER_STARTZSTANDARD_MAGIC_NUMBER
ValueError)rV   rW   s   &&r   ra   ra   {   sE    )**.//
/v6
77r   c                0    V ^8  d   QhR\         R\         /# )r	   r7   r*   r,   )r   s   "r   r   r      s      U u r   c                Z   V ^,          p^
pV^,          '       d   W V,          ^,           ,          pV^,          '       d"   W,          ^ 8w  d   V^,          pK  V^,          pV^,          '       d"   W,          ^ 8w  d   V^,          pK  V^,          pV^,          '       d
   V^,          pWR # )z0Strip gzip header from line and return the rest.Nr   )r7   flagsoffsets   &  r   _strip_gzip_headerr~      s    GEFqyyv,""qyylaaKF!rzzlaaKF!qyy!=r   c                h    V ^8  d   QhR\         \        ,          R\        R\         \        ,          /# )r	   rL   
first_liner*   r+   )r   s   "r   r   r      s)     $ $% $e $ $r   c              #   .  "   VP                  4       pVx  \        V4      pV  Fk  pV^ 8  d   Rx  VP                  R4      '       d#   V^R x  V\        V4      ^,
          ,          pKG  VR,          x  V\        V4      ^,
          ,          pKm  	  R# 5i)       
:   NNN)striplenrH   )rL   r   r7   lengths   &&  r   _text_decoderr      s     D
JYFA:K==q*c$i!m#Fr(Nc$i!m#F s   AB	ABc                  r     ^ RI p V P                  4       #   \         d   p\        RT R24      RhRp?ii ; i)r   Nz$Failed to import zstandard library: z#. Please install python3-zstandard.)	zstandardImportErrorRuntimeErrorZstdDecompressor)r   rR   s     r   _get_zstandard_decompressorr      sP     %%''  25' :1 2
 	s    616c                h    V ^8  d   QhR\         \        ,          R\        R\         \        ,          /# )r	   rL   first_blockr*   r+   )r   s   "r   r   r      s)     - -huo -E -huo -r   c              #      "   \        4       P                  4       pVP                  V4      x  V  F  pVP                  V4      x  K  	  R # 5irG   )r   decompressobj
decompress)rL   r   decompressorblocks   &&  r   _zstandard_decoderr      sB     .0>>@L

!
!+
..%%e,, s   A
Ac                    V ^8  d   QhR\         \        ,          R\        \        \         \        ,          \        3,          /# rK   )r   r,   rq   r   bool)r   s   "r   r   r      s.     / / /E#x2L,M /r   c                   \        V 4      p VP                  R^4      w  r# TP	                  R4      pTP                  4       R8H  pT'       d   \        T 4      pM\        Y4      pYGT3#   \         d#    \        RTP	                  RR7      : R24      Rhi ; i  \
         d   p\        \        T4      4      RhRp?ii ; i)	zParse the given entry and return key and value.

Return the key and a line iterator over the value. Also return a
boolean if the entry is base64 encoded (i.e. is a binary value).
   :zLine backslashreplace)errorsz? does not contain a colon for separating the key from the valueNASCIIs   base64)
r=   splitrx   r   decodeUnicodeDecodeErrorr   r   rS   r   )rL   r   key_in_bytesfirst_line_valuekeyrR   base64_encodedvalue_iterators   &       r   _parse_entryr      s     eJ)3)9)9$)B&;!!'* &++-:N(/&u?..%  $J%%-?%@C&'
 		  ;$SZ0d:;s"   A) B )-BB>$B99B>c                   l   a  ] tR t^t o RtV 3R lR ltR tV 3R lR ltV 3R lR ltV 3R	 lt	R
t
V tR# )CompressedFilezRepresents a ProblemReport value which points to a compressed file.

The file is expected to be compressed with gzip or zstandard.
c                $   < V ^8  d   QhRS[ RR/# )r	   rC   r*   NrE   )r   r   s   "r   r   CompressedFile.__annotate__   s     : : : :r   c                H    Wn         \        V P                   R 4      V n        R# )rbN)rC   open_compressed_file)r   rC   s   &&r   r   CompressedFile.__init__   s      $T]]D 9r   c                b    \        V R 4      '       d   V P                  P                  4        R# R# )r   N)hasattrr   closer   s   &r   __del__CompressedFile.__del__   s'    4+,,!!'') -r   c                0   < V ^8  d   QhRS[ S[,          /# r3   r+   )r   r   s   "r   r   r      s      % r   c              #  j   "    V P                   P                  \        4      pV'       g   R# Vx  K0  5i)z:Iterate over the compressed content of the file in chunks.N)r   read
CHUNK_SIZE)r   r   s   & r   iter_compressedCompressedFile.iter_compressed   s)     ))..z:EKs   (33c                    < V ^8  d   QhRS[ /# r3   r   )r   r   s   "r   r   r      s     E ET Er   c                d    \         P                  ! V P                  \         P                  RR7      # )z?Check if the compressed file is readable by the effective user.T)effective_ids)osaccessrC   R_OKr   s   &r   is_readableCompressedFile.is_readable   s    yytDDr   c                &   < V ^8  d   Qh/ S[ ;R&   # )r	   rC   rE   )r   r   s   "r   r   r      s      M r   )r   rC   N)r   r   r   r   r   r   r   r   r   __annotate_func__r    r!   rA   s   @r   r   r      s6     : :
* E E5  r   r   c                      a  ] tR t^t o RtRV 3R lR lltV 3R lR ltV 3R lR ltV 3R	 lR
 lt]	V 3R lR l4       t
V 3R lR ltV 3R lR lt]3V 3R lR lltV 3R lR ltV 3R lR ltRtV tR# )CompressedValuezRepresent a ProblemReport value which is gzip or zstandard compressed.

By default, compressed values are in gzip format. Earlier versions of
problem_report used zlib format (without gzip header).
Nc                Z   < V ^8  d   QhRS[ R,          RS[R,          RS[ R,          RR/# )r	   rW   NrV   compressed_valuer*   )r,   r   )r   r   s   "r   r   CompressedValue.__annotate__   s?     
" 
"t|
" Dj
"  $,	
"
 

"r   c                T    W0n         W n        V'       d   V P                  V4       R# R# )zAInitialize an empty CompressedValue object with an optional name.N)r   rV   	set_value)r   rW   rV   r   s   &&&&r   r   CompressedValue.__init__   s#     !1	NN5! r   c                $   < V ^8  d   QhRS[ RR/# )r	   rW   r*   Nrz   )r   r   s   "r   r   r   	  s     / /u / /r   c                   \         P                  ! 4       p\        P                  ! V P                  RV^ R7      ;_uu_ 4       pVP                  V4       RRR4       VP                  4       V n        R#   + '       g   i     L'; i)zSet uncompressed value.wbmodefileobjmtimeN)ioBytesIOrs   GzipFilerV   writegetvaluer   )r   rW   outgzs   &&  r   r   CompressedValue.set_value	  sQ    jjl]]4994AFF"HHUO G # GFs   A33B	c                    < V ^8  d   QhRS[ /# r3   int)r   r   s   "r   r   r     s     * *S *r   c                L    V P                   f   Q h\        V P                   4      # )z=Return size of the compressed (but not base64 encoded) value.)r   r   r   s   &r   get_compressed_size#CompressedValue.get_compressed_size  s%    $$0004(())r   c                    < V ^8  d   QhRS[ /# r3   r   )r   r   s   "r   r   r     s     ; ;# ;r   c                L    V P                  4       ^,           ^,          ^,          # )zReturn the size needed on disk to store the compressed value.

The compressed value will be base64 encoded when written to disk
which adds an overhead of 1/3 plus up to 2 bytes of padding. Additional
spaces and newlines are ignored in this calculation.
)r   r   s   &r   get_on_disk_size CompressedValue.get_on_disk_size  s"     ))+a/A5::r   c                F   < V ^8  d   QhRS[ S[,          RS[ S[,          /# rK   r+   )r   r   s   "r   r   r     s#     # # #HUO #r   c              #    "   \        V R4      pVf   R# VP                  \        4      '       d   \        W4       Rj  xL
  R# VP                  \        4      '       dC   \
        P                  ! \
        P                  ) 4      pVP                  \        V4      4      x  M(\
        P                  ! 4       pVP                  V4      x  V  F  pVP                  V4      x  K  	  VP                  4       x  R#  L5i)z5Decode the given compressed value (iterator version).N)r=   r6   rw   r   rv   zlibr   	MAX_WBITSr   r~   flush)rL   r   r   s   &  r   decode_compressed_stream(CompressedValue.decode_compressed_stream  s      UD!=233)%777-..--t~~o>L))*<U*CDD  --/L))%00E))%00   "" 8s   -C<C<C: C< BC<c                    < V ^8  d   QhRS[ /# r3   rz   )r   r   s   "r   r   r   4  s     	6 	65 	6r   c                |   V P                   f   Q hV P                   P                  \        4      '       d$   \        4       P	                  V P                   4      # V P                   P                  \
        4      '       d!   \        P                  ! V P                   4      # \        P                  ! V P                   4      # )zReturn uncompressed value.)r   r6   rw   r   r   rv   rs   r   r   s   &r   	get_valueCompressedValue.get_value4  s    $$000  ++,BCC.0;;D<Q<QRR  ++,=>>??4#8#899t4455r   c                H   < V ^8  d   QhRS[ P                  S[,          RR/# r	   filer*   N)typingIOr,   )r   r   s   "r   r   r   ?  s$     ; ;&))E* ;t ;r   c                   V P                   '       g   Q hV P                   P                  \        4      '       d=   \        4       pVP	                  \
        P                  ! V P                   4      V4       R# V P                   P                  \        4      '       d|   \        P                  ! \
        P                  ! V P                   4      R7      ;_uu_ 4       p VP                  \        4      pV'       g   MVP                  V4       K2   RRR4       R# VP                  \        P                  ! V P                   4      4       R#   + '       g   i     LA; i)z5Write uncompressed value into given file-like object.N)r   )r   r6   rw   r   copy_streamr   r   rv   rs   r   r   r   r   r   r   )r   r   r   r   r   s   &&   r   r   CompressedValue.write?  s    $$$$$  ++,BCC68L$$RZZ0E0E%FM  ++,=>>rzz$2G2G'HIIRGGJ/E JJu% JI 	

4??4#8#89: JIs   E7EE	c                6   < V ^8  d   QhRS[ RS[S[,          /# )r	   
chunk_sizer*   )r   r   r,   )r   r   s   "r   r   r   T  s     < <# <x <r   c              #     "   V P                   '       g   Q h\        ^ V P                  4       V4       F  pV P                   W"V,            x  K  	  R# 5i)z.Iterate over the compressed content in chunks.N)r   ranger   )r   r   is   && r   r   CompressedValue.iter_compressedT  sI     $$$$$q$224jAA''
N;; Bs   AAc                    < V ^8  d   QhRS[ /# r3   r   )r   r   s   "r   r   r   Z  s     
 
 
r   c                T   V P                   '       g   Q hV P                   P                  \        4      '       d5   \        \        P
                  ! RV P                   RR 4      ^ ,          4      # ^ pV P                  V P                  4       4       F  pV\        V4      ,          pK  	  V# )z$Return length of uncompressed value.<LN)	r   r6   rv   r   structunpackr   r   r   )r   r   r   s   &  r   __len__CompressedValue.__len__Z  s    $$$$$  ++,=>>v}}T4+@+@+EFqIJJ 2243G3G3IJEc%j F Kr   c                0   < V ^8  d   QhRS[ S[,          /# r3   )listr,   )r   r   s   "r   r   r   f  s     - -DK -r   c                >    V P                  4       P                  4       # )z.Behaves like splitlines() for a normal string.)r   
splitlinesr   s   &r   r  CompressedValue.splitlinesf  s    ~~**,,r   )r   rV   )NNN)r   r   r   r   r   r   r   r   r   staticmethodr   r   r   r   r   r  r  r    r!   rA   s   @r   r   r      s}     
" 
"/ /* *
; ; # #*	6 	6; ;* 1; < <
 
- -r   r   
AnnotationArchitectureAssertionMessageAuditLogCheckboxSubmissionCrashCounterCrashDBDateDbusErrorAnalysisDependenciesDesktopFile
DialogBodyDisassemblyDistroReleaseDuplicateSignatureExecutablePathExecutableTimestampFailureGLibAssertionMessageInterpreterPathKernLogMachineTypeMainClassUrlNonfreeKernelModulesOopsTextOpenFdsPackagePackageArchitectureProblemTypeProcCmdlineProcCwdProcEnvironProcMaps
ProcStatus	RegistersRespawnCommandSegvAnalysisSegvAnalysisErrorSignal
SignalNameSnapTagsSourcePackage
StackTrace
StacktraceStacktraceSourceStacktraceTopTagsThreadStacktraceTitle	TracebackUnameUnreportableReason
UserGroups_KnownReport_PythonExceptionQualifierzdmi.bios.versionc                     a a ] tR tRt oRtR-V3R lV 3R llltV3R lR ltR.V3R lR lltV3R	 lR
 ltV3R lR lt	V3R lR lt
V3R lR lt]V3R lR l4       t]V3R lR l4       tR/V3R lR lltR0V3R lR lltV3R lR ltV3R lR lt]V3R lR l4       tV3R lR  ltV3R! lR" ltR0V3R# lR$ lltR1R% ltV3R& lR' ltV3R( lR) lt]V3R* lR+ l4       tR,tVtV ;t# )2ProblemReporti  z1Class to store, load, and handle problem reports.c                8   < V ^8  d   QhRS[ RS[ R,          RR/# )r	   problem_typedateNr*   rE   )r   r   s   "r   r   ProblemReport.__annotate__  s'     ( (S (#* (PT (r   c                ~   < Vf   \         P                  ! 4       p\        SV `  RVRV/4       \	        4       V n        R# )zInitialize a fresh problem report.

problem_type can be 'Crash', 'Packaging', 'KernelCrash' or
'KernelOops'. date is the desired date/time string; if
None (default), the current local time is used.
Nr,  r  )timeasctimer   r   setold_keys)r   rJ  rK  r   s   &&&r   r   ProblemReport.__init__  s6     <<<>D-vtDE #&%r   c                4   < V ^8  d   QhRS[ S[,          RR/# )r	   tagsr*   N)r   r   )r   r   s   "r   r   rL    s     2 2Xc] 2t 2r   c                    V P                  4       pVP                  V4      pRP                  \        V4      4      V R&   R# )z/Add tags to the report. Duplicates are dropped. r>  N)get_tagsunionjoinsorted)r   rT  current_tagsnew_tagss   &&  r   add_tagsProblemReport.add_tags  s4    }}%%d+xxx 01Vr   c                   < V ^8  d   QhRS[ P                  S[P                  S[,          ,          RS[S[P                  R,          ,          RS[S[,          R,          RR/# )r	   r   binary
compressed
key_filterNr*   )	rs   r   r   r   r,   r   Literalr   r   )r   r   s   "r   r   rL    s\     5. 5.mmfii..5. v~~l335. SMD(	5.
 
5.r   c                   V P                  V4       V P                  P                  4        V'       d   \        V4      pMRp\	        V4       EF  p\        V4      w  rgpVe	   Wd9  d   K  V'       d   VRJ d   RV P                  V&   MVR8X  d+   \        VRP                  V4      R7      V P                  V&   MqRP                  \        P                  V4      4      p	V P                  Wi4      V P                  V&   M.V P                  VRP                  V4      4      V P                  V&   Vf   K  VP                  V4       \        V4      ^ 8X  g   EK   M	  \        V P                  P                  4       4      V n        R# )a  Initialize problem report from a file-like object.

If binary is False, binary data is not loaded; the dictionary key is
created, but its value will be an empty string. If it is True, it is
transparently uncompressed and available as dictionary byte array
values. If binary is 'compressed', the compressed value is retained,
and the dictionary value will be a CompressedValue object. This is
useful if the compressed value is still useful (to avoid recompression
if the file needs to be written back).

file needs to be opened in binary mode.

If key_filter is given, only those keys will be loaded.

Files are in RFC822 format, but with case sensitive keys.
NFra  r   )rV   r   )_assert_bin_modedataclearrP  r'   r   r   rY  r   _try_unicoderemover   keysrQ  )
r   r   r`  rb  remaining_keysrL   r   r)   r   rW   s
   &&&&      r   loadProblemReport.load  s1   , 	d#		 _N!N!$'E,8,?)C>)c.GU?%)DIIcN|+%4 388H3E&DIIcN  HH_%M%Mh%WXE%)%6%6s%BDIIcN "&!2!238J!K		#)%%c*~&!+- (0 DIINN,-r   c                   < V ^8  d   QhRS[ P                  S[P                  S[,          ,          RS[S[,          S[,          RS[RR/# )r	   r   bin_keys	directoryr*   N)rs   r   r   r   r,   r   r   )r   r   s   "r   r   rL    sN     (? (?mmfii..(? 3-#%(? 	(?
 
(?r   c                8   V P                  V4       \        V\        4      '       d   V.p\        V4      p/ p\	        V4       F  p\        V4      w  rxp	Wt9  d   K  WV&   VP                  V4       V	'       g   K8  \        P                  P                  W74      p
 \        V
R4      ;_uu_ 4       p\        P                  V4       F  pVP                  V4       K  	  RRR4       K  	  V'       d   \        RRP                  V4       R24      hRVP!                  4       9   d:   VP#                  4        UUu. uF  w  rVRJ g   K  VNK  	  ppp\%        V R24      hR#   + '       g   i     EK.  ; i  \         d   p\        RT
 24      ThRp?ii ; iu uppi )	zExtract only given binary elements from the problem report.

Binary elements like kernel crash dumps can be very big. This method
extracts directly files without loading the report into memory.
r   Nzunable to open zCannot find z, z
 in reportFz has no binary content)re  
isinstancer   r  r'   r   ri  r   pathrY  r   r   r   r   OSErrorKeyErrorvaluesitemsrx   )r   r   ro  rp  missing_keys	b64_blockrL   r   r)   r   key_pathr   r   rR   itemelementrw  s   &&&&             r   extract_keysProblemReport.extract_keys  ss    	d#h$$ zHH~	!$'E,8,?)C>&+cN$!ww||I3HG(D))S!0!I!I(!S		%( "T *) ($ \$))L*A)B*MNNI$$&&/8/@U/@mdGuDTTT/@EUw&<=>> ' *))  Gz:;FG VsB   E4/.EE47
FFE1*E41E44F?FFc                0   < V ^8  d   QhRS[ S[,          /# r3   rP  r   )r   r   s   "r   r   rL     s     , ,#c( ,r   c                f    RV 9  d   \        4       # \        V R,          P                  R4      4      # )zReturn the set of tags.r>  rV  )rP  r   r   s   &r   rW  ProblemReport.get_tags   s+    5L4<%%c*++r   c                .   < V ^8  d   QhRS[ R,          /# )r	   r*   Nr   )r   r   s   "r   r   rL  &  s      sTz r   c                P   \         P                  ! \         P                  4      p  \         P                  ! \         P                  R4       \	        \
        P                  ! \
        P                  ! V R,          4      4      4      \         P                  ! \         P                  V4       #   \         d*     \         P                  ! \         P                  T4       R# i ; i  \         P                  ! \         P                  T4       i ; i  \         P                   d     R# i ; i)zXGet timestamp (seconds since epoch) from Date field.

Return None if it is not present.
Cr  N)
locale	getlocaleLC_TIME	setlocaler   rN  mktimestrptimeru  rQ   )r   
orig_ctimes   & r   get_timestampProblemReport.get_timestamp&  s     %%fnn5
		=  54;;t}}T&\'BCD   <    <   <|| 		sB   AB+ %D +C6C" 7%D CC" "'D		D D%$D%c                    < V ^8  d   QhRS[ /# r3   r   )r   r   s   "r   r   rL  8  s     % %D %r   c                (    RV P                  4       9   # )znCheck if the report has any keys which were not loaded.

This could happen when using binary=False in load().
N)rv  r   s   &r   has_removed_fields ProblemReport.has_removed_fields8  s    
 t{{}$$r   c                6   < V ^8  d   QhRS[ S[,          RS[/# )r	   stringr*   )r,   r   r   )r   r   s   "r   r   rL  @  s      %#+ $ r   c                    \        V \        4      '       d5   V  F.  pV^ 8  g   K  \        V4      P                  4       '       d   K-   R# 	  R# )z0Check if the given strings contains binary data.TF)rr  r,   chrisspace)r  cs   & r   	is_binaryProblemReport.is_binary?  s:     fe$$r6#a&.."2"2  r   c                <   < V ^8  d   QhRS[ RS[RS[S[ ,          /# )r	   r   rW   r*   )r   r,   )r   r   s   "r   r   rL  I  s&     	 	s 	5 	US[ 	r   c                    V\         9   d   VP                  R4      # V P                  V4      '       g    VP                  R4      # V#   \         d    Tu # i ; i)z*Try to convert bytearray value to Unicode.rj   )_STRING_KEYSr   r  r   )clsr   rW   s   &&&r   rh  ProblemReport._try_unicodeH  s[     ,<<((}}U##||G,,  & s   A AAc                j   < V ^8  d   QhRS[ S[,          R,          RS[S[S[S[3,          ,          /# )r	   rj  Nr*   )r   r   r   rq   ProblemReportValue)r   r   s   "r   r   rL  T  s6     # #SMD(#	%//0	1#r   c              #    "   V'       d4   \        \        V P                  4       4      \        V4      ,          4      pM\        V P                  4       4      pR F.  pW!9   g   K  VP                  V4       VP	                  ^ V4       K0  	  V F/  pVP                  R4      '       d   K  W,          pVf   K*  W#3x  K1  	  R# 5i)aO  Iterate over all non-internal items sorted.

The most interesting fields will be returned first. The remaining
items will be returned in alphabetical order. Keys starting with
an underscore are considered internal and are skipped. Also values
that are None will be skipped.

If keys is provided, only those keys will be iterated over.
r>   N)rA  r:  r@  r,  r*  r  )rZ  rP  rj  ri  insertr6   )r   rj  r   rW   s   &&  r   sorted_itemsProblemReport.sorted_itemsT  s      #diik*SY67D$))+&D
C {C As#
 C~~c""IE}* s   AC$ACc                N   < V ^8  d   QhRS[ P                  S[,          RS[RR/# )r	   r   only_newr*   N)r   r   r,   r   )r   r   s   "r   r   rL  y  s0     D D&))E* Dd Dt Dr   c                    V P                  V4       V P                  V4      w  r4V F  pV P                  W4       K  	  V F  pV P                  W4       K  	  R# )aK  Write information into the given file-like object.

If only_new is True, only keys which have been added since the last
load() are written (i. e. those returned by new_keys()).

If a value is a string, it is written directly. Otherwise it must be a
tuple of the form (file, encode=True, limit=None, fail_on_empty=False).
The first argument can be a file name or a file-like object,
which will be read and its content will become the value of this key.
'encode' specifies whether the contents will be
gzip compressed and base64-encoded (this defaults to True). If limit is
set to a positive integer, the file is not attached if it's larger
than the given limit, and the entire key will be removed. If
fail_on_empty is True, reading zero bytes will cause an OSError.

file needs to be opened in binary mode.

Files are written in RFC822 format.
N)re  _get_sorted_keys_write_ascii_item)_write_binary_item_compressed_and_encoded)r   r   r  asckeysbinkeysks   &&&   r   r   ProblemReport.writey  sW    ( 	d#00:A""4+  A::4C r   c                \   < V ^8  d   QhRS[ RS[S[S[,          S[S[,          3,          /# )r	   r  r*   )r   rq   r  r   )r   r   s   "r   r   rL    s-          %S	498L2M  r   c                   . p. pV P                   P                  4        F  pV'       d   W@P                  9   d   K  V P                   V,          p\        V\        \
        ,          4      '       d>   V P                  V4      '       d   VP                  V4       K{  VP                  V4       K  \        V\        \        34      '       g3   \        V4      ^8  d#   V^,          '       g   VP                  V4       K  VP                  V4       K  	  VP                  4        RV9   d$   VP                  R4       VP                  ^ R4       VP                  4        W#3# )ziSort keys into ASCII non-ASCII/binary attachment ones, so that
the base64 ones appear last in the report
r,  )rf  rj  rQ  rr  r,   r   r  appendr   r   r   sortri  r  )r   r  r  r  r  vs   &&    r   r  ProblemReport._get_sorted_keys  s     !AA.		!A!US[))>>!$$NN1%NN1%q>?"CDDFaK! q!q!# "& 	G#NN=)NN1m,r   c                N   < V ^8  d   QhRS[ P                  S[,          RS[RR/# r	   r   r   r*   Nr   r   r,   r   )r   r   s   "r   r   rL    s+     % %fii&6 %S %T %r   c                   V P                   V,          p\        V\        \        ,          4      '       g   \	        V4      ^8  d   V^,          e   V^,          pMRp\	        V4      ^8  ;'       d
    V^,          p\        V^ ,          R4      '       d   V^ ,          P                  4       pM4\        V^ ,          R4      ;_uu_ 4       pVP                  4       pRRR4       V'       d#   \	        V4      ^ 8X  d   \        RV,           4      hVe    \	        V4      V8  d   V P                   V R# \        V\        4      '       d   VP                  R4      pVP                  VP                  R4      4       RV9   d4   VP                  R4       VP                  VP                  RR	4      4       M"VP                  R
4       VP                  V4       VP                  R4       R#   + '       g   i     EL; i)   Nr   r   did not get any data for field rj   r   r   s   :
    
 s   : )rf  rr  r,   r   r   r   r   r   rt  encoder   replace)r   r   r   r  limitfail_on_emptyfs   &&&    r   r  ProblemReport._write_ascii_item  sg   IIcN !US[))1v{qt/!FaK00AaDMqtV$$aDIIK!A$%%A & Q1?#EFF SVe^IIcNa!A

3::g&'A:JJwJJqyy/0JJuJJqM

5- &%%s   G##G4	c                d   < V ^8  d   QhRS[ P                  S[,          RS[RS[S[,          RR/# )r	   r   r   chunksr*   N)r   r   r,   r   r   )r   r   s   "r   r   rL    s:      ii%(2:5/	r   c                r   V P                  4       p V P                  V R2P                  R4      4       V F9  pV P                  R4       V P                  \        P                  ! V4      4       K;  	  V P                  R4       R#   \
         d%    T P                  T4       T P                  T4       h i ; i)zCWrite out binary chunks as a base64-encoded RFC822 multiline field.z: base64r   r  r   N)tellr   r  rN   	b64encode	Exceptionseektruncate)r   r   r  reset_positionchunks   &&&  r   !_write_binary_item_base64_encoded/ProblemReport._write_binary_item_base64_encoded  s    
 		JJ#h'..w78

6"

6++E23   JJu 	IIn%MM.)	s   A3B /B6c                6   < V ^8  d   QhRS[ RS[S[,          /# )r	   r   r*   )r   r   r,   )r   r   s   "r   r   rL    s$     J Js Jy7G Jr   c           	   #    "   V P                   V,          p\        V\        \        34      '       d   VP	                  4        Rj  xL
  R# \
        R,           VP                  R4      ,           R,           pVx  \        P                  ! R4      p\        P                  ! ^\        P                  \        P                  ) \        P                  ^ 4      p^ p\        V\        4      '       d   Q h\        V\        4      '       dH   V\        V4      ,          p\        P                  ! W$4      pVP!                  V4      pV'       d   Vx  EMVRp\        V4      ^8  d   V^,          e
   V^,          p\#        V^ ,          R4      '       d   V^ ,          p	M\%        V^ ,          R4      p	 V	P'                  \(        4      p
V\        V
4      ,          p\        P                  ! W4      pVe   Wh8  d   V P                   V \+        R4      hV
'       d"   VP!                  V
4      pV'       d   Vx  K  K   \#        T^ ,          R4      '       g   T	P-                  4        \        T4      ^8  d8   T^,          '       d)   T^ 8X  d"   \/        R	T R
\        T^ ,          4       24      hVP1                  4       p
V
\2        P4                  ! RVR,          4      ,          p
V
\2        P4                  ! RVR,          4      ,          p
V
x  R#  EL5i)zGenerator taking the value out of self.data and outputing it
in compressed chunks of binary data.

Throws a _SizeLimitExceeded exception if the value exceeds its specified
size limit, in which case it will also remove the value from self.data entirely.
Ns       rj       r   r   r   z,Binary data bigger than the limit ({limit}b)r  z from r  l    )rf  rr  r   r   r   rv   r  r   crc32compressobjDEFLATEDr   DEF_MEM_LEVELr   r,   r   compressr   r   r   r   r%   r   rt  r   r  pack)r   r   rW   gzip_headercrcbcsizeoutblockr  r  r   s   &&         r   _generate_compressed_chunks)ProblemReport._generate_compressed_chunks  sk     		#eno>??,,...-.jj!"  	 jjoaASASUVW eS))))eU##CJD**U(C{{5)H E5zQ58#7auQx((!H q4(z*E
"jj,$| IIcN0J  !{{51H&   58V,,	5zQ58819!9#fSq]OT 
 
T3#344T4*#455 /s'   ALLG	LL)AL:B	Lc                N   < V ^8  d   QhRS[ P                  S[,          RS[RR/# r  r  )r   r   s   "r   r   rL  ;  s.     
 
IIe$
+.
	
r   c                n     V P                  WV P                  V4      4       R#   \         d     R# i ; i)z?Write the binary keys with gzip compression and base64 encodingN)r  r  r%   )r   r   r   s   &&&r   r  7ProblemReport._write_binary_item_compressed_and_encoded;  s9    	224;;C@ " 		s   !% 44c                *   < V ^8  d   QhRS[ RS[RR/# )r	   
reportfile
keep_timesr*   N)r   r   )r   r   s   "r   r   rL  G  s"     - -# -4 -D -r   c                >   \         P                  ! V4      p \        VR4      ;_uu_ 4       p\         P                  ! V^ 4       V P	                  V4       RRR4       V'       d-   \         P
                  ! WP                  VP                  34       \         P                  ! WP                  4       R#   + '       g   i     Lf; i  T'       d-   \         P
                  ! YP                  TP                  34       \         P                  ! YP                  4       i ; i)zAdd this report's data to an already existing report file.

The file will be temporarily chmod'ed to 000 to prevent frontends
from picking up a hal-updated report file. If keep_times
is True, then the file's atime and mtime restored after updating.
abN)	r   statr   chmodr   utimest_atimest_mtimest_mode)r   r  r  streports   &&&  r   add_to_existingProblemReport.add_to_existingG  s     WWZ 	-j$''6Q'

6" ( kk2;;%?@HHZ, (' kk2;;%?@HHZ,s#   C )B3C 3C	>C ADc                	   V P                  V4       \        V P                  P                  4       4      pRp. pRV9   d$   VP	                  R4       VP                  ^ R4       V'       d?   ^ p	V F6  p
W9   g   K  VP	                  V
4       VP                  W4       V	^,          p	K8  	  V EF	  pV'       d	   W9   d   K  V P                  V,          pRp\        V\        4      '       d   VP                  pEMn\        V\        \        ,          4      '       g   \        V^ ,          R4      '       d   V^ ,          pM\        V^ ,          R4      pVP                  R4      '       d   VP                  4       pM\        P                   ! 4       p\"        P$                  ! VRV^ R7      ;_uu_ 4       p VP                  \&        4      pV'       d   VP)                  V4       K1   RRR4       TP+                  4       pVP-                  4        M\\        V\        4      '       dG   V P/                  V4      '       d0   VP                  R4      '       d   TpM\        W4      P                  pV'       d   VP1                  \3        W4      4       EK  \5        V4      p\        V\        4      '       d   VP7                  R	R
4      p\        V\        4      '       g   Q h\5        VP9                  4       4      pVR8:  d8   V^8X  d1   VP;                  4       pW{R,           V,           R,           ,          pEK  VR8:  dg   VV8:  d`   W{R,           ,          pVP                  R4      '       g
   VR,          pW|P=                  4       P?                  RR4      R,           ,          pEK  VP1                  \A        W4      4       EK  	  \B        PD                  PF                  PI                  VR	R7      pVPK                  RR4       VP                  ^ V4       \B        PD                  PL                  PO                  4       pV'       d+   VPQ                  4        F  w  rVPK                  W4       K  	  V F  pVPS                  V4       K  	  VP)                  VPU                  4       PW                  R	4      4       VP)                  R4       R#   + '       g   i     EL; i)a  Write MIME/Multipart RFC 2822 formatted data into file.

file must be a file-like object, not a path.  It needs to be opened in
binary mode.

If a value is a string or a CompressedValue, it is written directly.
Otherwise it must be a tuple containing the source file and an optional
boolean value (in that order); the first argument can be a file name or
a file-like object, which will be read and its content will become the
value of this key.  The file will be gzip compressed, unless the key
already ends in .gz.

attach_treshold specifies the maximum number of lines for a value to be
included into the first inline text part. All bigger values (as well as
all non-ASCII ones) will become an attachment, as well as text
values bigger than 1 kB.

Extra MIME preamble headers can be specified, too, as a dictionary.

skip_keys is a set/list specifying keys which are filtered out and not
written to the destination file.

priority_fields is a set/list specifying the order in which keys should
appear in the destination file.
 r,  Nr   r   rt   r   r   rj   r  i  z: 
z:
 z
 rk   r^   inliner   ),re  rZ  rf  rj  ri  r  rr  r   r   r,   r   r   r   rH   r   r   r   rs   r   r   r   r   r   r  r  rg   r   r   r  rstripr   r  ro   rX   rY   rm   rn   rb   	multipartMIMEMultipartrw  attach	as_stringr  )r   r   attach_tresholdextra_headers	skip_keyspriority_fieldsrj  rm   attachmentscounterpriority_fieldr  r  attach_valuer  r   r   r   r  linesattmsgas   &&&&&&                 r   
write_mimeProblemReport.write_mimeX  s   H 	d#diinn&'D KK&KK=)G"1!)KK/KK8qLG	 #2 AQ^		!AL !_-- 11  53;//1Q4((!A QqT4(A::e$$#$668L**,CqtSJJb"$%FF:$6E$ " % K $'<<>L	 Au%%$..*;*;::e$$#$L#21#8#I#IL ""#@#QR 1v a'')4A!!S))))ALLN+4<EQJ
AHqL4//DT\e&>J&D::d++T	GGI--dE:TAAD  &&'>q'DE D jjoo&&tg&>,h71c"jj""002%++-q$ .AJJqM  	

3==?))'23

5q KJJs   .R=R==Sc                *   < V ^8  d   QhRS[ RS[RR/# )r	   r  r  r*   N)r   r  )r   r   s   "r   r   rL    s#     + +S +%7 +D +r   c                   \        VR 4      '       g   Q hVP                  RR4      P                  RR4      P                  RR4      P                  4       '       g   \        RV R24      h\	        V\
        \        34      '       g   \        VR 4      '       g   \	        V\        4      '       dq   \        V4      ^8X  g/   \        V4      ^8  dQ   \        V4      ^8:  dA   V^,          R
9   d3   \        V^ ,          R 4      '       g)   \        V^ ,          R4      '       g   \        RV R	24      hV P                  P                  W4      # )isalnum.r  -r>   zkey 'zT' contains invalid characters (only numbers, letters, '.', '_', and '-' are allowed)r   zvalue for key z7 must be a string, CompressedValue, or a file reference>   FT)r   r  r
  rx   rr  r   r   rq   r   	TypeErrorrf  __setitem__)r   r  r  s   &&&r   r  ProblemReport.__setitem__  s   q)$$$$yyb!))#r2::3CKKMMs J K  q>?;<<q)$$1e$$FaKA!A!!8MQqT9--1v1F1F   $' ( 
 yy$$Q**r   c                0   < V ^8  d   QhRS[ S[,          /# r3   r  )r   r   s   "r   r   rL    s     5 5#c( 5r   c                j    \        V P                  P                  4       4      V P                  ,
          # )zyReturn newly added keys.

Return the set of keys which have been added to the report since it
was constructed or loaded.
)rP  rf  rj  rQ  r   s   &r   new_keysProblemReport.new_keys  s#     499>>#$t}}44r   c                $   < V ^8  d   QhRS[ RR/# r   )r   )r   r   s   "r   r   rL    s     S Sv S$ Sr   c                8    \        V R4      '       d   Q R4       hR# )z0Assert that given file object is in binary mode.encodingz"file stream must be in binary modeN)r   )r   s   &r   re  ProblemReport._assert_bin_mode  s      4,,R.RR,,r   )rQ  )CrashN)TNrG   r<   )   NNN)r   r   r   r   r   r   r]  rl  r}  rW  r  r  r  r  classmethodrh  r  r   r  r  r  r  r  r  r  r  r  re  r    r!   r"   r#   s   @@r   rH  rH    s    ;( (2 25. 5.n(? (?T, , $% %   	 	# #JD D<   @% %N   J JX
 
- -"EN+ +85 5 S S Sr   rH  c                @    V ^8  d   Qh/ ^ \         9   d
   \        ;R&   # )r	   r  )__conditional_annotations__r   )r   s   "r   r   r      s     . .T W VI VU /r   )5r  r   rN   rP   collectionsdataclassesemail.encodersrX   email.mime.baseemail.mime.multipartemail.mime.textrs   r   r  r   r  rN  r   r   collections.abcr   r   r   r   r   rv   rw   rx   r   r   r%   r'   rI   rS   rg   ro   ra   r~   r   r   r   r   	dataclassr   r   r,   r   rq   r  r  UserDictrH  r   )r  s   @r   <module>r&     sy   .          	  	     9 9 
# , 
Z 
I I %8  %F$?8($	(-/< E E E<r- r-j !& 6 H3 NQV V  V999 9 	9
 9 9 9 9 9 9 9 9 9 9 9  !9" #9$ %9& '9( )9* +9, -9. /90 192 394 596 798 99: ;9< =9> ?9@ A9B C9D E9F G9H I9J K9L M9N O9P Q9R S9T U9V W9X Y9Z [9\ ]9^ _9` a9b c9d e9f g9h i9j k9l m9n  o9p q9x^	SK(( ^	Sr   