o
    ^iw                     @   sn   d Z ddlmZ dedefddZdedefddZdedefd	d
ZdedefddZdeddfddZdS )z
Formatting numeric literals.
    )Leaftextreturnc                 C   s*   | dd | dd }}| |   S )z4
    Formats a hexadecimal string like "0x12B3"
    N   )upperr   beforeafter r
   S/var/www/html/stock_analysis/be/venv/lib/python3.10/site-packages/black/numerics.py
format_hex   s   r   c                 C   s^   |  d\}}d}|dr|dd }d}n|dr"|dd }t|}| d| | S )z6Formats a numeric string utilizing scientific notatione -   N+)split
startswithformat_float_or_int_string)r   r   r	   signr
   r
   r   format_scientific_notation   s   

r   c                 C   s$   | dd }| d }t | | S )z#Formats a complex string like `10j`N)r   )r   numbersuffixr
   r
   r   format_complex_number   s   r   c                 C   s0   d| vr| S |  d\}}|pd d|pd S )z"Formats a float string like "1.0"..r   )r   r   r
   r
   r   r   $   s   r   leafNc                 C   sb   | j  }|drn!|drt|}nd|v rt|}n|dr(t|}nt|}|| _ dS )zNormalizes numeric (float, int, and complex) literals.

    All letters used in the representation are normalized to lowercase.)0o0b0xr   jN)valuelowerr   r   r   endswithr   r   )r   r   r
   r
   r   normalize_numeric_literal-   s   







r$   )	__doc__blib2to3.pytreer   strr   r   r   r   r$   r
   r
   r
   r   <module>   s    	