§
    ø¸¸jí{  ã                   óä  — d Z ddlZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
mZ ddlmZ ddlmZmZmZmZ dZdZ ej        dd	¦  «        Z ej        d
d¦  «        Z e eddd¦  «         eddd¦  «        ¦  «         e eddd¦  «         eddd¦  «        ¦  «         e eddd¦  «         eddd¦  «        ¦  «         e eddd ¦  «         ed!d"d#¦  «        ¦  «         e ed$d%d&¦  «         ed'd(d)¦  «        ¦  «         e ed*d+d,¦  «         ed-d.d/¦  «        ¦  «         e ed0d1d2¦  «         ed3d4d5¦  «        ¦  «         e ed6d7d8¦  «         ed9d:d;¦  «        ¦  «        fZ ed<d=d<d<¬>¦  «         ed?d@d?d?¬>¦  «         edAdBdAdA¬>¦  «         edCdDdEdF¬>¦  «         edGddGdG¬>¦  «        fZ ed=dHdIdJg¬K¦  «         edLdMdNdOg¬K¦  «         ed@dPdQdRg¬K¦  «         edDdSdTg dU¢¬K¦  «         edVdWdXg dY¢¬K¦  «         edZd[d\d]g¬K¦  «         ed^d_d`dag¬K¦  «         edbdcdddeg¬K¦  «         edfdgdhdig¬K¦  «        f	Zdj„ Zd¦dk„Zdl„ Zd§dn„Zd¨do„Z d¨dp„Z!dq„ Z"d©ds„Z#d¨dt„Z$dªdv„Z%dw„ Z&dx„ Z'dy„ Z(dz„ Z) G d{„ d|e*¦  «        Z+ G d}„ d~e,¦  «        Z- G d„ d€e,¦  «        Z. G d�„ d‚e,¦  «        Z/ G dƒ„ d„e,¦  «        Z0 ed«i d…e1“d†d‡“dˆd‰“dŠd‹“dŒd�“dŽd�“d�d‘“d’d““d”d•“d–d—“d˜d™“dšd›“dœd�“dždŸ“d d¡“d¢d£“d¤d¥“Ž dS )¬z/The main module of the `humanfriendly` package.é    N)Ú	is_stringÚ	monotonic)Údefine_aliases)ÚconcatenateÚformatÚ	pluralizeÚtokenize)ÚCombinedUnitÚInvalidDateÚInvalidLengthÚInvalidSizeÚInvalidTimespanÚSizeUnitÚTimerÚ__version__Úcoerce_booleanÚcoerce_patternÚcoerce_secondsÚdisk_size_unitsÚformat_lengthÚformat_numberÚformat_pathÚformat_sizeÚformat_timespanÚlength_size_unitsÚ
parse_dateÚparse_lengthÚ
parse_pathÚ
parse_sizeÚparse_timespanÚround_numberÚ
time_unitsz10.0r   zdivider, symbol, namer
   zdecimal, binaryiè  ÚKBÚkilobytei   ÚKiBÚkibibytei@B ÚMBÚmegabytei   ÚMiBÚmebibytei Êš;ÚGBÚgigabytei   @ÚGiBÚgibibytel    J)£ÚTBÚterabytel        ÚTiBÚtebibytel     �Iú5 ÚPBÚpetabytel           ÚPiBÚpebibytel     ÈNÎZoÚEBÚexabytel            ÚEiBÚexbibytel     @=7M.cÚZBÚ	zettabytel            ÚZiBÚzebibytel      B¶3v^!< ÚYBÚ	yottabytel               ÚYiBÚyobibyteÚnmg•Ö&è.>)ÚprefixÚdividerÚsingularÚpluralÚmmgü©ñÒMbP?Úcmg{®Gáz„?Úmé   ÚmetreÚmetresÚkmÚ
nanosecondÚnanosecondsÚns)rE   rF   rG   Úabbreviationsg�íµ ÷Æ°>ÚmicrosecondÚmicrosecondsÚusÚmillisecondÚmillisecondsÚmsÚsecondÚseconds)ÚsÚsecÚsecsé<   ÚminuteÚminutes)rJ   ÚminÚminsi  ÚhourÚhoursÚhi€Q ÚdayÚdaysÚdi€:	 ÚweekÚweeksÚwi âßÚyearÚyearsÚyc                 óà   — t          | ¦  «        rQ|                      ¦   «                              ¦   «         }|dv rdS |dv rdS d}t          t	          || ¦  «        ¦  «        ‚t          | ¦  «        S )a8  
    Coerce any value to a boolean.

    :param value: Any Python value. If the value is a string:

                  - The strings '1', 'yes', 'true' and 'on' are coerced to :data:`True`.
                  - The strings '0', 'no', 'false' and 'off' are coerced to :data:`False`.
                  - Other strings raise an exception.

                  Other Python values are coerced using :class:`bool`.
    :returns: A proper boolean value.
    :raises: :exc:`exceptions.ValueError` when the value is a string but
             cannot be coerced with certainty.
    )Ú1ÚyesÚtrueÚonT)Ú0ÚnoÚfalseÚoffÚ Fz(Failed to coerce string to boolean! (%r))r   ÚstripÚlowerÚ
