§
    >²¸j�  ã                  ón   — d Z ddlmZ ddlZddlZ	 ddlZ G d„ dej        ¦  «        ZdS # e$ r Y dS w xY w)u­  Griffe extension: expose runtime-modified docstrings to mkdocstrings.

.. note::
    **Beta feature** â€” the public API of this module (class name, hook method
    signatures) may change in a minor release while it stabilises.

``@deprecated(update_docstring=True)`` writes the deprecation notice into
``fn.__doc__`` at decoration time.  Griffe â€” the engine used by mkdocstrings â€”
reads docstrings from the source AST, so it never sees that runtime change.

This extension bridges the gap: after Griffe has visited a module it imports
the module at runtime and replaces every AST docstring whose callable carries
a ``__deprecated__`` attribute (set by pyDeprecate) with the live ``__doc__``.

Usage in ``mkdocs.yml``::

    plugins:
      - mkdocstrings:
          handlers:
            python:
              options:
                extensions:
                  - deprecate.docstring.griffe_ext:RuntimeDocstrings

Requirements:
    ``griffe`` is a dependency of ``mkdocstrings[python]`` and will always be
    present in an MkDocs environment that uses mkdocstrings.  Importing this
    module without ``griffe`` installed is safe â€” ``RuntimeDocstrings`` simply
    will not be defined.

é    )ÚannotationsNc                  óR   — e Zd ZdZdd
„Zedd„¦   «         Zdd„Zedd„¦   «         ZdS )ÚRuntimeDocstringszCUpdate Griffe docstrings to reflect decorator-modified ``__doc__``.Úmodúgriffe.ModuleÚloaderúgriffe.GriffeLoaderÚkwargsÚobjectÚreturnÚNonec               óØ   — |                       |¦  «        }|€dS |j                             ¦   «         D ]6\  }}t          |t          j        ¦  «        r|                      |||¦  «         Œ7dS )a!  Run after a module is fully loaded by Griffe.

            For each function or method in *mod* that carries a ``__deprecated__`` attribute (set by pyDeprecate),
            replace the Griffe docstring with the runtime value so that mkdocstrings renders the injected notice.

            N)Ú_import_moduleÚmembersÚitemsÚ
isinstanceÚgriffeÚObjectÚ_update_obj)Úselfr   r   r
   Úruntime_modÚnameÚobjs          ún/root/private/project/pallet_detection_v2/.venv/lib/python3.11/site-packages/deprecate/docstring/griffe_ext.pyÚ	on_modulezRuntimeDocstrings.on_module/   sz   € ð ×-Ò-¨cÑ2Ô2ˆKØÐ"Ø�à œ[×.Ò.Ñ0Ô0ð =ð =‘	��cÝ˜c¥6¤=Ñ1Ô1ð =Ø×$Ò$ S¨+°tÑ<Ô<Ð<øð=ð =ó    c                ó  — 	 t          j        | j        ¦  «        S # t          t          f$ r Y nw xY wt          | dd¦  «        }|€dS ddl}|                     |¦  «        }t          | j         	                    d¦  «        ¦  «        dz
  }|j        dk    r|dz  }t          |j        |         ¦  «        }|t          j        v}|r t          j                             d|¦  «         	 t          j        | j        ¦  «        |r t          j                             |¦  «         S S # t          t          f$ r' Y |r!t          j                             |¦  «         dS dS w xY w# |r t          j                             |¦  «         w w xY w)ut  Import *mod* at runtime, adding its package root to sys.path if needed.

            griffe loads modules via its own search_paths which are not on sys.path, so a plain
            ``importlib.import_module(mod.name)`` will fail for modules that live outside the installed packages (e.g. a
            local ``demo.py``). We derive the package root from ``mod.filepath`` â€” walking up one level per dotted name
            component so that both single-file modules (``demo``) and package sub-modules (``pkg.submod``) resolve
            correctly â€” and temporarily add it to sys.path so the import can succeed.

            ÚfilepathNr   ú.é   z__init__.py)Ú	importlibÚimport_moduler   ÚImportErrorÚModuleNotFoundErrorÚgetattrÚpathlibÚPathÚlenÚsplitÚstrÚparentsÚsysÚpathÚinsertÚremove)r   r   r&   ÚpÚdepthÚ
