
    _i                        % S r SSKrSSKrSSKJr  \R
                  " S\R                  5      rSSSSS	S
.r\\	\
4   \S'   SSSSSSSS.r\\	\
4   \S'   S\	S\
4S jrS\	S\
4S jrS\	S\\	\
4   S\
4S jrS\S\	4S jrg)z&Parsing helpers shared across modules.    N)Dictz(\d+)([a-z]+)i  i@B i ʚ;l    J)l     I5 )kmgtp
BYTE_UNITS   <     Q :	  ' 3)sr   hdwmoy
TIME_UNITSvaluereturnc                 "    [        U [        5      $ )zaParse a size expressed as a string with digits and unit (like `"10MB"`) to an integer (in bytes).)_parse_with_unitr	   r   s    Z/var/www/html/land-ocr/venv/lib/python3.13/site-packages/huggingface_hub/utils/_parsing.py
parse_sizer   +       E:..    c                 "    [        U [        5      $ )zfParse a duration expressed as a string with digits and unit (like `"10s"`) to an integer (in seconds).)r   r   r   s    r   parse_durationr"   0   r   r    unitsc           	         U R                  5       nU(       d  [        S5      e [        U 5      $ ! [         a     Of = f[        R	                  U5      nU(       d  [        SU  S35      e[        UR                  S5      5      nUR                  S5      R                  5       nXQ;  a)  [        SU S[        UR                  5       5       S35      eXAU   -  $ )	z)Parse a numeric value with optional unit.zValue cannot be empty.zInvalid value 'z7'. Must match pattern '\d+[a-z]+' or be a plain number.r
      zUnknown unit 'z'. Must be one of .)	strip
ValueErrorintRE_NUMBER_WITH_UNIT	fullmatchgrouplowerlistkeys)r   r#   strippedmatchnumberunits         r   r   r   5   s    {{}H1225z   ))(3E?5'1ijkkQ F;;q>!D>$/A$uzz|BTAUUVWXX$Ks   
/ 
<<tsc                     Sn[         R                   " 5       U -
  nUS:  a  gU H  u  p4n[        X$-  5      nUc  M  Xe::  d  M    O   W SW US:  a  S S3$ S S3$ )	zFormat timestamp in seconds into a human-readable string, relative to now.

Vaguely inspired by Django's `timesince` formatter.
))secondr
   r   )minuter   r   )hourr      )dayr      )weekr   r;   )monthr      )yearr   N   za few seconds ago r
   r    z ago)timeround)r4   _TIMESINCE_CHUNKSdeltalabeldivider	max_valuer   s          r   format_timesincerJ   L   s|    
	 IIK"Erz"%6!	eo& U%7 &7 WAeWEAIS6d;;26d;;r    )__doc__rerC   typingr   compile
IGNORECASEr*   r	   strr)   __annotations__r   r   r"   r   floatrJ    r    r   <module>rT      s    - 	   jj!12==A  
				
DcN  
				
	
DcN /c /c /
/# /# /
 C  S#X  3  .< <3 <r    