ValueErrorr   Úbool)ÚvalueÚ
normalizedÚmsgs      úf/root/private/project/pallet_detection_v2/.venv/lib/python3.11/site-packages/humanfriendly/__init__.pyr   r   [   sx   € õ �ÑÔð 
Ø—[’[‘]”]×(Ò(Ñ*Ô*ˆ
ØÐ3Ð3Ð3Ø�4ØÐ:Ð:Ð:Ø�5à<ˆCÝ�V C¨Ñ/Ô/Ñ0Ô0Ð0å�E‰{Œ{Ðó    c                 óô   — t          | ¦  «        rt          j        | |¦  «        } nRt          j        d¦  «        }t          |¦  «        }t	          | |¦  «        sd}t          t          || ¦  «        ¦  «        ‚| S )a¦  
    Coerce strings to compiled regular expressions.

    :param value: A string containing a regular expression pattern
                  or a compiled regular expression.
    :param flags: The flags used to compile the pattern (an integer).
    :returns: A compiled regular expression.
    :raises: :exc:`~exceptions.ValueError` when `value` isn't a string
             and also isn't a compiled regular expression.
    rx   z;Failed to coerce value to compiled regular expression! (%r))r   ÚreÚcompileÚtypeÚ
isinstancer{   r   )r}   ÚflagsÚempty_patternÚpattern_typer   s        r€   r   r   w   su   € õ �ÑÔð 1Ý”
˜5 %Ñ(Ô(ˆˆåœ
 2™œˆÝ˜MÑ*Ô*ˆÝ˜% Ñ.Ô.ð 	1ØOˆCÝ�V C¨Ñ/Ô/Ñ0Ô0Ð0Ø€Lr�   c                 óÔ   — t          | t          j        ¦  «        r|                      ¦   «         S t          | t          j        ¦  «        sd}t          t          || ¦  «        ¦  «        ‚| S )aU  
    Coerce a value to the number of seconds.

    :param value: An :class:`int`, :class:`float` or
                  :class:`datetime.timedelta` object.
    :returns: An :class:`int` or :class:`float` value.

    When `value` is a :class:`datetime.timedelta` object the
    :meth:`~datetime.timedelta.total_seconds()` method is called.
    z1Failed to coerce value to number of seconds! (%r))r†   ÚdatetimeÚ	timedeltaÚtotal_secondsÚnumbersÚNumberr{   r   )r}   r   s     r€   r   r   �   sa   € õ �%�Ô+Ñ,Ô,ð %Ø×"Ò"Ñ$Ô$Ð$Ý�e�Wœ^Ñ,Ô,ð -ØAˆÝ�  UÑ+Ô+Ñ,Ô,Ð,Ø€Lr�   Fc                 óà  — t          t          ¦  «        D ]Ê}| |j        j        k    rT|rRt	          t          | ¦  «        |j        j        z  |¬¦  «        }t          ||j        j        |j        j        ¦  «        c S | |j        j        k    rT|sRt	          t          | ¦  «        |j        j        z  |¬¦  «        }t          ||j        j        |j        j        ¦  «        c S ŒËt          | d¦  «        S )aŠ  
    Format a byte count as a human readable file size.

    :param num_bytes: The size to format in bytes (an integer).
    :param keep_width: :data:`True` if trailing zeros should not be stripped,
                       :data:`False` if they can be stripped.
    :param binary: :data:`True` to use binary multiples of bytes (base-2),
                   :data:`False` to use decimal multiples of bytes (base-10).
    :returns: The corresponding human readable file size (a string).

    This function knows how to format sizes in bytes, kilobytes, megabytes,
    gigabytes, terabytes and petabytes. Some examples:

    >>> from humanfriendly import format_size
    >>> format_size(0)
    '0 bytes'
    >>> format_size(1)
    '1 byte'
    >>> format_size(5)
    '5 bytes'
    > format_size(1000)
    '1 KB'
    > format_size(1024, binary=True)
    '1 KiB'
    >>> format_size(1000 ** 3 * 4)
    '4 GB'
    ©Ú
