+
    oÆFj?.  ã                   ól   € R t ^ RIt^ RIHt ^ RIt^ RIt ! R R]P                  P                  4      tR# )zISimple in-memory CrashDatabase implementation, mainly useful for testing.N)ÚAnyc                   óh  a € ] tR t^t o RtV 3R lR ltR)R ltR tR tR t	V 3R	 lR
 lt
V 3R lR ltV 3R lR ltR*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tR tV 3R lR ltR 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R(tV tR# ),ÚCrashDatabasez†Simple implementation of crash database interface which keeps everything
in memory.

This is mainly useful for testing and debugging.
c                óN   <€ V ^8„  d   QhRS[ R,          RS[S[ S[3,          RR/# )é   Ú	auth_fileNÚoptionsÚreturn)ÚstrÚdictr   )ÚformatÚ__classdict__s   "€Ú</usr/lib/python3/dist-packages/apport/crashdb_impl/memory.pyÚ__annotate__ÚCrashDatabase.__annotate__   s.   ø€ ÷ #ñ #¡#¨¥*ð #±t¹CÁ¸Hµ~ð #È$ñ #ó    c                óò   € \         P                  P                  P                  WV4       . V n        \        4       V n        \        4       V n        RV n        RV n	        RV9   d   V P                  4        R# R# )zdInitialize crash database connection.

This class does not support bug patterns and authentication.
g        NÚsample_data)ÚapportÚcrashdbr   Ú__init__ÚreportsÚsetÚ
unretracedÚdup_uncheckedÚupload_delayÚ
upload_msgÚadd_sample_data)Úselfr   r   s   &&&r   r   ÚCrashDatabase.__init__   sb   € ô
 	�‰×$Ñ$×-Ñ-¨d¸wÔGð .0ˆŒÜ$'£EˆŒÜ'*£uˆÔàˆÔØ26ˆŒà˜GÔ#Ø× Ñ Ö"ñ $r   Nc           
     ód  € V P                  V4      '       g   Q hV'       d>   V P                  '       d,   V! V P                  ^ ,          V P                  ^,          4       V P                  P                  RVRRRRRR/4       \	        V P                  4      ^,
          pRV9   d   V P
                  P                  V4       MV P                  P                  V4       V P                  '       dC   V'       d
   V! ^ ^d4       \        P                  ! V P                  4       V'       d
   V! ^d^d4       V# )zuStore the report and return a handle number (starting from 0).

This does not support (nor need) progress callbacks.
ÚreportÚfixed_versionNÚdup_ofÚcommentÚ Ú	Traceback)Úacceptsr   r   ÚappendÚlenr   Úaddr   r   ÚtimeÚsleep)r   r!   Úprogress_callbackÚuser_message_callbackÚcrash_ids   &&&& r   ÚuploadÚCrashDatabase.upload-   sé   € ð
 �|‰|˜F×#Ò#Ð#Ð#ç  T§_§_ _Ù! $§/¡/°!Õ"4°d·o±oÀaÕ6HÔIà�‰×ÑØ�v˜°°hÀÀiÐQSÐTô	
ô �t—|‘|Ó$ qÕ(ˆØ˜&Ô Ø×Ñ×"Ñ" 8Õ,à�O‰O×Ñ Ô)ð ××Ðß Ù! ! SÔ)Ü�JŠJ�t×(Ñ(Ô)ß Ù! # sÔ+àˆr   c                ó8   € RV9   d   RVR,           RV 2# RV 2# )z’Return http://<sourcepackage>.bugs.example.com/<handle> for package
bugs or http://bugs.example.com/<handle> for reports without a
SourcePackage.
ÚSourcePackagezhttp://z.bugs.example.com/zhttp://bugs.example.com/© )r   r!   Úhandles   &&&r   Úget_comment_urlÚCrashDatabase.get_comment_urlJ   s3   € ð
 ˜fÔ$Ø˜V OÕ4Ð5Ð5GÈÀxÐPÐPØ)¨&¨Ð2Ð2r   c                ó$   € V P                  W4      # )zÕReturn URL for a given report ID.

The report is passed in case building the URL needs additional
information from it, such as the SourcePackage name.

