+
    ÁFñj.  ã                   ó2  € R t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RI	H
t
 ^ RIHt ]'       d   ^ RIHt ]P                  P                   t ^ RItR R ltRR R	 lltRR
 R lltRR R lltR R ltR R ltR R ltR R ltR#   ] d    Rt LCi ; i)aÑ  This module contains helper functions related to datetime and timestamp conversations.

.. versionchanged:: 20.0
   Previously, the contents of this module were available through the (no longer existing)
   module ``telegram._utils.helpers``.

Warning:
    Contents of this module are intended to be used internally by the library and *not* by the
    user. Changes to this module are not considered breaking changes and may not be documented in
    the changelog.
N)ÚTYPE_CHECKING)Úwarn)ÚPTBDeprecationWarning)ÚBotc                óx   € V ^8„  d   QhR\         P                  R\         P                  R\         P                  /# )é   ÚdatetimeÚtzinfoÚreturn)Údtmr   r	   )Úformats   "ÚN/opt/hermes-site/venv/lib/python3.14/site-packages/telegram/_utils/datetime.pyÚ__annotate__r   3   s-   € ÷ 'ñ '”s—|‘|ð '¬S¯Z©Zð '¼C¿L¹Lñ 'ó    c                ó˜  € V\         J d   V P                  \         R7      # \        P                  ! \        4      ;_uu_ 4        \        V\        P                  4      '       d   VP                  V 4      uuRRR4       #  RRR4       V P                  f   V P                  VR7      # V P                  V4      #   + '       g   i     LA; i)z<Localize the datetime, both for pytz and zoneinfo timezones.©r	   N)ÚUTCÚreplaceÚ
contextlibÚsuppressÚAttributeErrorÚ
isinstanceÚpytzÚ
BaseTzInfoÚlocalizer	   Ú
astimezone)r   r	   s   &&r   r   r   3   s•   € à”ƒ}Ø×Ñ¤sÐÓ+Ð+ä	×	Ò	œ^×	,Õ	,ä�fœdŸo™o×.Ò.Ø—?‘? 8Ó,÷ 
-Ò	,à.÷ 
-ð
 ‡�ÒØ×Ñ vÐÓ.Ð.Ø×Ñ˜vÓ&Ð&÷ 
-×	,ús   Á1B9Â9C		c                óö   € V ^8„  d   QhR\         \        P                  ,          \        P                  ,          \        P                  ,          R\         R,          R\        P
                  R,          R\         /# )r   Útime_objectÚreference_timestampNr	   r
   )Úfloatr   Ú	timedeltar   Útimer	   )r   s   "r   r   r   B   sd   € ÷ c[ñ c[ÜœŸ™Õ&¬¯©Õ5¼¿¹Õ@ðc[ä �ðc[ô �J‰J˜Õðc[ô ñ	c[r   c                óü  € Vf   \         P                   ! 4       pM+\        V \        P                  4      '       d   \	        R4      h\        V \        P
                  4      '       d   WP                  4       ,           # \        V \        \        ,          4      '       d	   W,           # Vf   \        p\        V \        P                   4      '       dÊ   \        P                  P                  YP                  ;'       g    TR7      pVP                  4       pVP                  4       p\        P                  P                  W@4      pVP                  f   \        Wb4      pWVP                  4       8”  d   V\        P
                  ! ^R7      ,          p\!        V4      # \        V \        P                  4      '       d%   V P                  f   \        W4      p \!        V 4      # \#        R\%        V 4      P&                   R24      h)a8  
Converts a given time object to a float POSIX timestamp.
Used to convert different time specifications to a common format. The time object
can be relative (i.e. indicate a time increment, or a time of day) or absolute.
Objects from the :class:`datetime` module that are timezone-naive will be assumed
to be in UTC, if ``bot`` is not passed or ``bot.defaults`` is :obj:`None`.

Args:
    time_object (:obj:`float` | :obj:`datetime.timedelta` |             :obj:`datetime.datetime` | :obj:`datetime.time`):
        Time value to convert. The semantics of this parameter will depend on its type:

        * :obj:`float` will be interpreted as "seconds from :paramref:`reference_t`"
        * :obj:`datetime.timedelta` will be interpreted as
          "time increment from :paramref:`reference_timestamp`"
        * :obj:`datetime.datetime` will be interpreted as an absolute date/time value
        * :obj:`datetime.time` will be interpreted as a specific time of day

    reference_timestamp (:obj:`float`, optional): POSIX timestamp that indicates the absolute
        time from which relative calculations are to be performed (e.g. when
        :paramref:`time_object` is given as an :obj:`int`, indicating "seconds from
        :paramref:`reference_time`"). Defaults to now (the time at which this function is
        called).

        If :paramref:`time_object` is given as an absolute representation of date & time (i.e.
        a :obj:`datetime.datetime` object), :paramref:`reference_timestamp` is not relevant
        and so its value should be :obj:`None`. If this is not the case, a :exc:`ValueError`
        will be raised.
    tzinfo (:class:`datetime.tzinfo`, optional): If :paramref:`time_object` is a naive object
        from the :mod:`datetime` module, it will be interpreted as this timezone. Defaults to
        :attr:`datetime.timezone.utc` otherwise.

        Note:
            Only to be used by ``telegram.ext``.

