o
    N in  ã                   @  sV   d Z ddlmZ ddlmZ er"ddlmZ ddlmZ ddl	m
Z
 G dd„ dƒZd	S )
z5The data collector components for sphinx.environment.é    )Úannotations)ÚTYPE_CHECKING)Únodes)ÚSphinx)ÚBuildEnvironmentc                   @  sd   e Zd ZU dZdZded< d$d	d
„Zd$dd„Zd%dd„Zd&dd„Z	d'dd„Z
d(dd„Zd)d"d#„ZdS )*ÚEnvironmentCollectora¬  An EnvironmentCollector is a specific data collector from each document.

    It gathers data and stores :py:class:`BuildEnvironment
    <sphinx.environment.BuildEnvironment>` as a database.
    Examples of specific data would be images, download files, section titles, metadatas, index
    entries and toctrees, etc.

    .. note::

        This class essentially wraps a sub-set of :ref:`Sphinx event callbacks <events>`.
    Nzdict[str, int] | NoneÚlistener_idsÚappr   ÚreturnÚNonec                 C  sV   | j d u sJ ‚| d| j¡| d| j¡| d| j¡| d| j¡| d| j¡dœ| _ d S )Núdoctree-readúenv-merge-infoúenv-purge-docúenv-get-updatedúenv-get-outdated)r   r   r   r   r   )r   ÚconnectÚprocess_docÚmerge_otherÚ	clear_docÚget_updated_docsÚget_outdated_docs)Úselfr	   © r   úZ/home/ubuntu/.local/lib/python3.10/site-packages/sphinx/environment/collectors/__init__.pyÚenable   s   ûzEnvironmentCollector.enablec                 C  s2   | j d usJ ‚| j  ¡ D ]}| |¡ qd | _ d S )N)r   ÚvaluesÚ
disconnect)r   r	   Úlistener_idr   r   r   Údisable'   s   
zEnvironmentCollector.disableÚenvr   ÚdocnameÚstrc                 C  ó   t ‚)z™Remove specified data of a document.

        This method is called on the removal of the document.

        .. seealso:: :event:`env-purge-doc`
        ©ÚNotImplementedError)r   r	   r   r    r   r   r   r   -   ó   zEnvironmentCollector.clear_docÚdocnamesúset[str]Úotherc                 C  r"   )zÇMerge in specified data regarding docnames from a different `BuildEnvironment`
        object which coming from a subprocess in parallel builds.

        .. seealso:: :event:`env-merge-info`
        r#   )r   r	   r   r&   r(   r   r   r   r   6   s   z EnvironmentCollector.merge_otherÚdoctreeúnodes.documentc                 C  r"   )z¤Process a document and gather specific data from it.

        This method is called after the document is read.

        .. seealso:: :event:`doctree-read`
        r#   )r   r	   r)   r   r   r   r   D   r%   z EnvironmentCollector.process_docú	list[str]c                 C  ó   g S )z¢Return a list of docnames to re-read.

        This method is called after reading the whole of documents.

        .. seealso:: :event:`env-get-updated`
        r   )r   r	   r   r   r   r   r   M   r%   z%EnvironmentCollector.get_updated_docsÚaddedÚchangedÚremovedc                 C  r,   )z›Return a list of docnames to re-read.

        This method is called before reading the documents.

        .. seealso:: :event:`env-get-outdated`
        r   )r   r	   r   r-   r.   r/   r   r   r   r   V   s   z&EnvironmentCollector.get_outdated_docs)r	   r   r
   r   )r	   r   r   r   r    r!   r
   r   )
r	   r   r   r   r&   r'   r(   r   r
   r   )r	   r   r)   r*   r
   r   )r	   r   r   r   r
   r+   )r	   r   r   r   r-   r'   r.   r'   r/   r'   r
   r+   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Ú__annotations__r   r   r   r   r   r   r   r   r   r   r   r      s   
 




	

		r   N)r3   Ú
__future__r   Útypingr   Údocutilsr   Úsphinx.applicationr   Úsphinx.environmentr   r   r   r   r   r   Ú<module>   s    