+
    ‚°ñj	  ã                   óþ   € ^ RI t ^ RIHtHtHt ^ RIHt Rt ! R R]4      tR R lt	RR	 R
 llt
R R ltR R ltRR R llt]]]]],          ]],          3,          3,          t ! R R]4      tR R ltR R ltR# )é    N)ÚCallableÚ
NamedTupleÚProtocol)Ú	yield_gilg{®Gáz„?c                   ó,   a € ] tR t^t o V 3R ltRtV tR# )Ú_DirListingCounterc                ó&   <€ V ^8„  d   Qh/ S[ ;R&   # )é   Údirs_listed)Úint)ÚformatÚ__classdict__s   "€ÚBC:\Ai_Coding\apps\studio\ComfyUI\app\assets\services\file_utils.pyÚ__annotate__Ú_DirListingCounter.__annotate__   s   ø‡ ‚ ÙÑò ó    © N©Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__annotate_func__Ú__static_attributes__Ú__classdictcell__©r   s   @r   r   r      ó   ø‡ ‡ „ r   r   c                óD   € V ^8„  d   QhR\         P                  R\        /# )r
   Ústat_resultÚreturn)Úosr   r   )r   s   "r   r   r      s   € ÷ ñ œbŸn™nð ´ñ r   c                óP   € \        V R\        V P                  R,          4      4      # )z0Extract mtime in nanoseconds from a stat result.Úst_mtime_nsi Êš;)Úgetattrr   Úst_mtime)r   s   &r   Úget_mtime_nsr&      s&   € äØ�]¤C¨×(<Ñ(<¸}Õ(LÓ$Móð r   c                ó^   € V ^8„  d   QhR\         R\        R\        \        \        3,          /# )r
   ÚpathÚfollow_symlinksr    )ÚstrÚboolÚtupler   )r   s   "r   r   r      s*   € ÷ (ñ (¤ð (´dð (ÄeÌCÔQTÈHÅoñ (r   c                ó^   € \         P                  ! WR7      pVP                  \        V4      3# )z0Get file size in bytes and mtime in nanoseconds.)r)   )r!   ÚstatÚst_sizer&   )r(   r)   Ústs   && r   Úget_size_and_mtime_nsr1      s$   € ä	�Š�Ô	7€BØ�:‰:”| BÓ'Ð'Ð'r   c                óx   € V ^8„  d   QhR\         R,          R\         R,          R\        P                  R\        /# )r
   Úmtime_dbNÚsize_dbr   r    )r   r!   r   r+   )r   s   "r   r   r      s<   € ÷ ñ Ü�D�jðä�4�Zðô —‘ðô 
ñ	r   c                ó¨   € V f   R# \        V4      p\        V 4      \        V4      8w  d   R# Ve"   \        VP                  4      \        V4      8H  # R# )z÷Check if a file is unchanged based on mtime and size.

Returns True if the file's mtime and size match the database values.
Returns False if mtime_db is None or values don't match.

size_db=None means don't check size; 0 is a valid recorded size.
FT)r&   r   r/   )r3   r4   r   Úactual_mtime_nss   &&& r   Úverify_file_unchangedr7      sN   € ð ÒÙÜ" ;Ó/€OÜ
ˆ8ƒ}œ˜OÓ,Ô,ÙØÒÜ�;×&Ñ&Ó'¬3¨w«<Ñ7Ð7Ùr   c                ó0   € V ^8„  d   QhR\         R\        /# )r
   Únamer    )r*   r+   )r   s   "r   r   r   2   s   € ÷ $ñ $”Sð $œTñ $r   c                ó.   € V P                  R4      '       * # )z@Return True if a file or directory name is visible (not hidden).Ú.)Ú
