+
    &j'                        ^ RI t ^ RIt^ RIt^ RIHtHt ^ RIHtHtH	t
 ^ RIHt ^ RIHt ^RIHtHtHt . ROt]P(                  ! ]4      t ! R R]4      t ! R R]4      t ! R R	]4      t ! R R]4      t]! 4       t ! R R
]4      tR# )    N)ABCabstractmethod)_getattribute_Picklerwhichmodule)
ModuleType)Any)demangleget_mangle_prefix
is_mangledObjNotFoundErrorObjMismatchErrorImporterOrderedImporterc                       ] tR t^tRtRtR# )r   zHRaised when an importer cannot find an object by searching for its name. N__name__
__module____qualname____firstlineno____doc____static_attributes__r       n/Users/jameslopez/projects/CWCArchive/cwc-podcast/.venv/lib/python3.14/site-packages/torch/package/importer.pyr   r      s    Rr   c                       ] tR t^tRtRtR# )r   z]Raised when an importer found a different object with the same name as the user-provided one.r   Nr   r   r   r   r   r      s    gr   c                   t   a  ] tR t^t o Rt]V 3R lR l4       tRV 3R lR lltV 3R lR ltV 3R	 lt	R
t
V tR# )r   a,  Represents an environment to import modules from.

By default, you can figure out what module an object belongs by checking
__module__ and importing the result using __import__ or importlib.import_module.

torch.package introduces module importers other than the default one.
Each PackageImporter introduces a new namespace. Potentially a single
name (e.g. 'foo.bar') is present in multiple namespaces.

It supports two main operations:
    import_module: module_name -> module object
    get_name: object -> (parent module name, name of obj within module)

The guarantee is that following round-trip will succeed or throw an ObjNotFoundError/ObjMisMatchError.
    module_name, obj_name = env.get_name(obj)
    module = env.import_module(module_name)
    obj2 = getattr(module, obj_name)
    assert obj1 is obj2
