
    Mhl                         d Z ddlZddlZej        dk     rddlmZ nddlmZ ddlmZ ddl	m
Z
 ddlmZ ddlmZ d	d
lmZ g dZ G d de          Z G d de          Zd Z e
            fdZ e
            fdZdS )z/Module containing single call export functions.    N)   
   )entry_points)NotebookNode)
get_config)
get_logger)import_item   )Exporter)exportr   get_exporterget_export_namesExporterNameErrorc                       e Zd ZdZdS )r   zAn exporter name error.N__name__
__module____qualname____doc__     X/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/nbconvert/exporters/base.pyr   r   !   s        !!!!r   r   c                       e Zd ZdZdS )ExporterDisabledErrorzAn exporter disabled error.Nr   r   r   r   r   r   %   s        %%%%r   r   c                 &   | d}t          |          t          | t                    s&t          | t                    sd}t          |          |d}t          |          |                    dd          }t          | t                    r| n | di |}t          |t
                    r|                    ||          \  }}nIt          |t          f          r|                    ||          \  }}n|	                    ||          \  }}||fS )a  
    Export a notebook object using specific exporter class.

    Parameters
    ----------
    exporter : ``Exporter`` class or instance
        Class or instance of the exporter that should be used.  If the
        method initializes its own instance of the class, it is ASSUMED that
        the class type provided exposes a constructor (``__init__``) with the same
        signature as the base Exporter class.
    nb : :class:`~nbformat.NotebookNode`
        The notebook to export.
    config : config (optional, keyword arg)
        User configuration instance.
    resources : dict (optional, keyword arg)
        Resources used in the conversion process.

    Returns
    -------
    tuple
        output : str
            The resulting converted notebook.
        resources : dictionary
            Dictionary of resources used prior to and during the conversion
            process.
    NzExporter is Nonez.exporter does not inherit from Exporter (base)z
nb is None	resourcesr   )
	TypeError
isinstancer   
issubclasspopr   from_notebook_nodestrfrom_filename	from_file)exporternbkwmsgr   exporter_instanceoutputs          r   r   r   )   s'   :  nnh)) *Xx2P2P >nn	znn {D))I$.x$B$BVSU "l## G-@@YOO			B		 G-;;B	JJ		-77IFF	9r   c                 ~     dk    rd 	 t          d          } fd|D             }|d                                         }t           ||          dd	          r|S t          d
 z            # t          $ r Y nw xY wd v ru	 t                     }t           ||          dd	          r|S t          d
 z            # t          $ r) t                      }|                    d d	           Y nw xY wd	                     d
                    t                                          }t          |          )zGiven an exporter name or import path, return a class ready to be instantiated

    Raises ExporterName if exporter is not found or ExporterDisabledError if not enabled
    ipynbnotebooknbconvert.exportersgroupc                 d    g | ],}|j         k    s|j                                         k    *|-S r   )namelower).0er2   s     r   
<listcomp>z get_exporter.<locals>.<listcomp>i   s7    RRRq416TZZ\\;Q;Q;Q;Q;Qr   r   configenabledTz'Exporter "%s" disabled in configuration.zError importing %s)exc_infoz/Unknown exporter "{}", did you mean one of: {}?z, )r   loadgetattrr   
IndexErrorr	   ImportErrorr   errorformatjoinr   r   )r2   r8   	exportersitemsr%   logr(   s   `      r   r   r   ^   s    w '<===	RRRRIRRR8==??886***It<< 	O#$MQU$VWWW    d{{	A"4((Hxxv...	4@@  '(QUY(Z[[[ 	A 	A 	A,,CII*D4I@@@@@	A <
B
Bdii(**++ C C
 
  s0   AA2  A2 2
A?>A?+C 3C 0C87C8c                    t          d t          d          D                       }t          j                            d          r#t                                          d           |S g }|D ]O}	  t          |          |           }|j        r|	                    |           9# t          t          f$ r Y Lw xY w|S )zReturn a list of the currently supported export targets

    Exporters can be found in external packages by registering
    them as an nbconvert.exporter entrypoint.
    c              3   $   K   | ]}|j         V  d S )N)r2   )r4   r5   s     r   	<genexpr>z#get_export_names.<locals>.<genexpr>   s$      QQ!qvQQQQQQr   r.   r/   "NBCONVERT_DISABLE_CONFIG_EXPORTERSzYConfig exporter loading disabled, no additional exporters will be automatically included.r7   )sortedr   osenvirongetr   infor   r9   appendr   
ValueError)r8   rC   enabled_exportersexporter_namer5   s        r   r   r      s     QQ|:O'P'P'PQQQQQI	z~~:;; g	
 	
 	
 "  	+]++6:::Ay 8!((777%z2 	 	 	D	s   15B''B;:B;)r   rK   sysversion_infoimportlib_metadatar   importlib.metadatanbformatr   traitlets.configr   traitlets.logr   traitlets.utils.importstringr	   r%   r   __all__	NameErrorr   rP   r   r   r   r   r   r   r   <module>r]      sl   5 5
 
			 



g///////////// ! ! ! ! ! ! ' ' ' ' ' ' $ $ $ $ $ $ 4 4 4 4 4 4        " " " " "	 " " "& & & & &J & & &2 2 2j )jll  !  !  !  !F 'JLL      r   