U
    4Jeë	  ã                   @   sF   d dl Z d dlZd dlZe e¡ZG dd„ de jƒZG dd„ dƒZdS )é    Nc                   @   s   e Zd ZdZdZdZdZdS )Ú
StatusCodez@Represents the canonical set of status codes of a finished Span.r   é   é   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚUNSETÚOKÚERROR© r   r   úD/tmp/pip-unpacked-wheel-7_167w8m/mysql/opentelemetry/trace/status.pyr      s
   r   c                   @   s|   e Zd ZdZejdfeeje dœdd„Z	e
edœdd„ƒZe
eje dœd	d
„ƒZe
edœdd„ƒZe
edœdd„ƒZdS )ÚStatuszãRepresents the status of a finished Span.

    Args:
        status_code: The canonical status code that describes the result
            status of the operation.
        description: An optional description of the status.
    N)Ústatus_codeÚdescriptionc                 C   sJ   || _ d | _|r@t|tƒs(t d¡ d S |tjk	r@t d¡ d S || _d S )Nz-Invalid status description type, expected strzJdescription should only be set when status_code is set to StatusCode.ERROR)Ú_status_codeÚ_descriptionÚ
isinstanceÚstrÚloggerÚwarningr   r   )Úselfr   r   r   r   r   Ú__init__,   s    


ÿzStatus.__init__)Úreturnc                 C   s   | j S )z8Represents the canonical status code of a finished Span.)r   ©r   r   r   r   r   @   s    zStatus.status_codec                 C   s   | j S )zStatus description)r   r   r   r   r   r   E   s    zStatus.descriptionc                 C   s   | j p| jtjkS )z:Returns false if this represents an error, true otherwise.)Úis_unsetr   r   r
   r   r   r   r   Úis_okJ   s    zStatus.is_okc                 C   s   | j tjkS )z'Returns true if unset, false otherwise.)r   r   r	   r   r   r   r   r   O   s    zStatus.is_unset)r   r   r   r   r   r	   ÚtypingÚOptionalr   r   Úpropertyr   r   Úboolr   r   r   r   r   r   r   #   s   
ýýr   )	ÚenumÚloggingr   Ú	getLoggerr   r   ÚEnumr   r   r   r   r   r   Ú<module>   s
   
