
    ^h
                     6    S r SSKJr  SSKJr   " S S\5      rg)zBase class for preprocessors    )Bool)NbConvertBasec                   h   ^  \ rS rSrSr\" S5      R                  SS9rU 4S jrS r	S r
S	 rS
rU =r$ )Preprocessor   a  A configurable preprocessor

Inherit from this class if you wish to have configurability for your
preprocessor.

Any configurable traitlets this class exposed will be configurable in
profiles using c.SubClassName.attribute = value

You can overwrite `preprocess_cell()` to apply a transformation
independently on each cell or `preprocess()` if you prefer your own
logic. See corresponding docstring for information.

Disabled by default and can be enabled via the config by
    'c.YourPreprocessorName.enabled = True'
FT)configc                 &   > [         TU ]  " S0 UD6  g)z
Public constructor

Parameters
----------
config : Config
    Configuration file structure
`**kw`
    Additional keyword arguments passed to parent
N )super__init__)selfkw	__class__s     V/home/james-whalen/.local/lib/python3.13/site-packages/nbconvert/preprocessors/base.pyr   Preprocessor.__init__   s     	2    c                     U R                   (       aA  U R                  R                  SU R                  R                  5        U R                  X5      $ X4$ )zApply the preprocessor.zApplying preprocessor: %s)enabledlogdebugr   __name__
preprocess)r   nb	resourcess      r   __call__Preprocessor.__call__,   s=    <<HHNN68O8OP??211}r   c                     [        UR                  5       H'  u  p4U R                  XBU5      u  UR                  U'   nM)     X4$ )a  
Preprocessing to apply on each notebook.

Must return modified nb, resources.

If you wish to apply your preprocessing to each cell, you might want
to override preprocess_cell method instead.

Parameters
----------
nb : NotebookNode
    Notebook being converted
resources : dictionary
    Additional resources used in the conversion process.  Allows
    preprocessors to pass variables into the Jinja engine.
)	enumeratecellspreprocess_cell)r   r   r   indexcells        r   r   Preprocessor.preprocess3   s@    " %RXX.KE)-)=)=du)U&BHHUOY /}r   c                     Sn[        U5      e)a  
Override if you want to apply some preprocessing to each cell.
Must return modified cell and resource dictionary.

Parameters
----------
cell : NotebookNode cell
    Notebook cell being processed
resources : dictionary
    Additional resources used in the conversion process.  Allows
    preprocessors to pass variables into the Jinja engine.
index : int
    Index of the cell being processed
z!should be implemented by subclass)NotImplementedError)r   r"   r   r!   msgs        r   r    Preprocessor.preprocess_cellH   s     2!#&&r   r
   )r   
__module____qualname____firstlineno____doc__r   tagr   r   r   r   r    __static_attributes____classcell__)r   s   @r   r   r      s7      5kooTo*G*' 'r   r   N)r+   	traitletsr   nbconvert.utils.baser   r   r
   r   r   <module>r1      s    "
  .M'= M'r   