
    PTh>              
       |    d dl mZ ddlmZmZ ddlmZ dZdede	dee
   d	e	d
e	f
dZd	ededefdZ G d de      Zy)    )Optional   )FEATURES
conv_space)fn_human_count))g      8@z/d   )      N@z/hr   )r	   z/mr   valunitprecspacereturnc                 
   | dz  } t         D ]]  \  }}}t        | |      }||k\  r| |z  } |t        | |      }n|dz  dk(  rd}n|dz  dz  dk(  rd}nd}dj                  |||||      c S  d	j                   || ||            S )
Ng     @g      ?        r   g      $@r   r   z{:.{}f}{}{}{}z{}/s)SPECroundformat)	r
   r   r   r   fn_countsizescaledecrs	            `/home/www/backend.miabetepe.com/venv/lib/python3.12/site-packages/about_time/human_throughput.py__human_throughputr      s    ?C  CeS#sO94KCc4 AVr\D#g^r!DD%%audEBBC  ==#tT233    d1024iecc                 z     dt         dt        dt        t           f fd}t	         ||      t                |S )Nr
   r   r   c                 "    t        | ||      S N)r   )r
   r   r   r   r   s      r   runz fn_human_throughput.<locals>.run$   s    !#tT5(CCr   )floatstrr   intr   r   )r   r   r   r!   r   s   `   @r   fn_human_throughputr%   #   sD    D Dc D# D eUC0HuEJr   c                   \    e Zd Zd Zed        Zdedd fdZddee	   defdZ
d	 Zd
 Zd Zy)HumanThroughputc                 .    |dk\  sJ || _         || _        y )Nr   )_value_unit)selfvaluer   s      r   __init__zHumanThroughput.__init__-   s    {{
r   c                     | j                   S r    )r)   r+   s    r   r,   zHumanThroughput.value2   s    {{r   r,   r   c                     || _         | S r    )r*   )r+   r,   s     r   r   zHumanThroughput.unit6   s    
r   Nr   c                      t        t        j                  t        j                  t        j                        | j
                  | j                  |      S )zReturn a beautiful representation of this count.
        It dynamically calculates the best scale to use.

        Args:
            prec: an optional custom precision

        Returns:
            the human friendly representation.

        )r%   r   feature_spacefeature_1024feature_iecr)   r*   )r+   r   s     r   as_humanzHumanThroughput.as_human:   sD    9"8#9#98;P;P#+#7#799=djjRVX 	Xr   c                 "    | j                         S r    )r5   r/   s    r   __str__zHumanThroughput.__str__H   s    }}r   c                 :    dj                  | j                  |       S )NzHumanCount{{ value={} }} -> {})r   r)   r/   s    r   __repr__zHumanThroughput.__repr__K   s    /66t{{DIIr   c                 (    | j                         |k(  S r    )r7   )r+   others     r   __eq__zHumanThroughput.__eq__N   s    ||~&&r   r    )__name__
__module____qualname__r-   propertyr,   r#   r   r   r$   r5   r7   r9   r<    r   r   r'   r'   ,   sY    
  # "3 XXc] Xc XJ'r   r'   N)typingr   featuresr   r   human_countr   r   r"   r#   r$   r   boolr%   objectr'   rA   r   r   <module>rG      sh     * '4E 4 4HSM 4# 4\_ 4*t D t #'f #'r   