keep_widthÚbyte)	Úreversedr   ÚbinaryrE   r!   Úfloatr   ÚsymbolÚdecimal)Ú	num_bytesr’   r•   ÚunitÚnumbers        r€   r   r       sæ   € õ8 �Ñ)Ô)ð Oð OˆØ˜œÔ+Ò+Ð+°Ð+Ý!¥%¨	Ñ"2Ô"2°T´[Ô5HÑ"HÐU_Ð`Ñ`Ô`ˆFÝ˜V T¤[Ô%7¸¼Ô9KÑLÔLÐLÐLÐLØ˜$œ,Ô.Ò.Ð.°vÐ.Ý!¥%¨	Ñ"2Ô"2°T´\Ô5IÑ"IÐV`ÐaÑaÔaˆFÝ˜V T¤\Ô%8¸$¼,Ô:MÑNÔNÐNÐNÐNøÝ�Y Ñ'Ô'Ð'r�   c                 ó  — t          | ¦  «        }|�rÏt          |d         t          j        ¦  «        �r®t	          |¦  «        dk    r/t          |d         ¦  «        r|d                              ¦   «         nd}t	          |¦  «        dk    s|                     d¦  «        rt          |d         ¦  «        S |�r*| 	                    d¦  «        }t          D �]}||j        j                             ¦   «         |j        j                             ¦   «         fv r$t          |d         |j        j        z  ¦  «        c S ||j        j                             ¦   «         |j        j                             ¦   «         fv s7|                     |j        j        d                              ¦   «         ¦  «        r2t          |d         |r|j        j        n|j        j        z  ¦  «        c S �Œd}t!          t#          || |¦  «        ¦  «        ‚)aú  
    Parse a human readable data size and return the number of bytes.

    :param size: The human readable file size to parse (a string).
    :param binary: :data:`True` to use binary multiples of bytes (base-2) for
                   ambiguous unit symbols and names, :data:`False` to use
                   decimal multiples of bytes (base-10).
    :returns: The corresponding size in bytes (an integer).
    :raises: :exc:`InvalidSize` when the input can't be parsed.

    This function knows how to parse sizes in bytes, kilobytes, megabytes,
    gigabytes, terabytes and petabytes. Some examples:

    >>> from humanfriendly import parse_size
    >>> parse_size('42')
    42
    >>> parse_size('13b')
    13
    >>> parse_size('5 bytes')
    5
    >>> parse_size('1 KB')
    1000
    >>> parse_size('1 kilobyte')
    1000
    >>> parse_size('1 KiB')
    1024
    >>> parse_size('1 KB', binary=True)
    1024
    >>> parse_size('1.5 GB')
    1500000000
    >>> parse_size('1.5 GB', binary=True)
    1610612736
    r   é   rK   rx   Úbr[   z4Failed to parse size! (input %r was tokenized as %r))r	   r†   rŽ   r�   Úlenr   rz   Ú
startswithÚintÚrstripr   r•   r—   ÚnamerE   r˜   r   r   )Úsizer•   ÚtokensÚnormalized_unitrš   r   s         r€   r   r   Æ   sá  € õD �d‰^Œ^€FØñ f•*˜V AœY­¬Ñ7Ô7ñ få/2°6©{¬{¸aÒ/?Ð/?ÅIÈfÐUVÌiÑDXÔDXÐ/?˜& œ)Ÿ/š/Ñ+Ô+Ð+Ð^`ˆõ ˆv‰;Œ;˜!ÒÐ˜×9Ò9¸#Ñ>Ô>ÐÝ�v˜a”y‘>”>Ð!àñ 	fð .×4Ò4°SÑ9Ô9ˆOÝ'ð fñ f�ð # t¤{Ô'9×'?Ò'?Ñ'AÔ'AÀ4Ä;ÔCS×CYÒCYÑC[ÔC[Ð&\Ð\Ð\Ý˜v aœy¨4¬;Ô+>Ñ>Ñ?Ô?Ð?Ð?Ð?ð $¨¬Ô(;×(AÒ(AÑ(CÔ(CÀTÄ\ÔEV×E\ÒE\ÑE^ÔE^Ð'_Ð_Ð_Ø'×2Ò2°4´<Ô3FÀqÔ3I×3OÒ3OÑ3QÔ3QÑRÔRð `å˜v aœyÀ6Ð,c¨D¬KÔ,?Ð,?ÈtÌ|ÔOcÑdÑeÔeÐeÐeÐeñ `ð A€CÝ
•f˜S $¨Ñ/Ô/Ñ
0Ô
0Ð0r�   c                 óô   — t          t          ¦  «        D ]T}| |d         k    rFt          t          | ¦  «        |d         z  |¬¦  «        }t	          ||d         |d         ¦  «        c S ŒUt	          | d¦  «        S )aŸ  
    Format a metre count as a human readable length.

    :param num_metres: The length to format in metres (float / integer).
    :param keep_width: :data:`True` if trailing zeros should not be stripped,
                       :data:`False` if they can be stripped.
    :returns: The corresponding human readable length (a string).

    This function supports ranges from nanometres to kilometres.

    Some examples:

    >>> from humanfriendly import format_length
    >>> format_length(0)
    '0 metres'
    >>> format_length(1)
    '1 metre'
    >>> format_length(5)
    '5 metres'
    >>> format_length(1000)
    '1 km'
    >>> format_length(0.004)
    '4 mm'
    rE   r‘   rF   rG   rL   )r”   r   r!   r–   r   )Ú
num_metresr’   rš   r›   s       r€   r   r     s‰   € õ2 Õ*Ñ+Ô+ð Gð GˆØ˜˜iœÒ(Ð(Ý!¥%¨
Ñ"3Ô"3°d¸9´oÑ"EÐR\Ð]Ñ]Ô]ˆFÝ˜V T¨*Ô%5°t¸H´~ÑFÔFÐFÐFÐFð )õ �Z Ñ)Ô)Ð)r�   c                 óÎ  — t          | ¦  «        }|rµt          |d         t          j        ¦  «        r•t	          |¦  «        dk    r|d         S t	          |¦  «        dk    rgt          |d         ¦  «        rR|d                              ¦   «         }t          D ]0}|                     |d         ¦  «        r|d         |d         z  c S Œ1d}t          t          || |¦  «        ¦  «        ‚)aä  
    Parse a human readable length and return the number of metres.

    :param length: The human readable length to parse (a string).
    :returns: The corresponding length in metres (a float).
    :raises: :exc:`InvalidLength` when the input can't be parsed.

    Some examples:

    >>> from humanfriendly import parse_length
    >>> parse_length('42')
    42
    >>> parse_length('1 km')
    1000
    >>> parse_length('5mm')
    0.005
    >>> parse_length('15.3cm')
    0.153
    r   rK   r�   rD   rE   z6Failed to parse length! (input %r was tokenized as %r))r	   r†   rŽ   r�   rŸ   r   rz   r   r    r   r   )Úlengthr¥   r¦   rš   r   s        r€   r   r   &  sé   € õ( �fÑÔ€FØð 
7•*˜V AœY­¬Ñ7Ô7ð 
7åˆv‰;Œ;˜!ÒÐØ˜!”9Ðåˆv‰;Œ;˜!ÒÐ¥	¨&°¬)Ñ 4Ô 4ÐØ$ QœiŸošoÑ/Ô/ˆOå)ð 7ð 7�Ø"×-Ò-¨d°8¬nÑ=Ô=ð 7Ø! !œ9 t¨I¤Ñ6Ð6Ð6Ð6ð7ð C€CÝ
�˜s F¨FÑ3Ô3Ñ
4Ô
4Ð4r�   r�   c                 ó   — t          t          | ¦  «        ¦  «                             d¦  «        \  }}}|                     d¦  «        }d                     t          |                     d¦  «        ¦  «        ¦  «        }g }|r)|                     |dd…         ¦  «         |dd…         }|°)d                     t          d                     |¦  «        ¦  «        ¦  «        }|d|…                              d¦  «        }	|	r|d|	z   z  }|rd|z   }|S )aU  
    Format a number as a string including thousands separators.

    :param number: The number to format (a number like an :class:`int`,
                   :class:`long` or :class:`float`).
    :param num_decimals: The number of decimals to render (2 by default). If no
                         decimal places are required to represent the number
                         they will be omitted regardless of this argument.
    :returns: The formatted number (a string).

    This function is intended to make it easier to recognize the order of size
    of the number being formatted.

    Here's an example:

    >>> from humanfriendly import format_number
    >>> print(format_number(6000000))
    6,000,000
    > print(format_number(6000000000.42))
    6,000,000,000.42
    > print(format_number(6000000000.42, num_decimals=0))
    6,000,000,000
    ú.ú-rx   Né   ú,rt   )	Ústrr–   Ú	partitionr    Újoinr”   ÚlstripÚappendr¢   )