Returns:
    :obj:`float` | :obj:`None`:
        The return value depends on the type of argument :paramref:`time_object`.
        If :paramref:`time_object` is given as a time increment (i.e. as a :obj:`int`,
        :obj:`float` or :obj:`datetime.timedelta`), then the return value will be
        :paramref:`reference_timestamp` + :paramref:`time_object`.

        Else if it is given as an absolute date/time value (i.e. a :obj:`datetime.datetime`
        object), the equivalent value as a POSIX timestamp will be returned.

        Finally, if it is a time of the day without date (i.e. a :obj:`datetime.time`
        object), the return value is the nearest future occurrence of that time of day.

Raises:
    TypeError: If :paramref:`time_object` s type is not one of those described above.
    ValueError: If :paramref:`time_object` is a :obj:`datetime.datetime` and
        :paramref:`reference_timestamp` is not :obj:`None`.
zAt is an (absolute) datetime while reference_timestamp is not None©Útz)ÚdayszUnable to convert z object to timestamp)r!   r   r   r   Ú
ValueErrorr    Útotal_secondsÚintr   r   Úfromtimestampr	   ÚdateÚtimetzÚcombiner   Ú_datetime_to_float_timestampÚ	TypeErrorÚtypeÚ__name__)r   r   r	   Úreference_dtÚreference_dateÚreference_timeÚaware_datetimes   &&&    r   Úto_float_timestampr5   B   s…  € ðt Ò"Ü"Ÿiši›kÑÜ	�K¤§¡×	.Ò	.ÜÐ\Ó]Ð]ä�+œsŸ}™}×-Ò-Ø"×%>Ñ%>Ó%@Õ@Ð@Ü�+œs¤U�{×+Ò+Ø"Õ0Ð0à‚~ô ˆä�+œsŸx™x×(Ò(Ü—|‘|×1Ñ1Ø×$6Ñ$6×$@Ð$@¸&ð 2ó 
ˆð &×*Ñ*Ó,ˆØ%×,Ñ,Ó.ˆäŸ™×-Ñ-¨nÓJˆØ× Ñ Ò(ô & nÓ=ˆNð ×1Ñ1Ó3Ô3ØœcŸmšm°Ô3Õ3ˆNÜ+¨NÓ;Ð;Ü�+œsŸ|™|×,Ò,Ø×ÑÒ%Ü" ;Ó7ˆKÜ+¨KÓ8Ð8ä
Ð(¬¨kÓ):×)CÑ)CÐ(DÐDXÐYÓ
ZÐZr   c          	      ó  € V ^8„  d   QhR\         \        P                  ,          \        P                  ,          \        P                  ,          R,          R\         R,          R\        P
                  R,          R\        R,          /# )r   Údt_objNr   r	   r
   )r   r   r    r   r!   r	   r(   )r   s   "r   r   r   ¨   sa   € ÷ ñ Ü”C—M‘MÕ!¤C§L¡LÕ0´3·8±8Õ;¸dÕBðä �ðô �J‰J˜Õðô 	ˆ4…Zñ	r   c                ó8   € V e   \        \        WV4      4      # R# )zÃ
Wrapper over :func:`to_float_timestamp` which returns an integer (the float value truncated
down to the nearest integer).

See the documentation for :func:`to_float_timestamp` for more details.
N)r(   r5   )r7   r   r	   s   &&&r   Úto_timestampr9   ¨   s+   € ð Òô 	Ô˜v¸FÓCÓDðð ðr   c                óŽ   € V ^8„  d   QhR\         R,          R\        P                  R,          R\        P                  R,          /# )r   ÚunixtimeNr	   r
   )r(   r   r	   r   )r   s   "r   r   r   º   sA   € ÷ Vñ VÜ�D�jðVä�J‰J˜ÕðVô 	‡\�\�DÕñVr   c                ól   € V f   R# \         P                  P                  Yf   \        R7      # TR7      # )a=  
Converts an (integer) unix timestamp to a timezone aware datetime object.
:obj:`None` s are left alone (i.e. ``from_timestamp(None)`` is :obj:`None`).

Args:
    unixtime (:obj:`int`): Integer POSIX timestamp.
    tzinfo (:obj:`datetime.tzinfo`, optional): The timezone to which the timestamp is to be
        converted to. Defaults to :obj:`None`, in which case the returned datetime object will
        be timezone aware and in UTC.

Returns:
    Timezone aware equivalent :obj:`datetime.datetime` value if :paramref:`unixtime` is not
    :obj:`None`; else :obj:`None`.
Nr#   )r   r   r)   r   )r;   r	   s   &&r   Úfrom_timestampr=   º   s4   € ð$ ÒÙä�<‰<×%Ñ% hº.´3Ð%ÓUÐUÈfÐ%ÓUÐUr   c                óJ   € V ^8„  d   QhRRR\         P                  R,          /# )r   Úbotz
Bot | Noner
   N)r   r	   )r   s   "r   r   r   Ò   s#   € ÷ ñ  lð ´s·z±zÀDÕ7Hñ r   c                ó†   € V f   R# \        V R4      '       d)   V P                  '       d   V P                  P                  # R# )z{