Return None if URL is not available or cannot be determined.
)r6   )r   r!   r/   s   &&&r   Ú
get_id_urlÚCrashDatabase.get_id_urlS   s   € ð ×#Ñ# FÓ5Ð5r   c                ó6   € V P                   V,          R,          # )z>Download the problem report from given ID and return a Report.r!   ©r   ©r   r/   s   &&r   ÚdownloadÚCrashDatabase.download]   s   € à�|‰|˜HÕ% hÕ/Ð/r   c                ó6   <€ V ^8„  d   QhRS[ RS[S[,          /# ©r   r/   r	   )ÚintÚlistr
   )r   r   s   "€r   r   r   a   s#   ø€ ÷ Cñ C©cð C±d¹3µiñ Cr   c                óF   € V P                   V,          R,          R,          .# )z5Return list of affected source packages for given ID.r!   r3   r<   r=   s   &&r   Úget_affected_packagesÚ#CrashDatabase.get_affected_packagesa   s   € à—‘˜XÕ& xÕ0°ÕAÐBÐBr   c                ó&   <€ V ^8„  d   QhRS[ RS[/# rA   ©rB   Úbool)r   r   s   "€r   r   r   e   s   ø€ ÷ ñ ¡Cð ©Dñ r   c                ó   € R# )z3Check whether the user is the reporter of given ID.Tr4   r=   s   &&r   Úis_reporterÚCrashDatabase.is_reportere   s   € ár   c                ó&   <€ V ^8„  d   QhRS[ RS[/# rA   rH   )r   r   s   "€r   r   r   i   s   ø€ ÷ *ñ *¡3ð *©4ñ *r   c                ó$   € V P                  V4      # )a  Check whether the user is eligible to update a report.

A user should add additional information to an existing ID if (s)he is
the reporter or subscribed, the bug is open, not a duplicate, etc. The
exact policy and checks should be done according to  the particular
implementation.
)rK   r=   s   &&r   Ú
can_updateÚCrashDatabase.can_updatei   s   € ð ×Ñ Ó)Ð)r   c                ó¾   € V P                   V,          pW7R&   V'       d&   V F  pW‚9   g   K  W(,          VR,          V&   K  	  R# VR,          P                  V4       R# )a  Update the given report ID with all data from report.

This creates a text comment with the "short" data (see
ProblemReport.write_mime()), and creates attachments for all the
bulk/binary data.

If change_description is True, and the crash db implementation supports
it, the short data will be put into the description instead (like in a
new bug).

comment will be added to the "short" data. If attachment_comment is
given, it will be added to the attachment uploads.

If key_filter is a list or set, then only those keys will be added.
r$   r!   N)r   Úupdate)	r   r/   r!   r$   Úchange_descriptionÚattachment_commentÚ
key_filterÚrÚfs	   &&&&&&&  r   rR   ÚCrashDatabase.updatet   sN   € ð0 �L‰L˜Õ"ˆØˆ)‰çÛ�Ø–;Ø%+¥Y�A�h•K “Nó  ð ˆh�K×Ñ˜vÖ&r   c                ó&   <€ V ^8„  d   QhRS[ RS[/# rA   ©rB   r
   )r   r   s   "€r   r   r   –   s   ø€ ÷ Añ A©3ð A±3ñ Ar   c                óD   € V P                   V,          R,          R,          # )zFGet 'DistroRelease: <release>' from the given report ID and return