r›   Únum_decimalsÚinteger_partÚ_Údecimal_partÚnegative_signÚreversed_digitsÚpartsÚformatted_numberÚdecimals_to_adds
             r€   r   r   K  s  € õ0 %(­¨f©¬Ñ$6Ô$6×$@Ò$@ÀÑ$EÔ$EÑ!€L�!�\Ø ×+Ò+¨CÑ0Ô0€MØ—g’g�h |×':Ò':¸3Ñ'?Ô'?Ñ@Ô@ÑAÔA€OØ€EØ
ð .Ø�Š�_ R a RÔ(Ñ)Ô)Ð)Ø)¨!¨"¨"Ô-ˆð ð .ð —w’w�x¨¯ª°©¬Ñ8Ô8Ñ9Ô9ÐØ" = L =Ô1×8Ò8¸Ñ=Ô=€OØð 2Ø˜C /Ñ1Ñ1ÐØð 2ØÐ!1Ñ1ÐØÐr�   c                 ó†   — dt          | ¦  «        z  }|s,t          j        dd|¦  «        }t          j        dd|¦  «        }|S )aô  
    Round a floating point number to two decimal places in a human friendly format.

    :param count: The number to format.
    :param keep_width: :data:`True` if trailing zeros should not be stripped,
                       :data:`False` if they can be stripped.
    :returns: The formatted number as a string. If no decimal places are
              required to represent the number, they will be omitted.

    The main purpose of this function is to be used by functions like
    :func:`format_length()`, :func:`format_size()` and
    :func:`format_timespan()`.

    Here are some examples:

    >>> from humanfriendly import round_number
    >>> round_number(1)
    '1'
    >>> round_number(math.pi)
    '3.14'
    >>> round_number(5.001)
    '5'
    z%.2fz0+$rx   z\.$)r–   rƒ   Úsub)Úcountr’   Útexts      r€   r!   r!   s  sG   € ð0 •E˜%‘L”LÑ €DØð (ÝŒv�e˜R Ñ&Ô&ˆÝŒv�f˜b $Ñ'Ô'ˆØ€Kr�   r®   c           	      ó   — t          | ¦  «        } | dk     r|st          t          | ¦  «        d¦  «        S g }t          j        t          | ¦  «        ¦  «        } t          t          t          |rdndd…         ¦  «        ¦  «        }|D ]’}t          j        t          |d         ¦  «        ¦  «        }| |z  }| |z  } ||d         k    rt          |¦  «        }nt          |¦  «        }|dvr0| 
                    t          ||d	         |d
         ¦  «        ¦  «         Œ“t          |¦  «        dk    r|d         S |s
|d|…         }t          |¦  «        S )a½  
    Format a timespan in seconds as a human readable string.

    :param num_seconds: Any value accepted by :func:`coerce_seconds()`.
    :param detailed: If :data:`True` milliseconds are represented separately
                     instead of being represented as fractional seconds
                     (defaults to :data:`False`).
    :param max_units: The maximum number of units to show in the formatted time
                      span (an integer, defaults to three).
    :returns: The formatted timespan as a string.
    :raise: See :func:`coerce_seconds()`.

    Some examples:

    >>> from humanfriendly import format_timespan
    >>> format_timespan(0)
    '0 seconds'
    >>> format_timespan(1)
    '1 second'
    >>> import math
    >>> format_timespan(math.pi)
    '3.14 seconds'
    >>> hour = 60 * 60
    >>> day = hour * 24
    >>> week = day * 7
    >>> format_timespan(week * 52 + day * 2 + hour * 3)
    '1 year, 2 days and 3 hours'
    r^   rY   r   r®   NrE   éÿÿÿÿ)r   rt   rF   rG   rK   )r   r   r!   r˜   ÚDecimalr°   Úlistr”   r"   r¡   r´   rŸ   r   )Únum_secondsÚdetailedÚ	max_unitsÚresultÚrelevant_unitsrš   rE   rÀ   s           r€   r   r   ’  s^  € õ: ! Ñ-Ô-€KØ�RÒÐ Ðå� kÑ2Ô2°HÑ=Ô=Ð=ð ˆÝ”o¥c¨+Ñ&6Ô&6Ñ7Ô7ˆÝ�h¥z°xÐ2F°!°!ÀQÐ2GÐ2GÔ'HÑIÔIÑJÔJˆØ"ð 	Rð 	RˆDå”o¥c¨$¨y¬/Ñ&:Ô&:Ñ;Ô;ˆGØ 'Ñ)ˆEØ˜7Ñ"ˆKà�~ bÔ)Ò)Ð)å˜E™
