+
    ni*  c                   sf    R t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIHt  ! R R4      t	 ! R R4      t
R# )zo
Implementation of the XDG Recent File Storage Specification
http://standards.freedesktop.org/recent-file-spec
N)ParsingErrorc                   s`   a  ] tR t^
t o R tRR ltR tRR ltRR ltRR lt	R t
R	 tR
tV tR# )RecentFilesc                s"    . V n         R V n        R# ) Nr   filenameself   &4/usr/lib/python3.14/site-packages/xdg/RecentFiles.py__init__ZRecentFiles.__init__   s        Nc                s*   V'       g5   \         P                  P                  \         P                  ! R4      R4      p \        P
                  P                  P                  V4      pYn        TP                   F  pTP                  \        P
                  P                   P"                  8X  g   K8  TP$                  R8X  g   KK  TP                   F\  pTP                  \        P
                  P                   P"                  8X  g   K8  TP$                  R8X  g   KK  T P'                  T4       K^  	  K  	  T P)                  4        R#   \         d    \        RT4      h\        P                  P                  P                   d    \        RT4      hi ; i)zQParse a list of recently used files.

filename defaults to ``~/.recently-used``.
ZHOMEz.recently-usedFile not foundzNot a valid .menu filer   Z
RecentItemN)osZpathZjoinZgetenvxmldomZminidomparseZIOErrorr    ZparsersZexpatZ
ExpatErrorr   
childNodesnodeTypeNodeELEMENT_NODEtagName_RecentFiles__parseRecentItemsort)r   r   ZdocZchildrecent   &&   r   r   ZRecentFiles.parse   s   
 ww||BIIf$57GHH	C''//''1C !^^E~~!:!::==M1"'"2"2!??cggll.G.GG%~~= $ 6 6v > #3 $ 			  	;/::{{  ++ 	C7BB	Cs   )E =FFc                s   \        4       pV P                  P                  V4       VP                   EF  pVP                  \
        P                  P                  P                  8X  g   K9  VP                  R 8X  d%   VP                  ^ ,          P                  Vn        Kn  VP                  R8X  d%   VP                  ^ ,          P                  Vn        K  VP                  R8X  d.   \        VP                  ^ ,          P                  4      Vn        K  VP                  R8X  d
   RVn        K  VP                  R8X  g   EK  VP                   F  pVP                  \
        P                  P                  P                  8X  g   K8  VP                  R8X  g   KK  VP                   P                  VP                  ^ ,          P                  4       K  	  EK  	  R# )URIz	Mime-Type	TimestampPrivateTGroupsZGroupN)
RecentFiler   appendr   r   r   r   r   r   r   Z	nodeValuer   MimeTypeintr   ZPrviater   )r   itemr   Z	attributegroupr   r   Z__parseRecentItemZRecentFiles.__parseRecentItem*   s;   'I!!SWW\\%>%>>$$-!*!5!5a!8!B!BFJ&&+5&/&:&:1&=&G&GFO&&+5'*9+?+?+B+L+L'MF$&&)3%)FN&&(2!*!5!5 >>SWW\\-F-FF$}}7 & 4 4U5E5Ea5H5R5R S "6 )r
   c           	     sp   V'       g   V P                   '       g   \        RV4      hV'       g   V P                   p\        VR4      ;_uu_ 4       p\        P                  ! V\        P
                  4       VP                  R4       VP                  R4       V P                   EF<  pVP                  R4       VP                  R\        P                  P                  P                  VP                  4      ,          4       VP                  RVP                  ,          4       VP                  RVP                  ,          4       VP                  R	8X  d   VP                  R
4       \!        VP"                  4      ^ 8  dN   VP                  R4       VP"                   F  pVP                  RV,          4       K  	  VP                  R4       VP                  R4       EK?  	  VP                  R4       \        P                  ! V\        P$                  4       RRR4       R#   + '       g   i     R# ; i)zWrite the list of recently used files to disk.

If the instance is already associated with a file, filename can be
omitted to save it there again.
r   Zwz<?xml version="1.0"?>
z<RecentFiles>
z  <RecentItem>
z    <URI>%s</URI>
z    <Mime-Type>%s</Mime-Type>
z    <Timestamp>%s</Timestamp>
Tz    <Private/>
z    <Groups>
z      <Group>%s</Group>
z    </Groups>
z  </RecentItem>
z</RecentFiles>
N)r   r    ZopenfcntlZlockfZLOCK_EXwriter   r   ZsaxZsaxutilsZescaper   r   r   r   lenr   ZLOCK_UN)r   r   ZfZrr"   r   r   r$   ZRecentFiles.write?   sx    /::}}H(C  AKK5==)GG-.GG%&%%*+-0@0@0G0G0NNO9AJJFG9AKKGH99$GG./qxx=1$GG,-!" ;e CD "*GG-.+, & GG&'KK5==)) !   s   GH$$H5	c                s   . p^ pV P                    F  pV'       d7   V F/  pWvP                  9   g   K  VP                  V4       V^,          pK1  	  MiV'       d7   V F/  pWP                  8X  g   K  VP                  V4       V^,          pK1  	  M+VP                  R8X  d   VP                  V4       V^,          pV^ 8w  g   K  WS8X  g   K   V# 	  V# )zGet a list of recently used files.

The parameters can be used to filter by mime types, by group, or to
limit the number of items returned. By default, the entire list is
returned, except for items marked private.
F)r   r   r   r   r   )	r   Z	mimetypesgroupsZlimitZtmpZir!   r"   mimetypes	   &&&&     r   getFilesZRecentFiles.getFiles`   s     $$D#E+