it.r!   ÚDistroReleaser<   r=   s   &&r   Úget_distro_releaseÚ CrashDatabase.get_distro_release–   s   € ð �|‰|˜HÕ% hÕ/°Õ@Ð@r   c                ó0   <€ V ^8„  d   QhRS[ S[,          /# ©r   r	   ©r   rB   )r   r   s   "€r   r   r   ›   s   ø€ ÷ ñ ™S¡�Xñ r   c                ó¬   € \        4       p\        V P                  4       F0  w  r#VR,          e   K  VR,          e   K  VP                  V4       K2  	  V# )a0  Return an ID set of all crashes which are not yet fixed.

The list must not contain bugs which were rejected or duplicate.

This function should make sure that the returned list is correct. If
there are any errors with connecting to the crash database, it should
raise an exception (preferably OSError).
r#   r"   )r   Ú	enumerater   r*   )r   ÚresultÚir!   s   &   r   Úget_unfixedÚCrashDatabase.get_unfixed›   sG   € ô “ˆÜ" 4§<¡<Ö0‰IˆAØ�hÕÔ'¨F°?Õ,CÔ,KØ—
‘
˜1–ñ 1ð ˆr   c                ó4   <€ V ^8„  d   QhRS[ RS[R,          /# ©r   r/   r	   NrZ   )r   r   s   "€r   r   r   «   s   ø€ ÷ ñ ©#ð ±#¸µ*ñ r   c                ó˜   €  V P                   V,          R,          e   R# V P                   V,          R,          #   \         d     R# i ; i)aÎ  Return the package version that fixes a given crash.

Return None if the crash is not yet fixed, or an empty string if the
crash is fixed, but it cannot be determined by which version. Return
'invalid' if the crash report got invalidated, such as closed a
duplicate or rejected.

This function should make sure that the returned result is correct. If
there are any errors with connecting to the crash database, it should
raise an exception (preferably OSError).
r#   Úinvalidr"   )r   Ú
IndexErrorr=   s   &&r   Úget_fixed_versionÚCrashDatabase.get_fixed_version«   sD   € ð	Ø�|‰|˜HÕ% hÕ/Ò;Ù Ø—<‘< Õ)¨/Õ:Ð:øÜô 	Úð	ús   ‚:  : ºA	ÁA	c                ó4   <€ V ^8„  d   QhRS[ RS[ R,          /# ri   ©rB   )r   r   s   "€r   r   r   ¾   s   ø€ ÷ 0ñ 0¡Sð 0©S°4­Zñ 0r   c                ó6   € V P                   V,          R,          # )zSReturn master ID for a duplicate bug.

If the bug is not a duplicate, return None.
r#   r<   r=   s   &&r   Úduplicate_ofÚCrashDatabase.duplicate_of¾   s   € ð
 �|‰|˜HÕ% hÕ/Ð/r   c                ó0   € W0P                   V,          R&   R# )z\Mark a crash id as duplicate of given master ID.

If master is None, id gets un-duplicated.
r#   Nr<   )r   r!   r/   Ú	master_ids   &&&&r   Úclose_duplicateÚCrashDatabase.close_duplicateÅ   s   € ð
 ,5�‰�XÕ˜xÓ(r   c                ó*   <€ V ^8„  d   QhRS[ RS[ RR/# )r   r/   Úmasterr	   Nrp   )r   r   s   "€r   r   r   Ì   s'   ø€ ÷ Vñ V©ð V±Sð V¸Tñ Vr   c                ót   € V P                   V,          R,          f   Q hRV 2V P                   V,          R&   R# )ziMark a crash id as reintroducing an earlier crash which is
already marked as fixed (having ID 'master').
r"   Nzregression, already fixed in #r$   r<   )r   r/   ry   s   &&&r   Úmark_regressionÚCrashDatabase.mark_regressionÌ   s8   € ð �|‰|˜FÕ# OÕ4Ò@Ð@Ð@Ø.LÈVÈHÐ,Uˆ�‰�XÕ˜yÓ)r   c                ób   €  V P                   P                  V4       R#   \         d     R# i ; i)z/Mark crash id as checked for being a duplicate.N)r   ÚremoveÚKeyError)r   r/   r!   s   &&&r   Ú_mark_dup_checkedÚCrashDatabase._mark_dup_checkedÓ   s-   € ð	Ø×Ñ×%Ñ% hÖ/øÜô 	Úð	ús   ‚ Ÿ.­.c                ó$   <€ V ^8„  d   QhRS[ RR/# ri   rp   )r   r   s   "€r   r   r   Ú   s   ø€ ÷ )ñ )¡cð )¨dñ )r   c                ó<   € V P                   P                  V4       R# )zMark crash id as retraced.N)r   r~   r=   s   &&r   Úmark_retracedÚCrashDatabase.mark_retracedÚ   s   € à�‰×Ñ˜xÖ(r   c                ó8   <€ V ^8„  d   QhRS[ RS[R,          RR/# )r   r/   Úinvalid_msgNr	   rZ   )r   r   s   "€r   r   r   Þ   s)   ø€ ÷ ñ ÙðÙ*-°­*ðà	ñr   c                ó   € R# )zdMark crash id as 'failed to retrace'.

This is a no-op since this crash DB is not interested in it.
Nr4   )r   r/   r‡   s   &&&r   Úmark_retrace_failedÚ!CrashDatabase.mark_retrace_failedÞ   s   ‚ r   c                ó0   <€ V ^8„  d   QhRS[ S[,          /# r`   ra   )r   r   s   "€r   r   r   æ   s   ø€ ÷ ñ ¡¡C¥ñ r   c                ó   € V P                   # )zuReturn an ID set of all crashes which have not been retraced yet and
which happened on the current host architecture.)r   ©r   s   &r   Úget_unretracedÚCrashDatabase.get_unretracedæ   s   € ð �‰Ðr   c                ó0   <€ V ^8„  d   QhRS[ S[,          /# r`   ra   )r   r   s   "€r   r   r   ë   s   ø€ ÷ "ñ "¡3¡s¥8ñ "r   c                ó   € V P                   # )a  Return an ID set of all crashes which have not been checked for
being a duplicate.

This is mainly useful for crashes of scripting languages such as
Python, since they do not need to be retraced. It should not return
bugs that are covered by get_unretraced().
)r   r�   s   &r   Úget_dup_uncheckedÚCrashDatabase.get_dup_uncheckedë   s   € ð ×!Ñ!Ð!r   c                ó    <€ V ^8„  d   QhRS[ /# r`   rp   )r   r   s   "€r   r   r   õ   s   ø€ ÷ %ñ %™3ñ %r   c                ó:   € \        V P                  4      ^,
          # )z0Return the ID of the most recently filed report.)r)   r   r�   s   &r   Ú	latest_idÚCrashDatabase.latest_idõ   s   € ä�4—<‘<Ó  1Õ$Ð$r   c                ó   <€ V ^8„  d   QhRR/# )r   r	   Nr4   )r   r   s   "€r   r   r   ù   s   ø€ ÷ Rñ R ñ Rr   c                óô  € \         P                  P                  4       pRVR&   RVR&   RVR&   RVR&   R	VR
&   RVR&   V P                  V4       \         P                  P                  4       pRVR&   RVR&   RVR&   RVR&   R	VR
&   RVR&   V P                  V4       \         P                  P                  4       pRVR&   RVR&   RVR&   RVR&   RVR
&   RVR&   V P                  V4       \         P                  P                  4       pRVR&   RVR&   RVR&   RVR
&   RVR&   V P                  V4       \         P                  P                  4       pRVR&   RVR&   RVR&   RVR
&   RVR&   V P                  V4       R# )zGAdd some sample crash reports.

This is mostly useful for test suites.
zlibfoo1 1.2-3ÚPackageÚfoor3   zFooLinux Pi/2r\   Ú11ÚSignalz
/bin/crashÚExecutablePathz‰foo_bar (x=1) at crash.c:28
d01 (x=1) at crash.c:29
raise () from /lib/libpthread.so.0
<signal handler called>
__frob (x=1) at crash.c:30ÚStacktraceTopzlibfoo1 1.2-4z
Testux 1.0z‰foo_bar (x=2) at crash.c:28
d01 (x=3) at crash.c:29
raise () from /lib/libpthread.so.0
<signal handler called>
__frob (x=4) at crash.c:30zbar 42-4Úbarz/usr/bin/brokenzuh (p=0x0) at crash.c:25
g (x=1, y=42) at crash.c:26
f (x=1) at crash.c:27
e (x=1) at crash.c:28
d (x=1) at crash.c:29zpython-goo 3epsilon1Úpygooz
Testux 2.2z/usr/bin/pygoozûTraceback (most recent call last):
  File "test.py", line 7, in <module>
    print(_f(5))
  File "test.py", line 5, in _f
    return g_foo00(x+1)
  File "test.py", line 2, in g_foo00
    return x/0
ZeroDivisionError: integer division or modulo by zeror&   zpython-goo 5N)r   r!   ÚReportr0   )r   rV   s   & r   r   ÚCrashDatabase.add_sample_dataù   sÄ  € ô �M‰M× Ñ Ó"ˆØ&ˆˆ)‰Ø"ˆˆ/ÑØ,ˆˆ/ÑØˆˆ(‰Ø*ˆÐ
Ñðˆˆ/Ñð
 	�‰�AŒô �M‰M× Ñ Ó"ˆØ&ˆˆ)‰Ø"ˆˆ/ÑØ)ˆˆ/ÑØˆˆ(‰Ø*ˆÐ
Ñðˆˆ/Ñð
 	�‰�AŒô �M‰M× Ñ Ó"ˆØ!ˆˆ)‰Ø"ˆˆ/ÑØ)ˆˆ/ÑØˆˆ(‰Ø/ˆÐ
Ñðˆˆ/Ñð
 	�‰�AŒô �M‰M× Ñ Ó"ˆØ-ˆˆ)‰Ø$ˆˆ/ÑØ)ˆˆ/ÑØ.ˆÐ
Ñð9ˆˆ+‰ð 	�‰�AŒô �M‰M× Ñ Ó"ˆØ%ˆˆ)‰Ø$ˆˆ/ÑØ)ˆˆ/ÑØ.ˆÐ
Ñð9ˆˆ+‰ð 	�‰�AŽr   )r   r   r   r   r   )NN)FNN)N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r0   r6   r9   r>   rE   rK   rO   rR   r]   rf   rm   rr   rv   r{   r€   r„   r‰   rŽ   r’   r–   r   Ú__static_attributes__Ú__classdictcell__)r   s   @r   r   r      sÌ   ø‡ € ñ÷#ð #ô&ò:3ò6ò0÷Cð C÷ð ÷*ð *ô '÷DAð A÷
ð ÷ ð ÷&0ð 0ò5÷Vð Vò÷)ð )÷ò ÷ð ÷
"ð "÷%ð %÷Rö Rr   r   )	r¨   r+   Útypingr   Úapport.crashdbr   Úapport.reportr   r   r4   r   r   Ú<module>r®      s.   ðÙ Oó Ý ã Û ôx�F—N‘N×0Ñ0ö xr   