startswith)r9   s   &r   Ú
is_visibler=   2   s   € à�‰˜sÓ#Ô#Ð#r   c          	      ó”   € V ^8„  d   QhR\         R\        R,          R\        . \        3,          R,          R\        \         ,          /# )r
   Úbase_dirÚcounterNÚshould_stopr    )r*   r   r   r+   Úlist)r   s   "r   r   r   7   sG   € ÷ 'ñ 'Üð'ä $Õ&ð'ô ˜"œd˜(Õ# dÕ*ð'ô 
Œ#…Yñ	'r   c           
     ót  € . p\         P                  P                  V 4      p\         P                  P                  V4      '       g   V# \	        4       p\         P
                  ! VRRR7       EF  w  rgpVe   V! 4       '       d    V# Ve   V;P                  ^,          un         \         P                  ! V4      p	V	P                  V	P                  3p
Y¥9   d   TP                  4        K  TP                  T
4       T Uu. uF  p\        T4      '       g   K  TNK  	  upTR&   T Fa  p\        T4      '       g   K  TP                  \         P                  P                  \         P                  P                  Yl4      4      4       Kc  	  EK"  	  V#   \         d    TP                  4         EKE  i ; iu upi )zñRecursively list all files in a directory, following symlinks.

``counter.dirs_listed`` gains one per directory os.walk listed. ``should_stop`` is
called before each directory; it may block, and True ends the walk early with a
partial list.
T)ÚtopdownÚfollowlinks:NNN)r!   r(   ÚabspathÚisdirÚsetÚwalkr   r.   Úst_devÚst_inoÚOSErrorÚclearÚaddr=   ÚappendÚjoin)r?   r@   rA   ÚoutÚbase_absÚ	seen_dirsÚdirpathÚsubdirsÚ	filenamesr0   Údir_idÚdr9   s   &&&          r   Úlist_files_recursivelyrY   7   sZ  € ð €CÜ�w‰w�‰˜xÓ(€HÜ�7‰7�=‰=˜×"Ò"Øˆ
ä&)£e€IÜ')§w¢wØ˜$¨D÷(ð (Ñ#ˆ˜)ð Ò"¡{§}¢}Øð$ €Jð# ÒØ×Ò 1Õ$Õð	Ü—’˜Ó!ˆBØ—i‘i §¡Ð+ˆFð ÔØ�M‰MŒOÙØ�‰�fÔÙ!(Ó:¡˜A¬J°q¯M—a�a¡Ñ:ˆ�‰
ÛˆDÜ˜d×#Ò#ÙØ�J‰J”r—w‘w—‘¤r§w¡w§|¡|°GÓ'BÓCÖDô ñ%(ð, €Jøô ô 	Ø�M‰MŒOÛð	üò ;s   Â%.FÄ F5ÄF5ÆF2Æ1F2c                   ó,   a € ] tR t^et o V 3R ltRtV tR# )ÚListingWalkc                óN   <€ V ^8„  d   Qh/ S[ S[,          ;R&   S[;R&   S[;R&   # )r
   ÚfilesÚlistingsr   )rB   r*   ÚDirListingsr   )r   r   s   "€r   r   ÚListingWalk.__annotate__e   s,   ø‡ ‚ Ù‘�9Ññ áÑñ ñ Ñò r   r   Nr   r   s   @r   r[   r[   e   r   r   r[   c                ó~   € V ^8„  d   QhR\         R\        \        \         ,          \        \         ,          3,          /# )r
   rT   r    )r*   r,   rB   )r   s   "r   r   r   k   s,   € ÷ ñ ¤3ð ¬5´´cµ¼DÄ½IÐ1EÕ+Fñ r   c                óJ  € . p. p\         P                  ! V 4      ;_uu_ 4       pV FÈ  p\        \        R7       \	        VP
                  4      '       g   K0   VP                  4       pV'       d   VP                  VP
                  4       Kf  VP                  4       '       d2   \         P                  P                  VP                  4      '       g   K­  VP                  VP
                  4       KÊ  	  RRR4       W3#   \         d    Rp L¥i ; i  + '       g   i     Y3# ; i)a'  One directory's visible (file names, subdir names), classified as os.walk does:
