§
    ÈtºfØ  ã                   óò   — U d Z ddlZddlZddlZddlZddlmZ ddlmZ ddlm	Z	 ddl
mZmZ  ej        ¦   «         a G d„ d¦  «        Zi Ze	eef         ed	<   d
„ Zd„ Z G d„ de¦  «        Zd„ Zd„ Zdd„ZdS )z&
*Real* reloading support for Python.
é    N)Úreload)Ú
ModuleType)ÚDict)ÚlogÚreflectc                   ó(   — e Zd ZdZeZd„ Zd„ Zd„ ZdS )Ú	SensitivezÐ
    A utility mixin that's sensitive to rebuilds.

    This is a mixin for classes (usually those which represent collections of
    callbacks) to make sure that their code is up-to-date before running.
    c                 ó&   — | j         t           k     }|S ©N)ÚlastRebuild)ÚselfÚyns     úU/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/twisted/python/rebuild.pyÚneedRebuildUpdatezSensitive.needRebuildUpdate$   s   € ØÔ¥Ò+ˆØˆ	ó    c                 ó6   — t          j         ¦   «         | _        d S r   )Útimer   ©r   s    r   ÚrebuildUpToDatezSensitive.rebuildUpToDate(   s   € Ýœ9™;œ;ˆÔÐÐr   c                 ó   — t          |¦  «        }|t          j        k    rt          |¦  «        S |t          j        k    r;|j        €t          |j        |j        ¦  «        S t          |j        |j        ¦  «        S t          j
        d¦  «         |S )z¡
        Get the latest version of an object.

        This can handle just about anything callable; instances, functions,
        methods, and classes.
        Nzwarning returning anObject!)ÚtypeÚtypesÚFunctionTypeÚlatestFunctionÚ
MethodTypeÚ__self__ÚgetattrÚim_classÚ__name__r   Úmsg)r   ÚanObjectÚts      r   ÚlatestVersionOfzSensitive.latestVersionOf+   s„   € õ �‰NŒNˆØ•Ô"Ò"Ð"Ý! (Ñ+Ô+Ð+Ø•%Ô"Ò"Ð"ØÔ Ð(Ý˜xÔ0°(Ô2CÑDÔDÐDå˜xÔ0°(Ô2CÑDÔDÐDåŒGÐ1Ñ2Ô2Ð2ØˆOr   N)r   Ú
__module__Ú__qualname__Ú__doc__r   r   r   r#   © r   r   r	   r	      sR   € € € € € ðð ð €Kðð ð ð'ð 'ð 'ðð ð ð ð r   r	   Ú_modDictIDMapc                 ó�   — t          | j        ¦  «        }t                               |¦  «        }|€| S t	          || j        ¦  «        S )z/
    Get the latest version of a function.
    )ÚidÚ__globals__r(   Úgetr   r   )ÚoldFuncÚdictIDÚmodules      r   r   r   B   sD   € õ �Ô#Ñ$Ô$€FÝ×Ò˜vÑ&Ô&€FØ€~ØˆÝ�6˜7Ô+Ñ,Ô,Ð,r   c                 óh  — t          j        | j        ¦  «        }t          || j        ¦  «        }d„ |j        D ¦   «         }|j        dk    r|S 	 t          |¦  «        |_        |S # t          $ rC t          |¦  «        } ||j        t          |¦  «        t          |j
        ¦  «        ¦  «        cY S w xY w)z,
    Get the latest version of a class.
    c                 ó,   — g | ]}t          |¦  «        ‘ŒS r'   )ÚlatestClass)Ú.0Úbases     r   ú