c                &   < V ^8  d   QhRS[ RS[/#    module_namereturnstrr   )format__classdict__s   "r   __annotate__Importer.__annotate__4   s        r   c                    R# )zfImport `module_name` from this environment.

The contract is the same as for importlib.import_module.
Nr   selfr!   s   &&r   import_moduleImporter.import_module3   s    r   Nc                P   < V ^8  d   QhRS[ RS[R,          RS[S[S[3,          /# r    objnameNr"   r	   r$   tuple)r%   r&   s   "r   r'   r(   :   s3     U$ U$C U$sTz U$U38_ U$r   c                  a a Sfd   V'       d\   \         P                  P                  \        V4      4      f2   \	        VRR4      pVe!    V! 4       p\        V\        4      '       d   VoSf   \	        VRR4      oSf   VP                  oS P                  VS4      p\        V4      p S P                  V4      p\        P                  R8  d   \        VSP                  R4      4      pM\        VS4      w  r WJ d   VS3# VV 3R lp
V
! V4      w  rpV
! V4      w  rpRV RV R	V R
V RV RV R2p\)        V4      h  \         d     Li ; i  \         \"        \$        3 d    \'        T RT RS 24      Rhi ; i)a  Given an object, return a name that can be used to retrieve the
object from this environment.

Args:
    obj: An object to get the module-environment-relative name for.
    name: If set, use this name instead of looking up __name__ or __qualname__ on `obj`.
        This is only here to match how Pickler handles __reduce__ functions that return a string,
        don't use otherwise.
Returns:
    A tuple (parent_module_name, attr_name) that can be used to retrieve `obj` from this environment.
    Use it like:
        mod = importer.import_module(parent_module_name)
        obj = getattr(mod, attr_name)

Raises:
    ObjNotFoundError: we couldn't retrieve `obj by name.
    ObjMisMatchError: we found a different object with the same name as `obj`.
N
__reduce__r   .z was not found as c                    < Sf   \        R4      hSP                  V S4      p\        V4      pV'       d   \        V4      MRpV'       d   R\        V4       2MRpWV3# )Nzname must not be Nonezthe current Python environmentzthe importer for z'sys_importer')AssertionErrorr   r   r   )r0   r!   is_mangled_locationimporter_namer1   r+   s   &    r   get_obj_info'Importer.get_name.<locals>.get_obj_infou   st    |$%<==**35K$[1K  "+.5   $$5k$B#CD% 
 -77r   z

The object provided is from 'z', which is coming from z.
However, when we import 'z', it's coming from z@.
To fix this, make sure this 'PackageExporter's importer lists z before )      )r   dispatchgettypegetattr
isinstancer$   	Exceptionr   r   r
   r,   sysversion_infor   splitImportErrorKeyErrorAttributeErrorr   r   )r+   r0   r1   reducervorig_module_namer!   moduleobj2_r<   obj_module_nameobj_locationobj_importer_nameobj2_module_nameobj2_locationobj2_importer_namemsgs   f&f               r   get_nameImporter.get_name:   s   & <CH$5$5$9$9$s)$D$L S,5F!B!"c**! <35D<<<D++C6 /0	''4F7* %VTZZ_='5a ;$$	8" <H;L8'8>J4>P;);//@ A$$0> 2**:);;OP] _O !*<)=Q	@ 	 s##q ! , X~6 	"%)+av>	s%   E  )AE +E  EE+E<c                ,   < V ^8  d   QhRS[ RS[RS[/# r    r0   r1   r"   r	   r$   )r%   r&   s   "r   r'   r(      s"      s # # r   c                   \        VRR4      pVe   V# V P                  P                  4       P                  4        F4  w  r4VR8X  g   VR8X  g   Vf   K   \	        WB4      ^ ,          VJ d   Vu # K6  	  R#   \
         d     KH  i ; i)zFind the module name an object belongs to.

This should be considered internal for end-users, but developers of
an importer can override it to customize the behavior.

Taken from pickle.py, but modified to exclude the search into sys.modules
r   N__main____mp_main__)rC   modulescopyitemsr   rK   )r+   r0   r1   r!   rO   s   &&&  r   r   Importer.whichmodule   s     c<6" $(<<#4#4#6#<#<#>Kz)-/> .q1S8&& 9 $?  " s   A66BBc                <   < V ^8  d   Qh/ S[ S[S[3,          ;R&   # )r    ra   )dictr$   r   )r%   r&   s   "r   r'   r(      s     * #z/""+ r   r   N)r   r   r   r   r   r   r,   rY   r   __annotate_func__r   __classdictcell__r&   s   @r   r   r      s=     ,  U$ U$n k  r   c                   H   a  ] tR t^t o RtV 3R lR ltV 3R lR ltRtV tR# )_SysImporterz;An importer that implements the default behavior of Python.c                    < V ^8  d   QhRS[ /# )r    r!   )r$   )r%   r&   s   "r   r'   _SysImporter.__annotate__   s     4 4 4r   c                .    \         P                  ! V4      # rg   )	importlibr,   r*   s   &&r   r,   _SysImporter.import_module   s    &&{33r   c                ,   < V ^8  d   QhRS[ RS[RS[/# r\   r]   )r%   r&   s   "r   r'   rn      s"     . .s .# .# .r   c                >    \        VR R4      pVe   V# \        W4      # )r   N)rC   _pickle_whichmodule)r+   r0   r1   r!   s   &&& r   r   _SysImporter.whichmodule   s)     c<6""3--r   r   N)	r   r   r   r   r   r,   r   r   ri   rj   s   @r   rl   rl      s     E4 4. .r   rl   c                   j   a  ] tR t^t o RtR tR tRV 3R lR lltV 3R lR ltV 3R	 lR
 lt	Rt
V tR# )r   zA compound importer that takes a list of importers and tries them one at a time.

The first importer in the list that returns a result "wins".
c                &    \        V4      V n        R # rg   )list
_importers)r+   argss   &*r   __init__OrderedImporter.__init__   s    *.t*r   c                    \        VRR4      '       g   R# \        VR4      '       g   R# \        VR4      '       g   R# VP                  RJ # )a  Returns true iff this module is an empty PackageNode in a torch.package.

If you intern `a.b` but never use `a` in your code, then `a` will be an
empty module with no source. This can break cases where we are trying to
re-package an object after adding a real dependency on `a`, since
OrderedImportere will resolve `a` to the dummy package and stop there.

See: https://github.com/pytorch/pytorch/pull/71520#issuecomment-1029603769
__torch_package__F__path____file__TN)rC   hasattrr   )r+   rO   s   &&r   _is_torchpackage_dummy&OrderedImporter._is_torchpackage_dummy   sF     v2E::vz**vz**$&&r   Nc                P   < V ^8  d   QhRS[ RS[R,          RS[S[S[3,          /# r/   r2   )r%   r&   s   "r   r'   OrderedImporter.__annotate__   s.     
 
C 
sTz 
U38_ 
r   c           
        V P                    F  p VP                  W4      u # 	  \        RV RV RV P                    24      h  \        \        3 d/   pR T RT RT RT 2p\        P                  T4        Rp?Kq  Rp?ii ; i)z Tried to call get_name with obj z, and name z on z	 and got NzCould not find obj z
 and name z in any of the importers )ry   rY   r   r   logwarning)r+   r0   r1   importerewarning_messages   &&&   r   rY   OrderedImporter.get_name   s    H-((33 ( !#j6OPTP_P_O`a
 	
 %&67 -6se <  $vT(9QCA   O,,-s   AB#A>>Bc                &   < V ^8  d   QhRS[ RS[/# r   r#   )r%   r&   s   "r   r'   r      s     3 3 3 3r   c                &   R pV P                    FT  p\        V\        4      '       g   \        V R24      h VP	                  V4      pV P                  V4      '       d   KR  Vu # 	  Ve   Vh\        V4      h  \         d   pTp R p?K|  R p?ii ; i)NzP is not a Importer. All importers in OrderedImporter must inherit from Importer.)ry   rD   r   	TypeErrorr,   r   ModuleNotFoundError)r+   r!   last_errr   rO   errs   &&    r   r,   OrderedImporter.import_module   s    Hh11j !S S !//<..v66 ( N%k22 ' s   'A8!A88BBBc                ,   < V ^8  d   QhRS[ RS[RS[/# r\   r]   )r%   r&   s   "r   r'   r      s"      s # # r   c                d    V P                    F  pVP                  W4      pVR 8w  g   K  Vu # 	  R # )r_   )ry   r   )r+   r0   r1   r   r!   s   &&&  r   r   OrderedImporter.whichmodule   s3    H"..s9Kj("" (
 r   )ry   rg   )r   r   r   r   r   r{   r   rY   r,   r   r   ri   rj   s   @r   r   r      s2     
5'$
 
3 3* r   )r   r   r   r   )rp   loggingrF   abcr   r   pickler   r   r   rt   typesr   typingr	   	_manglingr
   r   r   __all__	getLoggerr   r   rE   r   r   r   rl   sys_importerr   r   r   r   <module>r      s      
 # 
   > > R!Sy Shy hPs Pf.8 .  ~Dh Dr   