
    g	                    J    d dl mZ d dlmZ d dlZ ed      dd       ZddZy)	    )annotations)	lru_cacheNd   c                    t        |       }d|cxk  rdk  ry |dk(  s(d|cxk  rdk  sn d|cxk  rdk  sn d	|cxk  rd
k  ry nyt        j                  |       }|dk(  ry|dv ryt        j                  |       dv ryy)zDetermine how many columns are needed to display a character in a terminal.

    Returns -1 if the character is not printable.
    Returns 0, 1 or 2 for other characters.
              r   i   i   i(   i.   i`   ic   Cc)MeMn)FW   )ordunicodedatacategoryeast_asian_width)cor   s      H/var/www/openai/venv/lib/python3.12/site-packages/_pytest/_io/wcwidth.pywcwidthr      s     	AA q5 
 	
VQ & Q & Q &  !##A&H 4 < ##A&*4    c                n    d}t        j                  d|       D ]  }t        |      }|dk  r y||z  } |S )zDetermine how many columns are needed to display a string in a terminal.

    Returns -1 if the string contains non-printable characters.
    r   NFCr   )r   	normalizer   )swidthr   wcs       r   wcswidthr    .   sC    
 E""5!,QZ6	 -
 Lr   )r   strreturnint)r   r!   r"   r#   )
__future__r   	functoolsr   r   r   r     r   r   <module>r'      s,    "   3# #Lr   