source_dirÚaddeds          r   r   z RuntimeDocstrings._import_module>   s¥  € ðÝ Ô.¨s¬xÑ8Ô8Ð8øÝÕ!4Ð5ð ð ð Ø�ðøøøõ ˜s J°Ñ5Ô5ˆHØÐØ�tàˆNˆNˆNð —’˜XÑ&Ô&ˆAÝ˜œŸš sÑ+Ô+Ñ,Ô,¨qÑ0ˆEØŒv˜Ò&Ð&Ø˜‘
�Ý˜QœY uÔ-Ñ.Ô.ˆJØ¥c¤hÐ.ˆEØð /Ý”—’  :Ñ.Ô.Ð.ð0Ý Ô.¨s¬xÑ8Ô8ð ð 0Ý”H—O’O JÑ/Ô/Ð/Ð/ð0øõ  Õ!4Ð5ð ð ð Øàð 0Ý”H—O’O JÑ/Ô/Ð/Ð/Ð/ð0ð 0ðøøøøð ð 0Ý”H—O’O JÑ/Ô/Ð/Ð/ð0øøøs0   ‚ ›/®/Ã%D  Ä EÄ1E ÅEÅE Å$E?r   úgriffe.ObjectÚparentr   r*   c                ó˜  — t          ||d ¦  «        }|€d S t          |t          j        ¦  «        r|                      ||¦  «         d S t          |t          j        ¦  «        rf|                      ||¦  «         |j                             ¦   «         D ]8\  }}t          |t          j        ¦  «        r|  	                    |||¦  «         Œ7d S d S )N)
r%   r   r   ÚFunctionÚ_replace_docstringÚClassr   r   r   r   )r   r   r5   r   Úruntime_objÚmember_nameÚmembers          r   r   zRuntimeDocstrings._update_objo   sä   € Ý! &¨$°Ñ5Ô5ˆKØÐ"Ø�å˜#�vœÑ/Ô/ð KØ×'Ò'¨¨[Ñ9Ô9Ð9Ð9Ð9Ý˜C¥¤Ñ.Ô.ð KØ×'Ò'¨¨[Ñ9Ô9Ð9Ø+.¬;×+<Ò+<Ñ+>Ô+>ð Kð KÑ'�K Ý! &­&¬-Ñ8Ô8ð KØ×(Ò(¨°¸kÑJÔJÐJøð	Kð KðKð Kr   Ú
griffe_objr:   c                óÀ   — t          |dd¦  «        sdS t          |dd¦  «        }|sdS | j        €dS || j        _        | j        j                             dd¦  «         dS )zDOverwrite the Griffe docstring when the runtime ``__doc__`` differs.Ú__deprecated__NÚ__doc__Úparsed)r%   Ú	docstringÚvalueÚ__dict__Úpop)r=   r:   Úruntime_docs      r   r8   z$RuntimeDocstrings._replace_docstring|   sy   € õ ˜;Ð(8¸$Ñ?Ô?ð Ø�Ý! +¨y¸$Ñ?Ô?ˆKØð Ø�ØÔ#Ð+Ø�Ø)4ˆJÔ Ô&ð
 Ô Ô)×-Ò-¨h¸Ñ=Ô=Ð=Ð=Ð=r   N)r   r   r   r	   r
   r   r   r   )r   r   r   r   )r   r4   r5   r   r   r*   r   r   )r=   r4   r:   r   r   r   )	Ú__name__Ú
__module__Ú__qualname__r@   r   Ústaticmethodr   r   r8   © r   r   r   r   ,   s‡   € € € € € ØQÐQð	=ð 	=ð 	=ð 	=ð 
ð.	0ð .	0ð .	0ñ 
Œð.	0ð`	Kð 	Kð 	Kð 	Kð 
ð	>ð 	>ð 	>ñ 
Œð	>ð 	>ð 	>r   r   )	r@   Ú
__future__r   r!   r,   r   Ú	Extensionr   r#   rK   r   r   ú<module>rN      s­   ððð ð@ #Ð "Ð "Ð "Ð "Ð "à Ð Ð Ð Ø 
€
€
€
ðe>Ø€M€M€Mð
_>ð _>ð _>ð _>ð _>˜FÔ,ñ _>ô _>ð _>ð _>ð _>øð	 ð 	ð 	ð 	Ø€D€Dð	øøøs   ’+ «4³4