œ
��õ % UÑ+Ô+�à˜HÐ$Ð$Ø—’�i¨¨t°JÔ/?ÀÀhÄÑPÔPÑQÔQÐQøÝˆv‰;Œ;˜!ÒÐà˜!”9Ðàð ,à 
  
Ô+�å˜vÑ&Ô&Ð&r�   c                 ó  — t          | ¦  «        }|rÖt          |d         t          j        ¦  «        r¶t	          |¦  «        dk    rt          |d         ¦  «        S t	          |¦  «        dk    r{t          |d         ¦  «        rf|d                              ¦   «         }t          D ]D}||d         k    s||d         k    s
||d         v r t          |d         ¦  «        |d         z  c S ŒEd}t          t          || |¦  «        ¦  «        ‚)	aµ  
    Parse a "human friendly" timespan into the number of seconds.

    :param value: A string like ``5h`` (5 hours), ``10m`` (10 minutes) or
                  ``42s`` (42 seconds).
    :returns: The number of seconds as a floating point number.
    :raises: :exc:`InvalidTimespan` when the input can't be parsed.

    Note that the :func:`parse_timespan()` function is not meant to be the
    "mirror image" of the :func:`format_timespan()` function. Instead it's
    meant to allow humans to easily and succinctly specify a timespan with a
    minimal amount of typing. It's very useful to accept easy to write time
    spans as e.g. command line arguments to programs.

    The time units (and abbreviations) supported by this function are:

    - ms, millisecond, milliseconds
    - s, sec, secs, second, seconds
    - m, min, mins, minute, minutes
    - h, hour, hours
    - d, day, days
    - w, week, weeks
    - y, year, years

    Some examples:

    >>> from humanfriendly import parse_timespan
    >>> parse_timespan('42')
    42.0
    >>> parse_timespan('42s')
    42.0
    >>> parse_timespan('1m')
    60.0
    >>> parse_timespan('1h')
    3600.0
    >>> parse_timespan('1d')
    86400.0
    r   rK   r�   rF   rG   rR   rE   z8Failed to parse timespan! (input %r was tokenized as %r))r	   r†   rŽ   r�   rŸ   r–   r   rz   r"   r   r   )Útimespanr¥   r¦   rš   r   s        r€   r    r    Ò  s  € õN �hÑÔ€FØð >•*˜V AœY­¬Ñ7Ô7ð >åˆv‰;Œ;˜!ÒÐÝ˜ œÑ#Ô#Ð#åˆv‰;Œ;˜!ÒÐ¥	¨&°¬)Ñ 4Ô 4ÐØ$ QœiŸošoÑ/Ô/ˆOÝ"ð >ð >�Ø# t¨JÔ'7Ò7Ð7Ø'¨4°¬>Ò9Ð9Ø'¨4°Ô+@Ð@Ð@Ý  ¨¤Ñ+Ô+¨d°9¬oÑ=Ð=Ð=Ð=ð Að E€CÝ
�&  h°Ñ7Ô7Ñ
8Ô
8Ð8r�   c                 ó   — 	 d„ |                       ¦   «         D ¦   «         }t          |¦  «        dk    r¢t          t          t          |d                               d¦  «        ¦  «        ¦  «        ddgz   }t          t          t          |d                               d¦  «        ¦  «        ¦  «        g d¢z   }t          |dd…         |dd…         z   ¦  «        S t          t          t          |                       d¦  «        ¦  «        ¦  «        ddgz   dd…         \  }}}|||dddfS # t          $ r  d	}t          t          || ¦  «        ¦  «        ‚w xY w)
a3  
    Parse a date/time string into a tuple of integers.

    :param datestring: The date/time string to parse.
    :returns: A tuple with the numbers ``(year, month, day, hour, minute,
              second)`` (all numbers are integers).
    :raises: :exc:`InvalidDate` when the date cannot be parsed.

    Supported date/time formats:

    - ``YYYY-MM-DD``
    - ``YYYY-MM-DD HH:MM:SS``

    .. note:: If you want to parse date/time strings with a fixed, known
              format and :func:`parse_date()` isn't useful to you, consider
              :func:`time.strptime()` or :meth:`datetime.datetime.strptime()`,
              both of which are included in the Python standard library.
              Alternatively for more complex tasks consider using the date/time
              parsing module in the dateutil_ package.

    Examples:

    >>> from humanfriendly import parse_date
    >>> parse_date('2013-06-17')
    (2013, 6, 17, 0, 0, 0)
    >>> parse_date('2013-06-17 02:47:42')
    (2013, 6, 17, 2, 47, 42)

    Here's how you convert the result to a number (`Unix time`_):

    >>> from humanfriendly import parse_date
    >>> from time import mktime
    >>> mktime(parse_date('2013-06-17 02:47:42') + (-1, -1, -1))
    1371430062.0

    And here's how you convert it to a :class:`datetime.datetime` object:

    >>> from humanfriendly import parse_date
    >>> from datetime import datetime
    >>> datetime(*parse_date('2013-06-17 02:47:42'))
    datetime.datetime(2013, 6, 17, 2, 47, 42)

    Here's an example that combines :func:`format_timespan()` and
    :func:`parse_date()` to calculate a human friendly timespan since a
    given date:

    >>> from humanfriendly import format_timespan, parse_date
    >>> from time import mktime, time
    >>> unix_time = mktime(parse_date('2013-06-17 02:47:42') + (-1, -1, -1))
    >>> seconds_since_then = time() - unix_time
    >>> print(format_timespan(seconds_since_then))
    1 year, 43 weeks and 1 day

    .. _dateutil: https://dateutil.readthedocs.io/en/latest/parser.html
    .. _Unix time: http://en.wikipedia.org/wiki/Unix_time
    c                 ó6   — g | ]}|                      ¦   «         ‘ŒS © )ry   )Ú.0Úts     r€   ú
