o
    Nrf	                     @   sr   d dl mZ d dlmZ d dlmZ G dd deZd dl mZ d dlmZ G dd	 d	eZ	d
d e
fddZdS )   )BoxStyle)DictTraversal)KeyArgsConstructorc                   @   s0   e Zd ZdZe Z	 e Z	 dd Zdd Z	dS )LeftAlignedzCreates a renderer for a left-aligned tree.

    Any attributes of the resulting class instances can be set using
    constructor arguments.c                    s   g } j |}| j j | t|D ]B\}} |}|t|d krC| j	|
d | fdd|D  q| j|
d | fdd|D  q|S )zRenders a node. This function is used internally, as it returns
        a list of lines. Use :func:`~asciitree.LeftAligned.__call__` instead.
        r       c                 3       | ]	} j |V  qd S N)drawlast_child_tail.0lself [/var/www/html/software/conda/envs/catlas/lib/python3.10/site-packages/asciitree/__init__.py	<genexpr>#       z%LeftAligned.render.<locals>.<genexpr>c                 3   r   r   )r	   
child_tailr   r   r   r   r   '   r   )traverseget_childrenappendr	   
node_labelget_text	enumeraterenderlenlast_child_headpopextend
child_head)r   nodelineschildrennchildZ
child_treer   r   r   r      s   


zLeftAligned.renderc                 C   s   d | | j|S )zVRender the tree into string suitable for console output.

        :param tree: A tree.
)joinr   r   Zget_root)r   treer   r   r   __call__,   s   zLeftAligned.__call__N)
__name__
__module____qualname____doc__r   r	   r   r   r   r)   r   r   r   r   r   	   s    r   )Style)	Traversalc                   @   s4   e Zd Zdd Zdd Zdd Zdd Zd	d
 ZdS )LegacyStylec                 C   s   |S r   r   )r   textr   r   r   r   :   s   zLegacyStyle.node_labelc                 C      d| S Nz  +--r   r   labelr   r   r   r    =      zLegacyStyle.child_headc                 C   r2   )Nz  |r   r   liner   r   r   r   @   r6   zLegacyStyle.child_tailc                 C   r2   r3   r   r4   r   r   r   r   C   r6   zLegacyStyle.last_child_headc                 C   r2   )Nz   r   r7   r   r   r   r
   F   r6   zLegacyStyle.last_child_tailN)r*   r+   r,   r   r    r   r   r
   r   r   r   r   r0   9   s    r0   c                 C   s   | j S r   )r#   )r$   r   r   r   <lambda>K   s    r9   c                 C   s   t t||dt d| S )zSupport asciitree 0.2 API.

    This function solely exist to not break old code (using asciitree 0.2).
    Its use is deprecated.)r   r   )r   r	   )r   r/   r0   )r!   Z
child_iterZtext_strr   r   r   	draw_treeJ   s   r:   N)Zdrawingr   Z	traversalr   utilr   r   r.   r/   r0   strr:   r   r   r   r   <module>   s   ,