+
    ‚°ñj�  ã                  óÒ   € R t ^ RIHt ^ RIt^ RIHt ^ RIHt ^ RIt^ RI	H
t
Ht ^ RIHt ^ RIHt ^ RIH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 R ltR# )uV  Resolves a hash to a content row that can actually be served, and claims that
row so a concurrent writer cannot retire it mid-use. A row qualifies only if
its file exists, sits outside the temp directory, and its recorded size and
mtime still match the file â€” an unrecorded mtime excuses the mtime comparison
but never the size comparison.
)ÚannotationsN)ÚIterator)ÚPath)ÚselectÚupdate)ÚSession)Úmode)ÚAssetContentc               ó    € V ^8„  d   QhRRRR/# )é   ÚpathÚstrÚreturnÚbool© )Úformats   "Ú>C:\Ai_Coding\apps\studio\ComfyUI\app\assets\services\lookup.pyÚ__annotate__r      s   € ÷ ñ �sð ˜tñ ó    c                ó  €  \        \        P                  P                  \        P
                  ! 4       4      4      p\        \        P                  P                  V 4      4      pVP                  V4      #   \         d     R # i ; i)F)r   Úosr   ÚabspathÚfolder_pathsÚget_temp_directoryÚis_relative_toÚOSError)r   Ú	temp_rootÚ	candidates   &  r   Úis_temp_pathr      sa   € ðÜœŸ™Ÿ™¬×)HÒ)HÓ)JÓKÓLˆ	ÜœŸ™Ÿ™¨Ó.Ó/ˆ	Ø×'Ñ'¨	Ó2Ð2øÜô Úðús   ‚A3A6 Á6BÂBc               ó    € V ^8„  d   QhRRRR/# ©r   Úcontentr	   r   r   r   )r   s   "r   r   r      s   € ÷ 	ñ 	˜lð 	¨tñ 	r   c                óü   €  \         P                  ! V P                  4      pT P                  e   TP
                  T P                  8w  d   R # TP                  T P                  8w  d   R # R#   \         d     R # i ; i)FT)r   Ústatr   ÚFileNotFoundErrorÚmtime_nsÚst_mtime_nsÚst_sizeÚ
size_bytes)r!   r#   s   & r   Ú_stat_consistentr)      si   € ðÜ�wŠw�w—|‘|Ó$ˆð ×ÑÒ#¨×(8Ñ(8¸G×<LÑ<LÔ(LÙØ‡|�|�w×)Ñ)Ô)ÙÙøô ô Úðús   ‚ A, Á,A;Á:A;c               ó    € V ^8„  d   QhRRRR/# r    r   )r   s   "r   r   r   +   s   € ÷ ñ ˜ð ¨ñ r   c                óð   € V P                   '       * ;'       d_    \        P                  P                  V P                  4      ;'       d.    \	        V 4      ;'       d    \        V P                  4      '       * # ©N)Ú
is_missingr   r   Úisfiler)   r   )r!   s   &r   Ú
_qualifiesr/   +   s^   € à×ÑÔ÷ 	+ð 	+Ü�G‰G�N‰N˜7Ÿ<™<Ó(÷	+ð 	+ä˜WÓ%÷	+ð 	+ô ˜WŸ\™\Ó*Ô*ð	r   c               ó$   € V ^8„  d   QhRRRRRR/# )r   Úsessionr   Úhashr   r   zIterator[AssetContent]r   )r   s   "r   r   r   4   s"   € ÷ ñ ¨ð °sð Ð?Uñ r   c              #  ó^  "  € V P                  \        \        4      P                  \        P                  V8H  \        P
                  P                  R 4      4      P                  \        P                  \        P                  4      4      pV F  p\        V4      '       g   K  Vx € K  	  R# 5i)FN)Úscalarsr   r	   Úwherer2   r-   Úis_Úorder_byÚ
created_atÚidr/   )r1   r2   ÚrowsÚrows   &&  r   Úqualified_content_iteratorr<   4   ss   é € Ø�?‰?ÜŒ|Óß	‰Œ|× Ñ  DÑ(¬,×*AÑ*A×*EÑ*EÀeÓ*LÓ	Mß	‰”,×)Ñ)¬<¯?©?Ó	;ó€Dó
 ˆÜ�c�?Œ?ØŒIó ùs   ‚BB-Â#
B-c               ó(   € V ^8„  d   QhRRRRRRRR/# )r   r1   r   Ú
content_idr   r2   r   r   r   )r   s   "r   r   r   ?   s(   € ÷  ñ   Wð  ¸#ð  ÀSð  ÈTñ  r   c           	     ó8  € V P                  4       P                  \        \        4      P	                  \        P
                  V8H  \        P                  V8H  \        P                  P                  R4      4      P                  RR7      4      pVP                  ^8H  # )zÅClaim a live matching content row before attaching a record.

The conditional update takes this session's SQLite write lock through commit.
False means the row was retired or changed after lookup.
F)r-   )Ú
connectionÚexecuter   r	   r5   r9   r2   r-   r6   ÚvaluesÚrowcount)r1   r>   r2   Úresults   &&& r   Úclaim_qualified_contentrE   ?   s|   € ð ×ÑÓ!×)Ñ)ÜŒ|Óß	‰Ü�O‰O˜zÑ)Ü×Ñ Ñ%Ü×#Ñ#×'Ñ'¨Ó.ó

÷
 
‰˜5ˆÓ	!ó€Fð �?‰?˜aÑÐr   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r1   r   r>   r   r   úAssetContent | Noner   )r   s   "r   r   r   R   s"   € ÷ ñ  wð ¸Cð ÐDWñ r   c                ód   € V P                  \        VR R7      pVe   \        V4      '       g   R# V# )T)Úpopulate_existingN)Úgetr	   r/   )r1   r>   r!   s   && r   Úrefresh_qualified_contentrK   R   s-   € Ø�k‰kœ,¨
ÀdˆkÓK€GØ‚œj¨×1Ò1ÙØ€Nr   c               ó$   € V ^8„  d   QhRRRRRR/# ©r   r1   r   r2   r   r   rG   r   )r   s   "r   r   r   Y   s'   € ÷ Añ A 'ð A°ð AÐ9Lñ Ar   c                óf   € \         P                  ! 4       '       g   R # \        \        W4      R 4      # r,   )r   Úhashing_enabledÚnextr<   ©r1   r2   s   &&r   Úlookup_for_from_hashrR   Y   s'   € Ü×Ò×!Ò!ÙÜÔ*¨7Ó9¸4Ó@Ð@r   c               ó$   € V ^8„  d   QhRRRRRR/# rM   r   )r   s   "r   r   r   _   s'   € ÷ Añ A˜Wð A¨Cð AÐ4Gñ Ar   c                ó,   € \        \        W4      R 4      # r,   )rP   r<   rQ   s   &&r   Úlookup_for_viewrU   _   s   € ÜÔ*¨7Ó9¸4Ó@Ð@r   )Ú__doc__Ú
__future__r   r   Úcollections.abcr   Úpathlibr   r   Ú
sqlalchemyr   r   Úsqlalchemy.ormr   Ú
app.assetsr   Úapp.assets.database.modelsr	   r   r)   r/   r<   rE   rK   rR   rU   r   r   r   Ú<module>r^      sQ   ðñõ #ã 	Ý $Ý ã ß %Ý "å Ý 3õõ	õõõ õ&õA÷Ar   