
    ^jM                    J    d Z ddlmZ ddlZddlZddlmZ ddZd	dZd
ddZy)z*
Utilities imported from ipython_genutils
    )annotationsN)indentc                    t        | d      S )Nz    )_indent)vals    M/opt/ringagent/.cad-venv/lib/python3.12/site-packages/traitlets/utils/text.pyr   r      s    3    c                   | j                  d      rt        j                  |       S | j                  dd      }t	        |      dk(  rt        j                  |       S |\  }}t        j                  |      }dj                  ||g      S )zAEquivalent of textwrap.dedent that ignores unindented first line.
   )
startswithtextwrapdedentsplitlenjoin)textsplitsfirstrests       r   _dedentr      sv     tt$$ ZZa F
6{at$$KE4??4 D99eT]##r	   c                x   t        j                  dt         j                        }t        |       j	                         } |j                  |       ddd   }g }t        j                  dt         j                        }|D ]:  }|j                  |      t        j                  ||      }|j                  |       < |S )a  Wrap multiple paragraphs to fit a specified width.

    This is equivalent to textwrap.wrap, but with support for multiple
    paragraphs, as separated by empty lines.

    Returns
    -------

    list of complete paragraphs, wrapped to fill `ncols` columns.
    z
\n(\s*\n)+N   z\n\s+)
recompile	MULTILINEr   stripr   searchr   fillappend)r   ncolsparagraph_re
paragraphsout_ps	indent_reps          r   wrap_paragraphsr'   "   s     ::mR\\:L4= D##D)#A#.JF

8R\\2I  A&a'Aa Mr	   )r   strreturnr(   )r   r(   r)   r(   )P   )r   r(   r!   intr)   z	list[str])	__doc__
__future__r   r   r   r   r   r   r'    r	   r   <module>r/      s'    # 	  & $&r	   