<listcomp>zparse_date.<locals>.<listcomp>E  s    € Ð8Ð8Ð8 �!—'’'‘)”)Ð8Ð8Ð8r�   r�   r   r­   rK   ú:)r   r   r   r®   zJInvalid date! (expected 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS' but got: %r))	ÚsplitrŸ   rÅ   Úmapr¡   ÚtupleÚ	Exceptionr   r   )Ú
datestringr¥   Ú
date_partsÚ
time_partsrl   Úmonthrf   r   s           r€   r   r     sG  € ðr3Ø8Ð8 Z×%5Ò%5Ñ%7Ô%7Ð8Ñ8Ô8ˆÝˆv‰;Œ;˜!ÒÐÝ�c¥# v¨a¤y§¢°sÑ';Ô';Ñ<Ô<Ñ=Ô=ÀÀAÀÑFˆJÝ�c¥# v¨a¤y§¢°sÑ';Ô';Ñ<Ô<Ñ=Ô=À	À	À	ÑIˆJÝ˜ A a Cœ¨:°a¸°c¬?Ñ:Ñ;Ô;Ð;å $¥S­¨j×.>Ò.>¸sÑ.CÔ.CÑ%DÔ%DÑ EÔ EÈÈAÈÑ NÐPQÐRSÐPSÔTÑˆD�%˜Ø˜%  a¨¨AÐ.Ð.øÝð 3ð 3ð 3ØZˆÝ�&  jÑ1Ô1Ñ2Ô2Ð2ð3øøøs   ‚CD# ÃAD# Ä#*Ec                 ój  — t           j                             | ¦  «        } t           j                             d¦  «        }|rrt           j                             |¦  «        }|                      |¦  «        r>t           j                             dt           j                             | |¦  «        ¦  «        } | S )aÐ  
    Shorten a pathname to make it more human friendly.

    :param pathname: An absolute pathname (a string).
    :returns: The pathname with the user's home directory abbreviated.

    Given an absolute pathname, this function abbreviates the user's home
    directory to ``~/`` in order to shorten the pathname without losing
    information. It is not an error if the pathname is not relative to the
    current user's home directory.

    Here's an example of its usage:

    >>> from os import environ
    >>> from os.path import join
    >>> vimrc = join(environ['HOME'], '.vimrc')
    >>> vimrc
    '/home/peter/.vimrc'
    >>> from humanfriendly import format_path
    >>> format_path(vimrc)
    '~/.vimrc'
    ÚHOMEú~)ÚosÚpathÚabspathÚenvironÚgetr    r²   Úrelpath)ÚpathnameÚhomes     r€   r   r   R  s‡   € õ. Œw�Š˜xÑ(Ô(€HÝŒ:�>Š>˜&Ñ!Ô!€DØð JÝŒw�Š˜tÑ$Ô$ˆØ×Ò˜tÑ$Ô$ð 	JÝ”w—|’| C­¬¯ª¸À4Ñ)HÔ)HÑIÔIˆHØ€Or�   c                 ó´   — t           j                             t           j                             t           j                             | ¦  «        ¦  «        ¦  «        S )a~  
    Convert a human friendly pathname to an absolute pathname.

    Expands leading tildes using :func:`os.path.expanduser()` and
    environment variables using :func:`os.path.expandvars()` and makes the
    resulting pathname absolute using :func:`os.path.abspath()`.

    :param pathname: A human friendly pathname (a string).
    :returns: An absolute pathname (a string).
    )rß   rà   rá   Ú
