a
    ij                     @  sn   d Z ddlmZ ddlmZ ddlZddddd	d
ZdddddZeedZ	eedZ
eedZdS )z(Mini library to help building html code.    )annotations)CallableNstrzstr | list[str] | NonezCallable[..., str])name
attributesreturnc                   s"   t   ddd fdd}|S )zCreate a html tag.

  Usage:

  ```python
  tag('div', id='x')('content') == '<div id="x">content</div>'
  ```

  Args:
    name: Tag name
    **attributes: Attributes of the tag

  Returns:
    The HTML string
  r   )contentr   c                    s&   d | } d   d|  d dS )N <>z</)join)r   r   r    _/home/ghrups/robot-bench/.venv/lib/python3.9/site-packages/etils/ecolab/inspects/html_helper.pyapply,   s    
ztag.<locals>.apply)_format_tag_attributes)r   r   r   r   r   r   tag   s    r   zdict[str, str | list[str]])attrsr   c                 C  s   dg}|   D ]\}}|du r q|dkr,d}t|tr@| }nt|ts^td| d||dkrtdd |D }d	|}|| d
| d qd	|S )zFormat the tag attributes.r	   Nclass_classzUnexpected attribute: =c                 S  s   g | ]}d | qS )zetils-r   ).0Zv_r   r   r   
<listcomp>C       z*_format_tag_attributes.<locals>.<listcomp> z="")items
isinstancer   splitlist	TypeErrorr   append)r   outkvr   r   r   r   3   s    



r   spanulli)__doc__
__future__r   collections.abcr   	functoolsr   r   partialr%   r&   r'   r   r   r   r   <module>   s   