U
    ,ºcØ
  ã                   @   sv   d Z ddlmZ ddlmZ ddlmZ ddlZG dd„ deƒZG dd	„ d	eƒZG d
d„ dej	ƒZ
G dd„ de
ƒZdS )z:Semantic text objects that are used for styled outputting.é    )Úabsolute_import)Údivision)Úunicode_literalsNc                   @   s>   e Zd ZdZddd„Zedd„ ƒZedd„ ƒZed	d
„ ƒZdS )ÚTextAttributesz%Attributes to use to style text with.Nc                 C   s   || _ || _|pg | _dS )a?  Defines a set of attributes for a piece of text.

    Args:
      format_str: (str), string that will be used to format the text
        with. For example '[{}]', to enclose text in brackets.
      color: (Colors), the color the text should be formatted with.
      attrs: (Attrs), the attributes to apply to text.
    N)Ú_format_strÚ_colorÚ_attrs)ÚselfÚ
format_strÚcolorÚattrs© r   ú5/tmp/pip-unpacked-wheel-1xt1w7un/fire/console/text.pyÚ__init__   s    	zTextAttributes.__init__c                 C   s   | j S ©N)r   ©r	   r   r   r   r
   (   s    zTextAttributes.format_strc                 C   s   | j S r   )r   r   r   r   r   r   ,   s    zTextAttributes.colorc                 C   s   | j S r   )r   r   r   r   r   r   0   s    zTextAttributes.attrs)NNN)	Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Úpropertyr
   r   r   r   r   r   r   r      s   


r   c                   @   s2   e Zd ZdZddd„Zdd„ Zdd„ Zd	d
„ ZdS )Ú	TypedTextz8Text with a semantic type that will be used for styling.Nc                 C   s   || _ || _dS )a  String of text and a corresponding type to use to style that text.

    Args:
     texts: (list[str]), list of strs or TypedText objects
       that should be styled using text_type.
     text_type: (TextTypes), the semantic type of the text that
       will be used to style text.
    N)ÚtextsÚ	text_type)r	   r   r   r   r   r   r   8   s    	zTypedText.__init__c                 C   s    d}| j D ]}|t|ƒ7 }q
|S )Nr   )r   Úlen)r	   ÚlengthÚtextr   r   r   Ú__len__D   s    
zTypedText.__len__c                 C   s   | |g}t |ƒS r   ©r   ©r	   Úotherr   r   r   r   Ú__add__J   s    zTypedText.__add__c                 C   s   || g}t |ƒS r   r   r   r   r   r   Ú__radd__N   s    zTypedText.__radd__)N)r   r   r   r   r   r   r!   r"   r   r   r   r   r   5   s
   
r   c                   @   s   e Zd ZdZdd„ ZdS )Ú
_TextTypesz6Text types base class that defines base functionality.c                 G   s   t t|ƒ| ƒS )z,Returns a TypedText object using this style.)r   Úlist)r	   Úargsr   r   r   Ú__call__V   s    z_TextTypes.__call__N)r   r   r   r   r&   r   r   r   r   r#   S   s   r#   c                   @   s4   e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdS )Ú	TextTypesz5Defines text types that can be used for styling text.é   é   é   é   é   é   é   é   é	   N)r   r   r   r   ZRESOURCE_NAMEÚURLZ
USER_INPUTZCOMMANDÚINFOÚURIZOUTPUTZ
PT_SUCCESSZ
PT_FAILUREr   r   r   r   r'   \   s   r'   )r   Ú
__future__r   r   r   ÚenumÚobjectr   r   ÚEnumr#   r'   r   r   r   r   Ú<module>   s   	