expanduserÚ
expandvars)rå   s    r€   r   r   r  s8   € õ Œ7�?Š?�2œ7×-Ò-­b¬g×.@Ò.@ÀÑ.JÔ.JÑKÔKÑLÔLÐLr�   c                   ó`   — e Zd ZdZdd„Zd„ Zdd„Zd„ Zed„ ¦   «         Z	ed	„ ¦   «         Z
d
„ ZdS )r   zD
    Easy to use timer to keep track of long during operations.
    NFc                 óº   — |rd| _         d| _        d| _        d| _        dS |rd| _         d| _        || _        dS d| _         d| _        t          ¦   «         | _        dS )a�  
        Remember the time when the :class:`Timer` was created.

        :param start_time: The start time (a float, defaults to the current time).
        :param resumable: Create a resumable timer (defaults to :data:`False`).

        When `start_time` is given :class:`Timer` uses :func:`time.time()` as a
        clock source, otherwise it uses :func:`humanfriendly.compat.monotonic()`.
        Tç        FN)r   Ú	resumableÚ
start_timeÚ
total_time)Úselfrî   rí   s      r€   Ú__init__zTimer.__init__†  sj   € ð ð 	*Ø!ˆDŒNØ!ˆDŒNØ!ˆDŒOØ!ˆDŒOˆOˆOØð 	*Ø"ˆDŒNØ"ˆDŒNØ(ˆDŒOˆOˆOà!ˆDŒNØ"ˆDŒNÝ'™kœkˆDŒOˆOˆOr�   c                 óX   — | j         st          d¦  «        ‚t          ¦   «         | _        | S )zµ
        Start or resume counting elapsed time.

        :returns: The :class:`Timer` object.
        :raises: :exc:`~exceptions.ValueError` when the timer isn't resumable.
        úTimer is not resumable!)rí   r{   r   rî   ©rð   s    r€   Ú	__enter__zTimer.__enter__ž  s-   € ð Œ~ð 	8ÝÐ6Ñ7Ô7Ð7Ý#™+œ+ˆŒØˆr�   c                 óš   — | j         st          d¦  «        ‚| j        r-| xj        t	          ¦   «         | j        z
  z  c_        d| _        dS dS )z}
        Stop counting elapsed time.

        :raises: :exc:`~exceptions.ValueError` when the timer isn't resumable.
        ró   rì   N)rí   r{   rî   rï   r   )rð   Úexc_typeÚ	exc_valueÚ	tracebacks       r€   Ú__exit__zTimer.__exit__ª  sW   € ð Œ~ð 	8ÝÐ6Ñ7Ô7Ð7ØŒ?ð 	"ØˆOŒO�y™{œ{¨T¬_Ñ<Ñ<ˆOŒOØ!ˆDŒOˆOˆOð	"ð 	"r�   c                 óZ   — t          j        t          d|| j        z
  ¦  «        ¦  «         dS )a^  
        Easy to use rate limiting of repeating actions.

        :param seconds: The number of seconds to sleep (an
                        integer or floating point number).

        This method sleeps for the given number of seconds minus the
        :attr:`elapsed_time`. If the resulting duration is negative
        :func:`time.sleep()` will still be called, but the argument
        given to it will be the number 0 (negative numbers cause
        :func:`time.sleep()` to raise an exception).

        The use case for this is to initialize a :class:`Timer` inside
        the body of a :keyword:`for` or :keyword:`while` loop and call
        :func:`Timer.sleep()` at the end of the loop body to rate limit
        whatever it is that is being done inside the loop body.

        For posterity: Although the implementation of :func:`sleep()` only
        requires a single line of code I've added it to :mod:`humanfriendly`
        anyway because now that I've thought about how to tackle this once I
        never want to have to think about it again :-P (unless I find ways to
        improve this).
        r   N)ÚtimeÚsleepÚmaxÚelapsed_time)rð   rZ   s     r€   rý   zTimer.sleep¶  s,   € õ0 	Œ
•3�q˜' DÔ$5Ñ5Ñ6Ô6Ñ7Ô7Ð7Ð7Ð7r�   c                 ó¤   — d}| j         r
|| j        z  }| j        r5| j        rt          ¦   «         nt	          j        ¦   «         }||| j        z
  z  }|S )z;
        Get the number of seconds counted so far.
        r   )rí   rï   rî   r   rü   )rð   rÿ   Úcurrent_times      r€   rÿ   zTimer.elapsed_timeÐ  sZ   € ð
 ˆØŒ>ð 	,Ø˜DœOÑ+ˆLØŒ?ð 	;Ø*.¬.ÐI�9™;œ;˜;½d¼i¹k¼kˆLØ˜L¨4¬?Ñ:Ñ:ˆLØÐr�   c                 óD   — t          t          | j        ¦  «        ¦  «        S )z6Human readable timespan rounded to seconds (a string).)r   Úroundrÿ   rô   s    r€   ÚroundedzTimer.roundedÝ  s   € õ �u TÔ%6Ñ7Ô7Ñ8Ô8Ð8r�   c                 ó*   — t          | j        ¦  «        S )z;Show the elapsed time since the :class:`Timer` was created.)r   rÿ   rô   s    r€   Ú__str__zTimer.__str__â  s   € å˜tÔ0Ñ1Ô1Ð1r�   )NF)NNN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__rñ   rõ   rú   rý   Úpropertyrÿ   r  r  rÏ   r�   r€   r   r   €  s©   € € € € € ðð ð*ð *ð *ð *ð0
ð 
ð 
ð
"ð 
"ð 
"ð 
"ð8ð 8ð 8ð4 ð
ð 
ñ „Xð
ð ð9ð 9ñ „Xð9ð2ð 2ð 2ð 2ð 2r�   r   c                   ó   — e Zd ZdZdS )r   a¢  
    Raised when a string cannot be parsed into a date.

    For example:

    >>> from humanfriendly import parse_date
    >>> parse_date('2013-06-XY')
    Traceback (most recent call last):
      File "humanfriendly.py", line 206, in parse_date
        raise InvalidDate(format(msg, datestring))
    humanfriendly.InvalidDate: Invalid date! (expected 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS' but got: '2013-06-XY')
    N©r  r  r	  r
  rÏ   r�   r€   r   r   ç  ó   € € € € € ðð ð ð r�   r   c                   ó   — e Zd ZdZdS )r   a”  
    Raised when a string cannot be parsed into a file size.

    For example:

    >>> from humanfriendly import parse_size
    >>> parse_size('5 Z')
    Traceback (most recent call last):
      File "humanfriendly/__init__.py", line 267, in parse_size
        raise InvalidSize(format(msg, size, tokens))
    humanfriendly.InvalidSize: Failed to parse size! (input '5 Z' was tokenized as [5, 'Z'])
    Nr  rÏ   r�   r€   r   r   ÷  r  r�   r   c                   ó   — e Zd ZdZdS )r   aŸ  
    Raised when a string cannot be parsed into a length.

    For example:

    >>> from humanfriendly import parse_length
    >>> parse_length('5 Z')
    Traceback (most recent call last):
      File "humanfriendly/__init__.py", line 267, in parse_length
        raise InvalidLength(format(msg, length, tokens))
    humanfriendly.InvalidLength: Failed to parse length! (input '5 Z' was tokenized as [5, 'Z'])
    Nr  rÏ   r�   r€   r   r     r  r�   r   c                   ó   — e Zd ZdZdS )r   aµ  
    Raised when a string cannot be parsed into a timespan.

    For example:

    >>> from humanfriendly import parse_timespan
    >>> parse_timespan('1 age')
    Traceback (most recent call last):
      File "humanfriendly/__init__.py", line 419, in parse_timespan
        raise InvalidTimespan(format(msg, timespan, tokens))
    humanfriendly.InvalidTimespan: Failed to parse timespan! (input '1 age' was tokenized as [1, 'age'])
    Nr  rÏ   r�   r€   r   r     r  r�   r   Úmodule_nameÚformat_tablez(humanfriendly.tables.format_pretty_tableÚcompactzhumanfriendly.text.compactr   zhumanfriendly.text.concatenateÚdedentzhumanfriendly.text.dedentr   zhumanfriendly.text.formatÚis_empty_linez humanfriendly.text.is_empty_liner   zhumanfriendly.text.pluralizer	   zhumanfriendly.text.tokenizeÚtrim_empty_linesz#humanfriendly.text.trim_empty_linesÚprompt_for_choicez'humanfriendly.prompts.prompt_for_choiceÚAutomaticSpinnerz0humanfriendly.terminal.spinners.AutomaticSpinnerÚSpinnerz'humanfriendly.terminal.spinners.SpinnerÚerase_line_codez&humanfriendly.terminal.ANSI_ERASE_LINEÚhide_cursor_codez'humanfriendly.terminal.ANSI_SHOW_CURSORÚminimum_spinner_intervalz0humanfriendly.terminal.spinners.MINIMUM_INTERVALÚshow_cursor_codez'humanfriendly.terminal.ANSI_HIDE_CURSOR)r   )FF)F)r�   )Fr®   rÏ   )2r
  Úcollectionsr‹   r˜   rŽ   rß   Úos.pathrƒ   rü   Úhumanfriendly.compatr   r   Úhumanfriendly.deprecationr   Úhumanfriendly.textr   r   r   r	   Ú__all__r   Ú
namedtupler   r
   r   Údictr   r"   r   r   r   r   r   r   r   r   r!   r   r    r   r   r   Úobjectr   r×   r   r   r   r   r  rÏ   r�   r€   ú<module>r(     s�  ðð 6Ð 5ð Ð Ð Ð Ø €€€Ø €€€Ø €€€Ø 	€	€	€	Ø €€€Ø 	€	€	€	Ø €€€ð 6Ð 5Ð 5Ð 5Ð 5Ð 5Ð 5Ð 5Ø 4Ð 4Ð 4Ð 4Ð 4Ð 4Ø GÐ GÐ GÐ GÐ GÐ GÐ GÐ GÐ GÐ GÐ GÐ Gð€ð: €ð "ˆ;Ô! *Ð.EÑFÔF€Ø%ˆ{Ô% nÐ6GÑHÔH€ð €L��˜' 4¨Ñ4Ô4°h°h¸wÈÈzÑ6ZÔ6ZÑ[Ô[Ø€L��˜' 4¨Ñ4Ô4°h°h¸wÈÈzÑ6ZÔ6ZÑ[Ô[Ø€L��˜' 4¨Ñ4Ô4°h°h¸wÈÈzÑ6ZÔ6ZÑ[Ô[Ø€L��˜' 4¨Ñ4Ô4°h°h¸wÈÈzÑ6ZÔ6ZÑ[Ô[Ø€L��˜' 4¨Ñ4Ô4°h°h¸wÈÈzÑ6ZÔ6ZÑ[Ô[Ø€L��˜' 4¨Ñ3Ô3°X°X¸gÀuÈjÑ5YÔ5YÑZÔZØ€L��˜' 4¨Ñ5Ô5°x°xÀÈÐPZÑ7[Ô7[Ñ\Ô\Ø€L��˜' 4¨Ñ5Ô5°x°xÀÈÐPZÑ7[Ô7[Ñ\Ô\ð	€ð �T ¨u¸tÈDÐQÑQÔQØ�T ¨u¸tÈDÐQÑQÔQØ�T ¨u¸tÈDÐQÑQÔQØ�T ¨a¸'È(ÐSÑSÔSØ�T ¨t¸dÈ4ÐPÑPÔPð	RÐ ð ˆd˜4¨,¸}Ð]aÐ\bÐcÑcÔcØˆd˜4¨-ÀÐ_cÐ^dÐeÑeÔeØˆd˜4¨-ÀÐ_cÐ^dÐeÑeÔeØˆd˜1 x¸	ÐQeÐQeÐQeÐfÑfÔfØˆd˜2¨¸ÐRfÐRfÐRfÐgÑgÔgØˆd˜7¨V¸GÐTWÐSXÐYÑYÔYØˆd˜<°%ÀÐWZÐV[Ð\Ñ\Ô\ØˆdÐ+°fÀWÐ]`Ð\aÐbÑbÔbØˆdÐ0¸6È'ÐbeÐafÐgÑgÔgði€
ðð ð ð8ð ð ð ð,ð ð ð&#(ð #(ð #(ð #(ðL=1ð =1ð =1ð =1ð@*ð *ð *ð *ð@"5ð "5ð "5ðJ%ð %ð %ð %ðPð ð ð ð>='ð ='ð ='ð ='ð@69ð 69ð 69ðrD3ð D3ð D3ðNð ð ð@Mð Mð Mðd2ð d2ð d2ð d2ð d2ˆFñ d2ô d2ð d2ðNð ð ð ð �)ñ ô ð ð ð ð ð ð �)ñ ô ð ð ð ð ð ð �Iñ ô ð ð ð ð ð ð �iñ ô ð ð" €ð ð ð Ø�ðð <Ð;ðð )Ð(ðð 1Ð0ðð 'Ð&ðð 'Ð&ðð 5Ð4ðð -Ð,ðð  +Ð*ð!ð" ;Ð:ð#ð( @Ð?ð)ð0 HÐGð1ð2 6Ð5ð3ð4 =Ð<ð5ð6 ?Ð>ð7ð8 PÐOð9ð: ?Ð>ð;ð ð ð r�   