Extracts the timezone info from the default values of the bot.
If the bot has no default values, :obj:`None` is returned.
NÚdefaults)ÚhasattrrA   r	   )r?   s   &r   Úextract_tzinfo_from_defaultsrC   Ò   s4   € ð ‚{Ùäˆs�J×Ò C§L§L LØ�|‰|×"Ñ"Ð"Ùr   c                óD   € V ^8„  d   QhR\         P                  R\        /# )r   r7   r
   )r   r   r   )r   s   "r   r   r   á   s   € ÷ ñ ¬¯©ð ¼%ñ r   c                ó’   € V P                   f+   V P                  \        P                  P                  R7      p V P                  4       # )z”
Converts a datetime object to a float timestamp (with sub-second precision).
If the datetime object is timezone-naive, it is assumed to be in UTC.
r   )r	   r   r   ÚtimezoneÚutcÚ	timestamp)r7   s   &r   r-   r-   á   s7   € ð
 ‡}�}ÒØ—‘¤s§|¡|×'7Ñ'7�Ó8ˆØ×ÑÓÐr   c                óD   € V ^8„  d   QhR\         R\        P                  /# )r   r$   r
   )ÚstrÚzoneinfoÚZoneInfo)r   s   "r   r   r   ë   s    € ÷ ñ ”cð œh×/Ñ/ñ r   c                ó    €  \         P                  ! V 4      #   \         P                   d!   p\         P                  ! RT  R24      ThRp?ii ; i)ztWrapper around the `ZoneInfo` constructor with slightly more helpful error message
in case tzdata is not installed.
zNo time zone found with key z©. Make sure to use a valid time zone name and correctly install the tzdata (https://pypi.org/project/tzdata/) package if your system does not provide the time zone data.N)rK   rL   ÚZoneInfoNotFoundError)r$   Úerrs   & r   Úget_zone_inforP   ë   sW   € ðÜ× Ò  Ó$Ð$øÜ×)Ñ)ô Ü×,Ò,Ø*¨2¨$ð /?ð ?ó
ð
 ð	ûðús   ‚ ˜A­AÁAc                ó–   € V ^8„  d   QhR\         P                  R,          R\        R\        \         P                  ,          R,          /# )r   ÚvalueNÚ	attributer
   )r   r    rJ   r(   )r   s   "r   r   r   ú   s9   € ÷ 'ñ 'œsŸ}™}¨tÕ3ð 'Äð 'ÌÌcÏmÉmÕH[Ð^bÕHbñ 'r   c                ó  € V f   R# \         P                  ! RR4      P                  4       P                  4       R9   d   V # \	        \        RRV R24      ^R7       V P                  4       ;pP                  4       '       d   \        V4      # T# )	a  
Convert a `datetime.timedelta` to seconds or return it as-is, based on environment config.

This utility is part of the migration process from integer-based time representations
to using `datetime.timedelta`. The behavior is controlled by the `PTB_TIMEDELTA`
environment variable.

Note:
    When `PTB_TIMEDELTA` is not enabled, the function will issue a deprecation warning.

Args:
    value (:obj:`datetime.timedelta`): The timedelta value to process.
    attribute (:obj:`str`): The name of the attribute at the caller scope, used for
        warning messages.

Returns:
    - :obj:`None` if :paramref:`value` is None.
    - :obj:`datetime.timedelta` if `PTB_TIMEDELTA=true` or ``PTB_TIMEDELTA=1``.
    - :obj:`int` if the total seconds is a whole number.
    - float: otherwise.
NÚPTB_TIMEDELTAÚfalsezv22.2z%In a future major version attribute `z�` will be of type `datetime.timedelta`. You can opt-in early by setting `PTB_TIMEDELTA=true` or ``PTB_TIMEDELTA=1`` as an environment variable.)Ú
stacklevel)ÚtrueÚ1)	ÚosÚgetenvÚlowerÚstripr   r   r'   Ú
is_integerr(   )rR   rS   Úsecondss   && r   Úget_timedelta_valuer`   ú   s˜   € ð, ‚}ÙÜ	‡y‚y� 'Ó*×0Ñ0Ó2×8Ñ8Ó:¸mÔKØˆÜÜØØ3°I°;ð ?Bð Bó	
ð õð ×*Ñ*Ó,Ð,ˆG×8Ñ8×:Ò:ô 	ˆG‹ðð ðr   )NN)N)Ú__doc__r   r   r   rZ   r!   rK   Útypingr   Útelegram._utils.warningsr   Útelegram.warningsr   Útelegramr   rF   rG   r   r   ÚImportErrorr   r5   r9   r=   rC   r-   rP   r`   © r   r   Ú<module>rh      s„   ðñ&
ó Û Û 	Û Û Ý  å )Ý 3çÝà	‡l�l×Ñ€ðÛõ
'÷c[÷L÷$Võ0õõ÷'øðW ô Ø‚Dðús   ÁB
 Â
	BÂB