<listcomp>zlatestClass.<locals>.<listcomp>U   s    € ÐAÐAÐA d•˜DÑ!Ô!ÐAÐAÐAr   Úbuiltins)r   ÚnamedModuler$   r   r   Ú	__bases__ÚtupleÚ	TypeErrorr   ÚdictÚ__dict__)ÚoldClassr/   ÚnewClassÚnewBasesÚctors        r   r2   r2   O   sÃ   € õ Ô  Ô!4Ñ5Ô5€FÝ�v˜xÔ0Ñ1Ô1€HØAÐA¨hÔ.@ÐAÑAÔA€HàÔ˜jÒ(Ð(àˆðQå" 8™_œ_ˆÔØˆøÝð Qð Qð QÝ�H‰~Œ~ˆØˆt�HÔ%¥u¨X¡¤½¸XÔ=NÑ8OÔ8OÑPÔPÐPÐPÐPðQøøøs   ÁA$ Á$A
B1Â0B1c                   ó   — e Zd ZdZdS )ÚRebuildErrorzT
    Exception raised when trying to rebuild a class whereas it's not possible.
    N)r   r$   r%   r&   r'   r   r   rB   rB   d   s   € € € € € ðð ð ð r   rB   c                 ó8   — t          | j        ¦  «        | _        dS )z,
    Updates an instance to be current.
    N)r2   Ú	__class__r   s    r   ÚupdateInstancerE   j   s   € õ ! ¤Ñ0Ô0€D„N€N€Nr   c                 óÒ   — |dk    rt          d¦  «        ‚t          | ¦  «         t          j        dt	          j        | j        ¦  «        › d|› d�¦  «         t          | |¦  «        }|S )z<
    A getattr method to cause a class to be refreshed.
    Ú__del__zWithout this, Python segfaults.z(rebuilding stale z instance (z)))ÚAttributeErrorrE   r   r    r   ÚqualrD   r   )r   ÚnameÚresults      r   Ú__injectedgetattr__rL   q   sp   € ð ˆyÒÐÝÐ>Ñ?Ô?Ð?Ý�4ÑÔÐÝ„GÐR¥¤¨d¬nÑ!=Ô!=ÐRÐRÈ$ÐRÐRÐRÑSÔSÐSÝ�T˜4Ñ Ô €FØ€Mr   é   c                 óÈ  — t          j         ¦   «         at          | d¦  «        r| j        st	          d¦  «        ‚|r*t          j        dt          | j        ¦  «        › d�¦  «         ddl	m
} d|_        | j        }| t          t          |¦  «        <   i }i }i }i }|r*t          j        dt          | j        ¦  «        › d	�¦  «         |                     ¦   «         D ]è\  }}	t!          t#          |	¦  «        t$          j        ¦  «        rS|	j        | j        u rDd
||	<   |r=t
          j                             d¦  «         t
          j                             ¦   «          Œt1          |	t"          ¦  «        rT|	j        | j        k    rDd
||	<   |r=t
          j                             d¦  «         t
          j                             ¦   «          Œé|                     |¦  «         |                     |¦  «         |j        }
|                     ¦   «         }|                     ¦   «         }|                     ¦   «         }|r>t          j        d¦  «         t          j        dt          | j        ¦  «        › d�¦  «         t;          | ¦  «         t=          j        ¦   «          |r*t          j        dt          | j        ¦  «        › d	�¦  «         |D ]»}tA          | |j        ¦  «        |u r+t          j        dtC          j"        |¦  «        › d�¦  «         ŒD|r=t
          j                             d¦  «         t
          j                             ¦   «          d|_#        |j         $                    ¦   «          tJ          |_&        | j        |_        Œ¼|rddl'}|D ]‡}tA          | |j        ¦  «        }||u r:t          j        d (                    tC          j"        |¦  «        ¦  «        ¦  «         ŒU| )                    |¦  «        D ]}tA          |dd¦  «        |u r||_*        ŒŒˆ|r>t          j        d¦  «         t          j        dt          | j        ¦  «        › d	�¦  «         d}tV          j,                             ¦   «         D �].\  }}|d
z   }|| k    s|€Œt          |d¦  «        sŒ%t          |d¦  «        rŒ6d}|j                             ¦   «         D ]’\  }}		 t[          |	¦  «         n# t\          $ r Y Œ"w xY w |
|	¦  «        ra|r=t
          j                             d¦  «         t
          j                             ¦   «          t_          |	¦  «        }d
}ta          |||¦  «         Œ“|rH|sF|dz  dk    r=t
          j                             d¦  «         t
          j                             ¦   «          �Œ0d|_        |r>t          j        d¦  «         t          j        dt          | j        ¦  «        › d�¦  «         | S )zO
    Reload a module and do as much as possible to replace its references.
    ÚALLOW_TWISTED_REBUILDzI am not allowed to be rebuilt.zRebuilding z...r   )Ú