anything whose is_dir() is false or raises is a file. The exception is a symlink
whose target is gone: it is left out, so a row for it reads as vanished, as it did
when the rescan stat'ed every row through the link.©ÚrunFN)r!   Úscandirr   ÚRESCAN_YIELD_RUNr=   r9   Úis_dirrL   rO   Ú
is_symlinkr(   Úexists)rT   r]   rU   ÚentriesÚentryrg   s   &     r   Ú_list_visible_entriesrl   k   sÖ   € ð
 €EØ€GÜ	�Š�G×	Ô	 ÛˆEÜÔ*Õ+Ü˜eŸj™j×)Ò)ÙðØŸ™›�÷ Ø—‘˜uŸz™zÖ*Ø×&Ñ&×(Ò(´·±·±ÀÇ
Á
×1KÔ1KØ—‘˜UŸZ™ZÖ(ñ ÷ 
ð ˆ>Ðøô ô Ø’ðú÷ 
Ö	ð ˆ>ÐúsA   £3DÁC=Á'DÁ/2DÂ",DÃDÃ=D	Ä
DÄD	ÄDÄD"	c                ó0   € V ^8„  d   QhR\         R\        /# )r
   r?   r    )r*   r[   )r   s   "r   r   r   ‚   s   € ÷ "7ñ "7œCð "7¤Kñ "7r   c           	     óø  a
€ . p/ p\        4       p\        P                  P                  V 4      .pV'       Ed	   \	        \
        R7       VP                  4       o
 \        P                  ! S
4      pTP                  TP                  3pYc9   d   K`   \        S
4      w  rxTP                  T4       Yx3TS
&   T F_  p	\	        \
        R7       TP                  \        P                  P                  \        P                  P                  S
T	4      4      4       Ka  	  TP                  T
3R l\!        T4       4       4       EK  \#        W\%        V4      4      #   \         d     EK5  i ; i  \         d     EKH  i ; i)aœ  list_files_recursively, also returning every directory listing it read.

Same traversal as the os.walk version (visit order, symlink following, device/inode
cycle guard, hidden filtering), except each directory is stat'ed before it is listed.
``listings`` holds exactly the directories this walk listed, keyed by normalized
absolute path, so it doubles as the record of which directories the walk can vouch for.
rc   c              3   ód   <"  € T F%  p\         P                  P                  SV4      x € K'  	  R # 5i)N)r!   r(   rP   )Ú.0r9   rT   s   & €r   Ú	<genexpr>Ú walk_listings.<locals>.<genexpr>£   s%   øé € ÐOÑ=N°T”R—W‘W—\‘\ '¨4×0Ð0Ó=Nùs   ƒ-0)rH   r!   r(   rF   r   rf   Úpopr.   rL   rJ   rK   rl   rN   rO   rP   ÚextendÚreversedr[   Úlen)r?   r]   r^   rS   Ústackr0   rW   ÚnamesrU   r9   rT   s   &         @r   Úwalk_listingsry   ‚   s.  ø€ ð €EØ€Hô '*£e€IÜ�W‰W�_‰_˜XÓ&Ð'€Eß
ˆ%ÜÔ&Õ'Ø—)‘)“+ˆð	Ü—’˜Ó!ˆBð —)‘)˜RŸY™YÐ'ˆØÔÙð	Ü2°7Ó;‰NˆEð 	�‰�fÔØ"Ð,ˆ�ÑÛˆDÜÔ*Õ+Ø�L‰LœŸ™Ÿ™¬¯©¯©°g¸tÓ)DÓEÖFñ ð 	�‰ÔO¼XÀgÔ=NÓO×OÜ�u¬¨H«Ó6Ð6øô ô 	Ûð	ûô ô 	Ûð	ús$   ÁE ÂE) ÅE&Å%E&Å)E9Å8E9)T)NN)r!   Útypingr   r   r   Úapp.assets.services.gilr   rf   r   r&   r1   r7   r=   rY   Údictr*   r,   rB   r_   r[   rl   ry   r   r   r   Ú<module>r}      sx   ðÛ 	ß 1Ñ 1å -ð Ð ô˜ô õ÷(õõ,$÷
'ðV �3˜˜d 3�i¨¨c­Ð2Õ3Ð3Õ4€ô�*ô õ÷."7r   