ó
    Ú^íhÂ	  ã                  óN   • S r SSKJr  SSKrSSKJrJr  SSKJr   " S S\5      r	g)	zc
Module containing a preprocessor that removes cells if they match
one or more regular expression.
é    )ÚannotationsN)ÚListÚUnicodeé   )ÚPreprocessorc                  óX   • \ rS rSrSr\" \" 5       5      R                  SS9rS r	S r
Srg)	ÚRegexRemovePreprocessoré   aÊ  
Removes cells from a notebook that match one or more regular expression.

For each cell, the preprocessor checks whether its contents match
the regular expressions in the ``patterns`` traitlet which is a list
of unicode strings. If the contents match any of the patterns, the cell
is removed from the notebook.

To modify the list of matched patterns,
modify the patterns traitlet. For example, execute the following command
to convert a notebook to html and remove cells containing only whitespace::

  jupyter nbconvert --RegexRemovePreprocessor.patterns="['\s*\Z']" mynotebook.ipynb

The command line argument
sets the list of patterns to ``'\s*\Z'`` which matches an arbitrary number
of whitespace characters followed by the end of the string.

See https://regex101.com/ for an interactive guide to regular expressions
(make sure to select the python flavor). See
https://docs.python.org/library/re.html for the official regular expression
documentation in python.
T)Úconfigc                ó®   • [         R                  " SR                  S U R                   5       5      5      nUR	                  UR
                  5      (       + $ )ze
Checks that a cell matches the pattern.

Returns: Boolean.
True means cell should *not* be removed.
Ú|c              3  ó,   #   • U  H
  nS U-  v •  M     g7f)z(?:%s)N© )Ú.0Úpatterns     Ú]/home/james-whalen/.local/lib/python3.13/site-packages/nbconvert/preprocessors/regexremove.pyÚ	<genexpr>Ú;RegexRemovePreprocessor.check_conditions.<locals>.<genexpr>7   s   é € Ð%VÊ¸W h°Ö&8Êùs   ‚)ÚreÚcompileÚjoinÚpatternsÚmatchÚsource)ÚselfÚcellr   s      r   Úcheck_conditionsÚ(RegexRemovePreprocessor.check_conditions,   s=   € ô —*’*˜SŸX™XÑ%VÈÏÊÓ%VÓVÓWˆð —=‘= §¡Ó-Ô-Ð-ó    c                ó¬   • U R                   (       d  X4$ UR                   Vs/ s H  o0R                  U5      (       d  M  UPM     snUl        X4$ s  snf )zC
Preprocessing to apply to each notebook. See base.py for details.
)r   Úcellsr   )r   ÚnbÚ	resourcesr   s       r   Ú
preprocessÚ"RegexRemovePreprocessor.preprocess<   sH   € ð
 }}Ø=Ð ð &(§X¢XÓM¢X˜T×1FÑ1FÀt×1L—D¡XÑMˆŒàˆ}Ðùò Ns   £AÁ Ar   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   Útagr   r   r$   Ú__static_attributes__r   r   r   r	   r	      s,   † ññ0 ‘G“I‹×"Ñ"¨$Ð"Ð/€Hò.õ r   r	   )
r*   Ú
__future__r   r   Ú	traitletsr   r   Úbaser   r	   r   r   r   Ú<module>r0      s$   ðñõ #ã 	ç #å ô6˜lõ 6r   