
    Th{                     d    S SK rS SKJr  S SKJr  S SKrS SKJr  Sr " S S5      r	 " S S	5      r
g)
    N)glob)cast)Storagez.data/serialization_idc                        \ rS rSrS rS rSrg)_HasStorage   c                     Xl         g N_storage)selfstorages     Y/var/www/fran/franai/venv/lib/python3.13/site-packages/torch/package/_directory_reader.py__init___HasStorage.__init__   s        c                     U R                   $ r
   r   r   s    r   r   _HasStorage.storage   s    }}r   r   N)__name__
__module____qualname____firstlineno__r   r   __static_attributes__ r   r   r   r      s     r   r   c                   <    \ rS rSrSrS rS rS rS rS r	S r
S	rg
)DirectoryReader   aZ  
Class to allow PackageImporter to operate on unzipped packages. Methods
copy the behavior of the internal PyTorchFileReader class (which is used for
accessing packages in all other cases).

N.B.: ScriptObjects are not depickleable or accessible via this DirectoryReader
class due to ScriptObjects requiring an actual PyTorchFileReader instance.
c                     Xl         g r
   	directory)r   r!   s     r   r   DirectoryReader.__init__    s    "r   c                     U R                    SU 3n[        US5       nUR                  5       sS S S 5        $ ! , (       d  f       g = f)N/rb)r!   openread)r   namefilenamefs       r   
get_recordDirectoryReader.get_record#   s8    nn%Qtf-(D!Q668 "!!s	   8
Ac                     U R                    SU 3n[        R                  R                  U5      U-  n[	        [
        [        R                  5      n[        UR                  XES95      $ )Nr$   )r)   nbytes)	r!   torch_utils_element_sizer   r   UntypedStorager   	from_file)r   r(   numeldtyper)   r.   r   s          r   get_storage_from_record'DirectoryReader.get_storage_from_record(   s[    nn%Qtf-++E2U:w 4 457,,h,NOOr   c                     [         R                  R                  U R                  U5      n[         R                  R	                  U5      $ r
   )ospathjoinr!   isfile)r   r:   	full_paths      r   
has_recordDirectoryReader.has_record.   s-    GGLL6	ww~~i((r   c                     [        U R                   S3SS9 Vs/ s HD  n[        R                  R	                  U5      (       a  M)  U[        U R                  5      S-   S  PMF     nnU$ s  snf )Nz/**T)	recursive   )r   r!   r9   r:   isdirlen)r   r)   filess      r   get_all_recordsDirectoryReader.get_all_records2   sk    
 !DNN#33!74H
H77==* 0HS(1,./H 	 

 
s   (A)A)c                 b    U R                  [        5      (       a  U R                  [        5      $ g)N )r>    __serialization_id_record_name__r+   r   s    r   serialization_id DirectoryReader.serialization_id<   s'     ??;<<??#CDDr   r    N)r   r   r   r   __doc__r   r+   r6   r>   rF   rK   r   r   r   r   r   r      s&    #
P)r   r   )os.pathr9   r   typingr   r/   torch.typesr   rJ   r   r   r   r   r   <module>rQ      s0         $<   , ,r   