4(Q $  )H==0

4(Q !*
 <<5(JJt$FAzaj
% %$ 
r
   c                s   WP                   9   d0   V P                   P                  V4      pV P                   V,          pMY\        V P                   4      R8X  d   V P                   P                  4        \	        4       pV P                   P                  V4       Wn        W&n        \        \        P                  ! 4       4      Vn
        WFn        V'       d   W6n        V P                  4        R# )zeAdd a recently used file.

item should be the URI of the file, typically starting with ``file:///``.
i  N)r   indexr%   Zpopr   r   r   r   r    timer   r   r   r   )r   r!   r'   r&   Zprivater)   r   s   &&&&&  r   addFileZRecentFiles.addFile}   s     ###$$**40E%%e,F 4##$+  $$&\F##F+
"tyy{+ "M		r
   c                s`    WP                   9   d   V P                   P                  V4       R# R# )z<Remove a recently used file, by URI, from the list.
        N)r   Zremove)r   r!      &&r   
deleteFileZRecentFiles.deleteFile   s)     #####D) $r
   c                sn    V P                   P                  4        V P                   P                  4        R # N)r   r   Zreverser   r   r   r   ZRecentFiles.sort   s&      "r
   r   r.   )NNi    )NF)__name__
__module____qualname____firstlineno__r	   r   r   r$   r(   r+   r-   r   __static_attributes____classdictcell__Z__classdict__   @r   r   r   
   s4     6T**B:4*# #r
   r   c                   s>   a  ] tR t^t o R tR tR tR tR tRt	V t
R# )r   c                sL    R V n         R V n        R V n        RV n        . V n        R# )r   FN)r   r   r   r   r   r   r   r   r	   ZRecentFile.__init__   s%    r
   c                sB    \        V P                  VP                  4      # r.   )Zcmpr   r   Zotherr,   r   __cmp__ZRecentFile.__cmp__   s    4>>5??33r
   c                s4    V P                   VP                   8  # r.   )r   r7   r,   r   __lt__ZRecentFile.__lt__   s    ~~//r
   c                s2    V P                   \        V4      8H  # r.   )r   Zstrr7   r,   r   __eq__ZRecentFile.__eq__   s    xx3u:%%r
   c                s    V P                   # r.   )r   r   r   r   __str__ZRecentFile.__str__   s    xxr
   )r   r   r   r   r   N)r/   r0   r1   r2   r	   r8   r9   r:   r;   r3   r4   r5   r6   r   r   r      s#     40& r
   r   )Z__doc__Zxml.dom.minidomr   Zxml.sax.saxutilsr   r*   r#   Zxdg.Exceptionsr    r   r   ) r
   r   <module>r<      s/   
 )   'U# U#p r
   