
    ^hl                         S r SSKrSSKr\R                  S:  a  SSKJr  OSSKJr  SSKJr  SSK	J
r
  SSKJr  SSKJr  S	S
KJr  / SQr " S S\5      r " S S\5      rS r\
" 5       4S jr\
" 5       4S jrg)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                       \ rS rSrSrSrg)r   !   zAn exporter name error. N__name__
__module____qualname____firstlineno____doc____static_attributes__r       R/home/james-whalen/.local/lib/python3.13/site-packages/nbconvert/exporters/base.pyr   r   !   s    !r   r   c                       \ rS rSrSrSrg)ExporterDisabledError%   zAn exporter disabled error.r   Nr   r   r   r   r   r   %   s    %r   r   c                    U c  Sn[        U5      e[        U [        5      (       d"  [        U [        5      (       d  Sn[        U5      eUc  Sn[        U5      eUR	                  SS5      n[        U [        5      (       a  U OU " S0 UD6n[        U[
        5      (       a  UR                  X5      u  pdXd4$ [        U[        45      (       a  UR                  X5      u  pdXd4$ UR                  X5      u  pdXd4$ )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    :  nh))*Xx2P2P>n	zn {D)I$.x$B$BSU "l##-@@O
 	 
B		-;;BJ  .77Fr   c                 r   U S:X  a  Sn  [        SS9nU Vs/ s H4  o3R                  U :X  d   UR                  U R                  5       :X  d  M2  UPM6     nnUS   R                  5       n[	        U" US9SS5      (       a  U$ [        S	U -  5      es  snf ! [         a     Of = fS
U ;   a]   [        U 5      n[	        U" US9SS5      (       a  U$ [        S	U -  5      e! [         a    [        5       nUR                  SU SS9   Of = fSR                  U SR                  [        5       5      5      n[        U5      e)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groupr   configenabledTz'Exporter "%s" disabled in configuration.zError importing %s)exc_infoz/Unknown exporter "{}", did you mean one of: {}?z, )r   namelowerloadgetattrr   
IndexErrorr	   ImportErrorr   errorformatjoinr   r   )r:   r6   	exporterseitemsr)   logr,   s           r   r   r   ^   sA    w '<=	%RIq4166TZZ\;QIR8==?86*It<<O#$MQU$VWW	 S
   d{	A"4(Hxv.	4@@'(QUY(Z[[ 	A,CII*D4I@	A <
B
Bdii(*+C C
  s@   B 1BB,B ?B 
BB)"C C %DDc                 b   [        S [        SS9 5       5      n[        R                  R	                  S5      (       a  [        5       R                  S5        U$ / nU H7  n [        U5      " U S9nUR                  (       a  UR                  U5        M7  M9     U$ ! [        [        4 a     MP  f = f)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   8   #    U  H  oR                   v   M     g 7f)N)r:   ).0rD   s     r   	<genexpr>#get_export_names.<locals>.<genexpr>   s     Q'P!vv'Ps   r2   r3   "NBCONVERT_DISABLE_CONFIG_EXPORTERSzYConfig exporter loading disabled, no additional exporters will be automatically included.r5   )sortedr   osenvirongetr   infor   r7   appendr   
ValueError)r6   rC   enabled_exportersexporter_namerD   s        r   r   r      s     Q|:O'PQQI	zz~~:;;g	
 "	]+6:Ayy!((7  #  &z2 		s   !1BB.-B.)r   rN   sysversion_infoimportlib_metadatar   importlib.metadatanbformatr   traitlets.configr   traitlets.logr   traitlets.utils.importstringr	   r)   r   __all__	NameErrorr   rS   r   r   r   r   r   r   r   <module>r`      sq    5
 
 
g// ! ' $ 4 "	 "&J &2j )l  !F 'L r   