Ë
    ëÓ^j€  ã                   ó`  — d Z ddlZddl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	Z	dZ
e
r ee	d«      s ee	dd«      Ze�ee	_        ddlmZ dd	lmZ dd
lmZmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z" g d¢Z#de$ejJ                  e$   z  dedefd„Z& e'h d£«      Z( e'ddh«      Z)dddœZ* G d„ dejV                  jX                  «      Z- G d„ dejV                  j\                  «      Z/ e/«       Z0 eedd«      s#ejb                  je                  de0«       de_3        de$fd„Z4y# e$ r dZ
Y �Œw xY w)u   RF-DETR public package initialiser.

Two-phase legacy-module deprecation
------------------------------------
Some sub-packages were relocated in v1.6.0 and are scheduled for removal in v1.9.0. The migration is handled in
two phases so users get a full release cycle to update their imports:

**Phase 1 â€” v1.7.0 (current):** the old packages (``rfdetr.util``, ``rfdetr.deploy``) still exist on disk and work
normally, but emit a ``DeprecationWarning`` on import. ``_RemovedModuleFinder`` is installed in ``sys.meta_path`` but
stays dormant: its ``find_spec`` returns ``None`` whenever ``importlib.machinery.PathFinder`` can resolve the name (i.e.
while the shim directories are present).

**Phase 2 â€” v1.9.0:** the shim directories are deleted.  ``PathFinder`` can no longer resolve ``rfdetr.util`` /
``rfdetr.deploy``, so ``_RemovedModuleFinder`` intercepts the import and raises a descriptive ``ImportError`` (migration
hint) instead of the cryptic default ``ModuleNotFoundError: No module named 'rfdetr.util'``.

To complete Phase 2, delete ``src/rfdetr/util/`` and ``src/rfdetr/deploy/`` and bump
``_REMOVE_IN_VERSION_1_9`` (or rename it) to reflect the new version boundary.
é    N)ÚAnyTFÚcomplex_Ú
complex128)ÚRFDETR)ÚModelContext)Ú
RFDETRBaseÚRFDETRKeypointPreviewÚRFDETRLargeÚRFDETRLargeDeprecatedÚRFDETRMediumÚ
RFDETRNanoÚRFDETRSeg2XLargeÚRFDETRSegLargeÚRFDETRSegMediumÚRFDETRSegNanoÚRFDETRSegPreviewÚRFDETRSegSmallÚRFDETRSegXLargeÚRFDETRSmall)r   Úfrom_checkpointr	   r   r   r   r
   r   r   r   r   r   r   ÚpathÚkwargsÚreturnc                 ó.   — t        j                  | fi |¤ŽS )zYConvenience wrapper for RFDETR.from_checkpoint(); see that method for full documentation.)r   r   )r   r   s     úZ/var/www/ramen.bs-engineer-server.com/venv/lib/python3.12/site-packages/rfdetr/__init__.pyr   r   V   s   € ä×!Ñ! $Ñ1¨&Ñ1Ð1ó    >   Úbuild_trainerÚRFDETRDataModuleÚRFDETRModelModuleÚRFDETR2XLargeÚRFDETRXLargezDrfdetr.util will be removed in v1.9.0. Use rfdetr.utilities instead.zCrfdetr.deploy will be removed in v1.9.0. Use rfdetr.export instead.)ÚutilÚdeployc                   óh   — e Zd ZdZdeddfd„Zdej                  j                  ddfd„Z	de
ddfd	„Zy)
Ú_RemovedModuleLoaderzHRaise a migration hint when a removed legacy module import is attempted.Úmessager   Nc                 ó   — || _         y ©N)Ú_message)Úselfr&   s     r   Ú__init__z_RemovedModuleLoader.__init__j   s	   € Øˆ�r   Úspecc                  ó   — y)z%Use the default module creation path.N© )r*   r,   s     r   Úcreate_modulez"_RemovedModuleLoader.create_modulem   s   € àr   Úmodulec                 ó.   — t        | j                  «      d‚)zGAbort import with a migration hint instead of bare ModuleNotFoundError.N)ÚImportErrorr)   )r*   r0   s     r   Úexec_modulez _RemovedModuleLoader.exec_moduleq   s   € ä˜$Ÿ-™-Ó(¨dÐ2r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ústrr+   Ú	importlibÚ	machineryÚ
ModuleSpecr/   Úobjectr3   r.   r   r   r%   r%   g   sJ   „ ÙRð  ð  ¨ó  ð )×"5Ñ"5×"@Ñ"@ð ÀTó ð3 &ð 3¨Tô 3r   r%   c            
       ó˜   — e Zd ZdZej
                  j                  Z	 ddede	e   dz  de
dz  dej
                  j                  dz  fd„Zy)	Ú_RemovedModuleFinderzNIntercept removed legacy dotted imports after their shim packages are deleted.NÚfullnamer   Útargetr   c                 óZ  — |j                  t        › d�«      sy|j                  t        › d�«      j                  d«      \  }}}|t        vry| j
                  j                  ||«      �y|t        › d|› �k(  }t        t        |   «      }t        j                  j                  |||¬«      S )zGReturn a failing spec with a migration hint for removed legacy modules.ú.N)Ú
is_package)Ú
startswithr4   ÚremoveprefixÚ	partitionÚ_REMOVE_IN_VERSION_1_9Ú_PATH_FINDERÚ	find_specr%   r9   r"   Úspec_from_loader)r*   r?   r   r@   ÚrootÚ_rC   Úloaders           r   rI   z_RemovedModuleFinder.find_spec{   s«   € ð ×"Ñ"¤h Z¨q >Ô2ØØ×*Ñ*¬h¨Z°q¨>Ó:×DÑDÀSÓI‰
ˆˆa�ØÔ-Ñ-Øà×Ñ×&Ñ& x°Ó6ÐBØà¤H :¨Q¨t¨fÐ!5Ñ5ˆ
Ü%Ô&<¸TÑ&BÓCˆÜ�~‰~×.Ñ.¨x¸ÈJÐ.ÓWÐWr   r(   )r4   r5   r6   r7   r9   r:   Ú
PathFinderrH   r8   Úlistr<   r;   rI   r.   r   r   r>   r>   v   si   „ ÙXà×&Ñ&×1Ñ1€Lð !%ñ	XàðXð �3‰i˜$ÑðXð ˜‘ð	Xð
 
×	Ñ	×	'Ñ	'¨$Ñ	.ôXr   r>   Ú_rfdetr_removed_finderÚnamec                 ó  — | t         v r0t        › d| › �}	 t        j                  |«      }|t	        «       | <   |S | t        v r!ddl	m
} t        || «      }|t	        «       | <   |S | t        v rNddlm} ddlm} t!        || «      rt        || «      }|t	        «       | <   |S t        |j#                  d¬«      «      ‚t%        d	t        ›d
| ›�«      ‚# t
        $ r(}|j                  |k7  r‚ t        t         |    «      d‚d}~ww xY w)a”  Lazily resolve training/PTL and plus-only exports and handle removed-module aliases.

    This hook is only invoked on explicit attribute access (e.g. ``rfdetr.RFDETRModelModule``) and supports three
    behaviors:

    * Training/PTL exports (names in ``_LAZY_TRAINING``) are imported from ``rfdetr.training``
      on first use to avoid importing PyTorch Lightning at ``import rfdetr`` time.
    * Plus-only exports (names in ``_PLUS_EXPORTS``) are imported from ``rfdetr.platform.models``,
      and a descriptive ``ImportError`` is raised with an installation hint if the model is not available.
    * Removed-module aliases (keys in ``_REMOVE_IN_VERSION_1_9``, such as ``util`` and ``deploy``)
      are first attempted via a shim submodule (e.g. ``rfdetr.util``); once the shim files are removed, a migration-hint
      ``ImportError`` is raised instead of silently masking unrelated nested import errors.
    rB   Nr   )Útraining)Ú_INSTALL_MSG)Úmodelszplatform model downloads)rQ   zmodule z has no attribute )rG   r4   r9   Úimport_moduleÚglobalsÚModuleNotFoundErrorrQ   r2   Ú_LAZY_TRAININGÚrfdetrrS   ÚgetattrÚ_PLUS_EXPORTSÚrfdetr.platformrT   rU   ÚhasattrÚformatÚAttributeError)rQ   Úmodule_nameÚvalueÚexcÚ	_trainingrT   Ú_platform_modelss          r   Ú__getattr__rf   —   s  € ð Ô%Ñ%Ü!˜
 ! D 6Ð*ˆð	FÜ×+Ñ+¨KÓ8ˆEØ#ŒG‹I�d‰OØˆLð Œ~ÑÝ0ä˜	 4Ó(ˆØŒ‹	�$‰ØˆàŒ}ÑÝ0Ý>äÐ# TÔ*ÜÐ,¨dÓ3ˆEØ#ŒG‹I�d‰OØˆLä˜,×-Ñ-Ð3MÐ-ÓNÓOÐOä
˜7¤8 ,Ð.@ÀÀÐIÓ
JÐJøô1 #ò 	Fà�x‰x˜;Ò&ØÜÔ4°TÑ:Ó;ÀÐEûð		Fús   •#C Ã	C>Ã#C9Ã9C>)5r7   r9   Úimportlib.abcÚimportlib.machineryÚimportlib.utilÚosÚsysÚtypingr   ÚnumpyÚ_IS_NUMPY_INSTALLEDr2   r^   r[   Ú_complex128r   Úrfdetr.detrr   Úrfdetr.inferencer   Úrfdetr.variantsr   r	   r
   r   r   r   r   r   r   r   r   r   r   r   Ú__all__r8   ÚPathLiker   Ú	frozensetrY   r\   rG   ÚabcÚLoaderr%   ÚMetaPathFinderr>   Ú_REMOVED_MODULE_FINDERÚ	meta_pathÚinsertrP   rf   r.   r   r   ú<module>r|      sY  ðñó( Û Û Û Û 	Û 
Ý ð
 ÛàÐñ ™w u¨jÔ9Ù˜% ¨tÓ4€KØÐØ$ˆŒõ Ý )÷÷ ÷ ÷ ò"€ð"2˜# §¡¨CÑ 0Ñ0ð 2¸Cð 2ÀFó 2ñ ÒUÓV€Ù˜?¨NÐ;Ó<€ð
 SØSñÐ ô3˜9Ÿ=™=×/Ñ/ô 3ôX˜9Ÿ=™=×7Ñ7ô Xñ4 .Ó/Ð áˆsÐ,¨eÔ4Ø‡M�M×Ñ˜Ð2Ô3Ø!%€CÔð,K�cô ,Køð] ò  ØÓð ús   ¢D" Ä"D-Ä,D-