B
    6‹dC  ã               @   s"   d Z ddlZddlZddd„ZdS )zText related utils.é    Né   Fc             C   st   | dkrdS d| d|  }|r.t  dt j¡nt  dt j¡}t  ||| ¡}| tj| ¡rl|dt|ƒ … S |S dS )aš  Indent a string a given number of spaces or tabstops.

    indent(str,nspaces=4,ntabs=0) -> indent str by ntabs+nspaces.

    Parameters
    ----------

    instr : basestring
        The string to be indented.
    nspaces : int (default: 4)
        The number of spaces to be indented.
    ntabs : int (default: 0)
        The number of tabs to be indented.
    flatten : bool (default: False)
        Whether to scrub existing indentation.  If True, all lines will be
        aligned to the same indentation.  If False, existing indentation will
        be strictly increased.

    Returns
    -------

    str|unicode : string indented by ntabs and nspaces.

    Nú	ú z^\s*ú^)ÚreÚcompileÚ	MULTILINEÚsubÚendswithÚosÚlinesepÚlen)ÚinstrZnspacesZntabsÚflattenÚindÚpatZoutstr© r   úa/work/yifan.wang/ringdown/master-ringdown-env/lib/python3.7/site-packages/nbconvert/utils/text.pyÚindent   s     r   )r   r   F)Ú__doc__r   r   r   r   r   r   r   Ú<module>   s   