
    -Ph                     \    d dl m Z  d dlZd dlZd dlZdej        j        _        d Zd ZdZ	dS )    )globNsphinx_gallery_pngc                    t           j                            |d                   }t          t	          t           j                            |d                              }t          t	          t           j                            |d                              }|d         }t                      }t                      }	t          ||          D ]\  }
}||	vr|	t          |          z  }	t          |          }t           j        
                    |          d         dz   }|                    |           t          j        ||           t          j        |
|           t          ||d                   S )a<  Scrape Plotly figures for galleries of examples using
    sphinx-gallery.

    Examples should use ``plotly.io.show()`` to display the figure with
    the custom sphinx_gallery renderer.

    Since the sphinx_gallery renderer generates both html and static png
    files, we simply crawl these files and give them the appropriate path.

    Parameters
    ----------
    block : tuple
        A tuple containing the (label, content, line_number) of the block.
    block_vars : dict
        Dict of block variables.
    gallery_conf : dict
        Contains the configuration of Sphinx-Gallery
    **kwargs : dict
        Additional keyword arguments to pass to
        :meth:`~matplotlib.figure.Figure.savefig`, e.g. ``format='svg'``.
        The ``format`` kwarg in particular is used to set the file extension
        of the output file (currently only 'png' and 'svg' are supported).

    Returns
    -------
    rst : str
        The ReSTructuredText that will be rendered to HTML containing
        the images.

    Notes
    -----
    Add this function to the image scrapers
    src_filez*.pngz*.htmlimage_path_iteratorr   z.htmlsrc_dir)ospathdirnamesortedr   joinlistsetzipnextsplitextappendshutilmove
figure_rst)block
block_varsgallery_confkwargsexamples_dirpngshtmlsr   image_namesseenhtmlpngthis_image_path_pngthis_image_path_htmls                 U/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/plotly/io/_sg_scraper.pyplotly_sg_scraperr%      s<   D 7??:j#9::L$rw||L'::;;<<D4\8<<==>>E$%:;&&K55D%% 4 4	cd??CHHD"&':";";#%7#3#34G#H#H#Kg#U 3444K0111K2333k<	#:;;;    c                    fd| D             }d}|s|S |d         }t           j                            |          d         }t           j                            dt           j                            |                    }t
          |z  }|S )a  Generate RST for a list of PNG filenames.

    Depending on whether we have one or more figures, we use a
    single rst call to 'image' or a horizontal list.

    Parameters
    ----------
    figure_list : list
        List of strings of the figures' absolute paths.
    sources_dir : str
        absolute path of Sphinx documentation sources

    Returns
    -------
    images_rst : str
        rst code to embed the images in the document
    c                     g | ]S}t           j                            |                              t           j        d                               d           TS )/)r	   r
   relpathreplaceseplstrip).0figure_pathsources_dirs     r$   
<listcomp>zfigure_rst.<locals>.<listcomp>T   sY        	[1199"&#FFMMcRR  r&    r      images)r	   r
   r   r   basenameSINGLE_HTML)figure_listr0   figure_paths
images_rstfigure_nameextr/   s    `     r$   r   r   A   s    &   &  L J q/K
'

;
'
'
*C',,x)9)9+)F)FGGK{*Jr&   z
.. raw:: html
    :file: %s
)
r   r	   r   plotlyio	renderersdefaultr%   r   r6    r&   r$   <module>rA      sl          				  2	  1< 1< 1<h  Br&   