Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/dist-packages/apport/crashdb_impl/
Upload File :
Current File : //usr/lib/python2.7/dist-packages/apport/crashdb_impl/memory.pyc


5Oc@s>dZddlZddlZdejjfdYZdS(sISimple in-memory CrashDatabase implementation, mainly useful for testing.iNt
CrashDatabasecBseZdZdZddZdZdZdZdZ	dZ
dZeddd	Z
d
ZdZdZd
ZdZdZdZdZdZdZdZdZRS(sSimple implementation of crash database interface which keeps everything
    in memory.

    This is mainly useful for testing and debugging.cCsWtjjj|||g|_t|_t|_d|krS|jndS(skInitialize crash database connection.

        This class does not support bug patterns and authentication.t
dummy_dataN(	tapporttcrashdbRt__init__treportstsett
unretracedt
dup_uncheckedtadd_dummy_data(tselft	auth_filetoptions((s>/usr/lib/python2.7/dist-packages/apport/crashdb_impl/memory.pyRs	cCs|j|st|jji|d6dd6dd6dd6t|jd}d|krs|jj|n|jj||S(	sStore the report and return a handle number (starting from 0).

        This does not support (nor need) progress callbacks.
        treportt
fixed_versiontdup_oftscomment:it	TracebackN(	tacceptstAssertionErrorRtappendtNonetlenRtaddR(R
R
tprogress_callbacktid((s>/usr/lib/python2.7/dist-packages/apport/crashdb_impl/memory.pytupload#scCs*d|krd|d|fSd|SdS(sReturn http://<sourcepackage>.bugs.example.com/<handle> for package bugs
        or http://bugs.example.com/<handle> for reports without a SourcePackage.t
SourcePackageshttp://%s.bugs.example.com/%ishttp://bugs.example.com/%iN((R
R
thandle((s>/usr/lib/python2.7/dist-packages/apport/crashdb_impl/memory.pytget_comment_url3s
cCs|j||S(sReturn 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.
        (R(R
R
R((s>/usr/lib/python2.7/dist-packages/apport/crashdb_impl/memory.pyt
get_id_url=scCs|j|dS(s>Download the problem report from given ID and return a Report.R
(R(R
R((s>/usr/lib/python2.7/dist-packages/apport/crashdb_impl/memory.pytdownloadGscCs|j|ddgS(s5Return list of affected source packages for given ID.R
R(R(R
R((s>/usr/lib/python2.7/dist-packages/apport/crashdb_impl/memory.pytget_affected_packagesLscCstS(s3Check whether the user is the reporter of given ID.(tTrue(R
R((s>/usr/lib/python2.7/dist-packages/apport/crashdb_impl/memory.pytis_reporterQscCs
|j|S(sBCheck 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.
        (R"(R
R((s>/usr/lib/python2.7/dist-packages/apport/crashdb_impl/memory.pyt
can_updateVsc	Csg|j|}||d<|rRxC|D]'}||kr$|||d|<q$q$Wn|dj|dS(shUpdate 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.
        tcommentR
N(Rtupdate(	R
RR
R$tchange_descriptiontattachment_commentt
key_filtertrtf((s>/usr/lib/python2.7/dist-packages/apport/crashdb_impl/memory.pyR%`s


cCs|j|ddS(sNGet 'DistroRelease: <release>' from the given report ID and return
        it.R
t
DistroRelease(R(R
R((s>/usr/lib/python2.7/dist-packages/apport/crashdb_impl/memory.pytget_distro_release{scCskt}x[tt|jD]D}|j|ddkr|j|ddkr|j|qqW|S(sOReturn 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 IOError).RRN(RtrangeRRRR(R
tresultti((s>/usr/lib/python2.7/dist-packages/apport/crashdb_impl/memory.pytget_unfixeds		cCsGy.|j|ddkrdS|j|dSWntk
rBdSXdS(sReturn 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 IOError).RtinvalidRN(RRt
IndexError(R
R((s>/usr/lib/python2.7/dist-packages/apport/crashdb_impl/memory.pytget_fixed_versions
cCs|j|dS(scReturn master ID for a duplicate bug.

        If the bug is not a duplicate, return None.
        R(R(R
R((s>/usr/lib/python2.7/dist-packages/apport/crashdb_impl/memory.pytduplicate_ofscCs||j|d<dS(slMark a crash id as duplicate of given master ID.

        If master is None, id gets un-duplicated.
        RN(R(R
R
Rtmaster((s>/usr/lib/python2.7/dist-packages/apport/crashdb_impl/memory.pytclose_duplicatescCs6|j|ddkstd||j|d<dS(spMark a crash id as reintroducing an earlier crash which is
        already marked as fixed (having ID 'master').Rs regression, already fixed in #%iR$N(RRR(R
RR5((s>/usr/lib/python2.7/dist-packages/apport/crashdb_impl/memory.pytmark_regressionscCs,y|jj|Wntk
r'nXdS(s/Mark crash id as checked for being a duplicate.N(RtremovetKeyError(R
RR
((s>/usr/lib/python2.7/dist-packages/apport/crashdb_impl/memory.pyt_mark_dup_checkeds
cCs|jj|dS(sMark crash id as retraced.N(RR8(R
R((s>/usr/lib/python2.7/dist-packages/apport/crashdb_impl/memory.pyt
mark_retracedscCs|jS(s}Return an ID set of all crashes which have not been retraced yet and
        which happened on the current host architecture.(R(R
((s>/usr/lib/python2.7/dist-packages/apport/crashdb_impl/memory.pytget_unretracedscCs|jS(s#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>/usr/lib/python2.7/dist-packages/apport/crashdb_impl/memory.pytget_dup_uncheckedscCst|jdS(s0Return the ID of the most recently filed report.i(RR(R
((s>/usr/lib/python2.7/dist-packages/apport/crashdb_impl/memory.pyt	latest_idscCstj}d|d<d|d<d|d<d|d<d	|d
<d|d<|j|tj}d
|d<d|d<d|d<d|d<d	|d
<d|d<|j|tj}d|d<d|d<d|d<d|d<d|d
<d|d<|j|tj}d|d<d|d<d|d<d|d
<d|d<|j|tj}d|d<d|d<d|d<d|d
<d|d<|j|dS(sMAdd some dummy crash reports.

        This is mostly useful for test suites.s
libfoo1 1.2-3tPackagetfooRs
FooLinux Pi/2R+t11tSignals
/bin/crashtExecutablePathsfoo_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:30t
StacktraceTops
libfoo1 1.2-4s
Testux 1.0sfoo_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:30sbar 42-4tbars/usr/bin/brokensuh (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:29spython-goo 3epsilon1tpygoos
Testux 2.2s/usr/bin/pygoosTraceback (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 zeroRspython-goo 5N(RtReportR(R
R)((s>/usr/lib/python2.7/dist-packages/apport/crashdb_impl/memory.pyR	sL































N(t__name__t
__module__t__doc__RRRRRRR R"R#tFalseR%R,R0R3R4R6R7R:R;R<R=R>R	(((s>/usr/lib/python2.7/dist-packages/apport/crashdb_impl/memory.pyRs.		
	
				
										
	(RJtapport.crashdbRRR(((s>/usr/lib/python2.7/dist-packages/apport/crashdb_impl/memory.pyt<module>s