componentsTz  (scanning z): rM   ÚfÚoÚ z  (reload   ú)z  (cleaning zWARNING: class z not replaced by reload!Úxr'   Nz-WARNING: new-class {} not replaced by reload!rD   z  (fixing   Ú__file__Ú
__bundle__é
   ú.Fz   Rebuilt )1r   r   ÚhasattrrO   ÚRuntimeErrorr   r    Ústrr   Útwisted.pythonrP   ÚALLOW_DUPLICATESr<   r(   r*   ÚitemsÚ
issubclassr   r   r   r+   ÚlogfileÚwriteÚflushÚ
isinstancer$   ÚupdateÚ__contains__Úkeysr   Ú	linecacheÚ
clearcacher   r   rI   r8   ÚclearrL   Ú__getattr__ÚgcÚformatÚget_referrersrD   ÚsysÚmodulesÚhashÚ	Exceptionr   Úsetattr)r/   ÚdoLogrP   ÚdÚ
newclassesÚclassesÚ	functionsÚvaluesÚkÚvÚfromOldModuleÚclazzrl   ÚnclassÚgaÚrÚmodcountÚmkÚmodÚchangedÚnvs                        r   Úrebuildr†   }   sû  € õ
 ”)‘+”+€KÝˆvÐ.Ñ/Ô/ð BàÔ+ð 	BÝÐ@ÑAÔAÐAØð 9ÝŒÐ7�c &¤/Ñ2Ô2Ð7Ð7Ð7Ñ8Ô8Ð8ð *Ð)Ð)Ð)Ð)Ð)à"&€JÔàŒ€AØ!…M•"�Q‘%”%ÑØ€JØ€GØ€IØ€FØð :ÝŒÐ8�s 6¤?Ñ3Ô3Ð8Ð8Ð8Ñ9Ô9Ð9Ø—’‘	”	ð (ð (‰ˆˆ1Ý•d˜1‘g”g�uÔ1Ñ2Ô2ð 	(ØŒ} ¤Ð/Ð/Ø �	˜!‘Øð (Ý”K×%Ò% cÑ*Ô*Ð*Ý”K×%Ò%Ñ'Ô'Ð'øÝ˜�4Ñ Ô ð 	(ØŒ|˜vœÒ.Ð.Ø !�
˜1‘Øð (Ý”K×%Ò% cÑ*Ô*Ð*Ý”K×%Ò%Ñ'Ô'Ð'øà
‡M‚M�'ÑÔÐØ
‡M‚M�)ÑÔÐØÔ'€MØ—’Ñ"Ô"€JØ�lŠl‰nŒn€GØ—’Ñ Ô €Iàð 8ÝŒ�‰ŒˆÝŒÐ6�s 6¤?Ñ3Ô3Ð6Ð6Ð6Ñ7Ô7Ð7õ ˆ6�N„N€NåÔÑÔÐàð :ÝŒÐ8�s 6¤?Ñ3Ô3Ð8Ð8Ð8Ñ9Ô9Ð9àð 
/ð 
/ˆÝ�6˜5œ>Ñ*Ô*¨eÐ3Ð3ÝŒGÐS¥g¤l°5Ñ&9Ô&9ÐSÐSÐSÑTÔTÐTÐTàð $Ý”×!Ò! #Ñ&Ô&Ð&Ý”×!Ò!Ñ#Ô#Ð#Ø ˆEŒOØŒN× Ò Ñ"Ô"Ð"Ý 3ˆEÔØ%œˆEÔÐØð Øˆ	ˆ	ˆ	Øð %ð %ˆÝ�V˜Vœ_Ñ-Ô-ˆØ�ˆ<ˆ<ÝŒGØ?×FÒFÝ”L Ñ(Ô(ñô ñô ð ð ð ×%Ò% fÑ-Ô-ð %ð %�Ý˜1˜k¨4Ñ0Ô0°FÐ:Ð:Ø"$�A”Køð%ð ð :ÝŒ�‰ŒˆÝŒÐ8�s 6¤?Ñ3Ô3Ð8Ð8Ð8Ñ9Ô9Ð9Ø€HÝ”;×$Ò$Ñ&Ô&ð  ñ  ‰ˆˆCØ˜a‘<ˆØ�&Š=ˆ=˜C˜KØå�s˜JÑ'Ô'ð 	àå�3˜Ñ%Ô%ð 	ð àˆà”L×&Ò&Ñ(Ô(ð 	$ð 	$‰DˆAˆqðÝ�Q‘”��øÝð ð ð Ø�ðøøøàˆ}˜QÑÔð $Øð (Ý”K×%Ò% cÑ*Ô*Ð*Ý”K×%Ò%Ñ'Ô'Ð'Ý# AÑ&Ô&�Ø�Ý˜˜Q Ñ#Ô#Ð#øØð 	 ˜ð 	  x°"¡}¸Ò&:Ð&:ÝŒK×Ò˜cÑ"Ô"Ð"ÝŒK×ÒÑÔÐùà"'€JÔØð 7ÝŒ�‰ŒˆÝŒÐ5�c &¤/Ñ2Ô2Ð5Ð5Ð5Ñ6Ô6Ð6Ø€Ms   ÓSÓ
SÓS)rM   )r&   rh   ro   r   r   Ú	importlibr   r   Útypingr   r]   r   r   r   r	   r(   ÚintÚ__annotations__r   r2   rr   rB   rE   rL   r†   r'   r   r   ú<module>r‹      sm  ððð ð ð Ð Ð Ð ð €
€
€
Ø €€€Ø €€€Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð ð (Ð 'Ð 'Ð 'Ð 'Ð 'Ð 'Ð 'àˆdŒi‰kŒk€ð"ð "ð "ð "ð "ñ "ô "ð "ðJ (*€ˆt�C˜�OÔ$Ð )Ð )Ñ )ð
-ð 
-ð 
-ðQð Qð Qð*ð ð ð ð �9ñ ô ð ð1ð 1ð 1ð	ð 	ð 	ð}ð }ð }ð }ð }ð }r   