
    Yi                     \   S r SSKrSSKrSSKrSSKJrJrJrJrJ	r	J
r
Jr   SSKrSSKJr  SSKJr  SrSSKJr  SS	KJr  SS
KJr  SSKJr  SSKJrJr  \(       a  \(       a  SSKJr   SSK!J"r"  \#" \$" S5      5      r%\" \&SS9r' " S S\\   5      r( " S S\\   5      rg! \ a    Sr Nvf = f)z2This module contains the classes JobQueue and Job.    N)TYPE_CHECKINGAnyGenericOptionalUnioncastoverload)AsyncIOExecutor)AsyncIOSchedulerTF)
get_logger)build_repr_with_selected_attrs)JSONDict)ExtBot)CCTJobCallback)Job)Application   JobQueue)
class_namec                   2   \ rS rSrSrSrSrS,S jrS\4S jr	\
S-S	 j5       r\
S\4S
 j5       rS\R                  4S jr\S.SSS\SS4S jj5       r\ S.S\\\R*                  \R                  \R,                  4   S\S\R                  4S jj5       r S.S\\\R*                  \R                  \R,                  S4   S\S\\R                     4S jjr    S/S jr\S0S j5       r     S1S\\   S\\\R*                  \R                  \R,                  4   S\\   S\\   S\\   S\\   S\\   SS4S jjr       S2S\\   S\\\R*                  4   S\\\\R*                  \R                  \R,                  4      S\\\\R*                  \R                  \R,                  4      S\\   S\\   S\\   S\\   S\\   SS4S jjr      S1S\\   S\R,                  S \S\\   S\\   S\\   S\\   S\\   SS4S! jjr!\"SSSSS4S\\   S\R,                  S"\#\S#4   S\\   S\\   S\\   S\\   S\\   SS4S$ jjr$    S3S\\   S\S\\   S\\   S\\   S\\   SS4S% jjr%S,S& jr&S4S'\SS4S( jjr'S\#S)   4S* jr(S\S\#S)   4S+ jr)Sr*g)5r   3   a@  This class allows you to periodically perform tasks with the bot. It is a convenience
wrapper for the APScheduler library.

This class is a :class:`~typing.Generic` class and accepts one type variable that specifies
the type of the argument ``context`` of the job callbacks (:paramref:`~run_once.callback`) of
:meth:`run_once` and the other scheduling methods.

Important:
    If you want to use this class, you must install PTB with the optional requirement
    ``job-queue``, i.e.

    .. code-block:: bash

       pip install "python-telegram-bot[job-queue]"

Examples:
    :any:`Timer Bot <examples.timerbot>`

.. seealso:: :wiki:`Architecture Overview <Architecture>`,
    :wiki:`Job Queue <Extensions---JobQueue>`

.. versionchanged:: 20.0
    To use this class, PTB must be installed via
    ``pip install "python-telegram-bot[job-queue]"``.

Attributes:
    scheduler (:class:`apscheduler.schedulers.asyncio.AsyncIOScheduler`): The scheduler.

        Warning:
            This scheduler is configured by :meth:`set_application`. Additional configuration
            settings can be made by users. However, calling
            :meth:`~apscheduler.schedulers.base.BaseScheduler.configure` will delete any
            previous configuration settings. Therefore, please make sure to pass the values
            returned by :attr:`scheduler_configuration` to the method call in addition to your
            custom values.
            Alternatively, you can also use methods like
            :meth:`~apscheduler.schedulers.base.BaseScheduler.add_jobstore` to avoid using
            :meth:`~apscheduler.schedulers.base.BaseScheduler.configure` altogether.

        .. versionchanged:: 20.0
            Uses :class:`~apscheduler.schedulers.asyncio.AsyncIOScheduler` instead of
            :class:`~apscheduler.schedulers.background.BackgroundScheduler`

)_application	_executor	scheduler)sunmontuewedthufrisatreturnNc                     [         (       d  [        S5      eS U l        [        5       U l        [        S0 U R                  D6U l        g )Nz\To use `JobQueue`, PTB must be installed via `pip install "python-telegram-bot[job-queue]"`. )APS_AVAILABLERuntimeErrorr   r
   r   r   scheduler_configurationr   selfs    A/app/.venv/lib/python3.13/site-packages/telegram/ext/_jobqueue.py__init__JobQueue.__init__d   sI    }5 
 KO(*-= .
**.
    c                 (    [        X R                  S9$ )zGive a string representation of the JobQueue in the form ``JobQueue[application=...]``.

As this class doesn't implement :meth:`object.__str__`, the default implementation
will be used, which is equivalent to :meth:`__repr__`.

Returns:
    :obj:`str`
)application)r   r0   r)   s    r+   __repr__JobQueue.__repr__q   s     .d@P@PQQr.   c                 r    U R                   c  [        S5      eU R                  5       nUb  U$ [        S5      e)z1The application this JobQueue is associated with.z)No application was set for this JobQueue.z,The application instance is no longer alive.)r   r'   r*   r0   s     r+   r0   JobQueue.application|   sB     $JKK'')"IJJr.   c                    [         R                  nU R                  (       a  [        U R                  R
                  [        5      (       af  U R                  R
                  R                  (       aA  U R                  R
                  R                  R                  =(       d    [         R                  nUSU R                  0S.$ )a  Provides configuration values that are used by :class:`JobQueue` for :attr:`scheduler`.

Tip:
    Since calling
    :meth:`scheduler.configure() <apscheduler.schedulers.base.BaseScheduler.configure>`
    deletes any previous setting, please make sure to pass these values to the method call
    in addition to your custom values:

    .. code-block:: python

        scheduler.configure(..., **job_queue.scheduler_configuration)

    Alternatively, you can also use methods like
    :meth:`~apscheduler.schedulers.base.BaseScheduler.add_jobstore` to avoid using
    :meth:`~apscheduler.schedulers.base.BaseScheduler.configure` altogether.

.. versionadded:: 20.7

Returns:
    dict[:obj:`str`, :obj:`object`]: The configuration values as dictionary.

default)timezone	executors)
pytzutcr   
isinstancer0   botr   defaultstzinfor   )r*   r8   s     r+   r(    JobQueue.scheduler_configuration   s    0  884++//88  $$--''++44;;GtxxH !#T^^4
 	
r.   c                 h    [         R                   R                  U R                  R                  5      $ N)datetimenowr   r8   r)   s    r+   _tz_nowJobQueue._tz_now   s#      $$T^^%<%<==r.   time	shift_dayc                     g rB   r%   r*   rG   rH   s      r+   _parse_time_inputJobQueue._parse_time_input   s    NQr.   c                     g rB   r%   rJ   s      r+   rK   rL      s    
  r.   c                    Uc  g [        U[        [        45      (       a%  U R                  5       [        R
                  " US9-   $ [        U[        R
                  5      (       a  U R                  5       U-   $ [        U[        R                  5      (       a  [        R                  R                  [        R                  R                  UR                  =(       d    U R                  R                  S9R                  5       U5      nUR                  c%  U R                  R                  R                  U5      nU(       aH  U[        R                  R                  [        R                  5      ::  a  U[        R
                  " SS9-  nU$ U$ )N)seconds)tz   )days)r<   intfloatrE   rC   	timedeltarG   combinerD   r?   r   r8   datelocalizer:   r;   )r*   rG   rH   	date_times       r+   rK   rL      s!   
 <dS%L))<<>H$6$6t$DDDdH..//<<>D((dHMM** ))11!!%%)O8O8O%PUUWY]I ' NN33<<YG	Y(*;*;*?*?*IIX//Q77	r.   c                     [         R                  " U5      U l        U R                  R                  " S0 U R
                  D6  g)zSet the application to be used by this JobQueue.

Args:
    application (:class:`telegram.ext.Application`): The application.

Nr%   )weakrefrefr   r   	configurer(   r4   s     r+   set_applicationJobQueue.set_application   s0     $KK4  @4#?#?@r.   Job[CCT]c                 V   #    UR                  U R                  5      I Sh  vN   g N7f)a!  This method is used as a callback for the APScheduler jobs.

More precisely, the ``func`` argument of :class:`apscheduler.job.Job` is set to this method
and the ``arg`` argument (representing positional arguments to ``func``) is set to a tuple
containing the :class:`JobQueue` itself and the :class:`~telegram.ext.Job` instance.

Tip:
    This method is a static method rather than a bound method. This makes the arguments
    more transparent and allows for easier handling of PTBs integration of APScheduler
    when utilizing advanced features of APScheduler.

Hint:
    This method is effectively a wrapper for :meth:`telegram.ext.Job.run`.

.. versionadded:: 20.4

Args:
    job_queue (:class:`JobQueue`): The job queue that created the job.
    job (:class:`~telegram.ext.Job`): The job to run.
N)runr0   )	job_queuejobs     r+   job_callbackJobQueue.job_callback   s     , ggi++,,,s   )')callbackwhendatanamechat_iduser_id
job_kwargsc           	      .   U(       d  0 nU=(       d    UR                   n[        XXEUS9nU R                  USS9n	U R                  R                  " U R
                  4USU	X4U	R                  =(       d    U R                  R                  S.UD6n
Xl        U$ )ao
  Creates a new :class:`Job` instance that runs once and adds it to the queue.

Args:
    callback (:term:`coroutine function`): The callback function that should be executed by
        the new job. Callback signature::

            async def callback(context: CallbackContext)

    when (:obj:`int` | :obj:`float` | :obj:`datetime.timedelta` |                                           :obj:`datetime.datetime` | :obj:`datetime.time`):
        Time in or at which the job should run. This parameter will be interpreted
        depending on its type.

        * :obj:`int` or :obj:`float` will be interpreted as "seconds from now" in which the
          job should run.
        * :obj:`datetime.timedelta` will be interpreted as "time from now" in which the
          job should run.
        * :obj:`datetime.datetime` will be interpreted as a specific date and time at
          which the job should run. If the timezone (:attr:`datetime.datetime.tzinfo`) is
          :obj:`None`, the default timezone of the bot will be used, which is UTC unless
          :attr:`telegram.ext.Defaults.tzinfo` is used.
        * :obj:`datetime.time` will be interpreted as a specific time of day at which the
          job should run. This could be either today or, if the time has already passed,
          tomorrow. If the timezone (:attr:`datetime.time.tzinfo`) is :obj:`None`, the
          default timezone of the bot will be used, which is UTC unless
          :attr:`telegram.ext.Defaults.tzinfo` is used.

    chat_id (:obj:`int`, optional): Chat id of the chat associated with this job. If
        passed, the corresponding :attr:`~telegram.ext.CallbackContext.chat_data` will
        be available in the callback.

        .. versionadded:: 20.0

    user_id (:obj:`int`, optional): User id of the user associated with this job. If
        passed, the corresponding :attr:`~telegram.ext.CallbackContext.user_data` will
        be available in the callback.

        .. versionadded:: 20.0
    data (:obj:`object`, optional): Additional data needed for the callback function.
        Can be accessed through :attr:`Job.data` in the callback. Defaults to
        :obj:`None`.

        .. versionchanged:: 20.0
            Renamed the parameter ``context`` to :paramref:`data`.
    name (:obj:`str`, optional): The name of the new job. Defaults to
        :external:attr:`callback.__name__ <definition.__name__>`.
    job_kwargs (:obj:`dict`, optional): Arbitrary keyword arguments to pass to the
        :meth:`apscheduler.schedulers.base.BaseScheduler.add_job()`.

Returns:
    :class:`telegram.ext.Job`: The new :class:`Job` instance that has been added to the job
    queue.

rg   ri   rj   rk   rl   T)rH   rW   )rj   triggerrun_dateargsr8   )	__name__r   rK   r   add_jobre   r?   r8   _job)r*   rg   rh   ri   rj   rk   rl   rm   rd   rY   js              r+   run_onceJobQueue.run_once   s    @ J(x((8TT[\**44*@	NN""
%%@)@)@
 
 
r.   intervalfirstlastc
           
         U	(       d  0 n	U=(       d    UR                   n[        XXgUS9n
U R                  U5      nU R                  U5      nU(       a  U(       a  X:  a  [        S5      e[	        U[
        R                  5      (       a  UR                  5       nU R                  R                  " U R                  4SX
4UUUUS.U	D6nXl        U
$ )a~  Creates a new :class:`Job` instance that runs at specified intervals and adds it to the
queue.

Note:
    For a note about DST, please see the documentation of `APScheduler`_.

.. _`APScheduler`: https://apscheduler.readthedocs.io/en/stable/modules/triggers/cron.html
                   #daylight-saving-time-behavior

Args:
    callback (:term:`coroutine function`): The callback function that should be executed by
        the new job. Callback signature::

            async def callback(context: CallbackContext)

    interval (:obj:`int` | :obj:`float` | :obj:`datetime.timedelta`): The interval in which
        the job will run. If it is an :obj:`int` or a :obj:`float`, it will be interpreted
        as seconds.
    first (:obj:`int` | :obj:`float` | :obj:`datetime.timedelta` |                                           :obj:`datetime.datetime` | :obj:`datetime.time`, optional):
        Time in or at which the job should run. This parameter will be interpreted
        depending on its type.

        * :obj:`int` or :obj:`float` will be interpreted as "seconds from now" in which the
          job should run.
        * :obj:`datetime.timedelta` will be interpreted as "time from now" in which the
          job should run.
        * :obj:`datetime.datetime` will be interpreted as a specific date and time at
          which the job should run. If the timezone (:attr:`datetime.datetime.tzinfo`) is
          :obj:`None`, the default timezone of the bot will be used.
        * :obj:`datetime.time` will be interpreted as a specific time of day at which the
          job should run. This could be either today or, if the time has already passed,
          tomorrow. If the timezone (:attr:`datetime.time.tzinfo`) is :obj:`None`, the
          default timezone of the bot will be used, which is UTC unless
          :attr:`telegram.ext.Defaults.tzinfo` is used.

        Defaults to :paramref:`interval`

        Note:
            Setting :paramref:`first` to ``0``, ``datetime.datetime.now()`` or another
            value that indicates that the job should run immediately will not work due
            to how the APScheduler library works. If you want to run a job immediately,
            we recommend to use an approach along the lines of::

                job = context.job_queue.run_repeating(callback, interval=5)
                await job.run(context.application)

            .. seealso:: :meth:`telegram.ext.Job.run`

    last (:obj:`int` | :obj:`float` | :obj:`datetime.timedelta` |                                           :obj:`datetime.datetime` | :obj:`datetime.time`, optional):
        Latest possible time for the job to run. This parameter will be interpreted
        depending on its type. See :paramref:`first` for details.

        If :paramref:`last` is :obj:`datetime.datetime` or :obj:`datetime.time` type
        and ``last.tzinfo`` is :obj:`None`, the default timezone of the bot will be
        assumed, which is UTC unless :attr:`telegram.ext.Defaults.tzinfo` is used.

        Defaults to :obj:`None`.
    data (:obj:`object`, optional): Additional data needed for the callback function.
        Can be accessed through :attr:`Job.data` in the callback. Defaults to
        :obj:`None`.

        .. versionchanged:: 20.0
            Renamed the parameter ``context`` to :paramref:`data`.
    name (:obj:`str`, optional): The name of the new job. Defaults to
        :external:attr:`callback.__name__ <definition.__name__>`.
    chat_id (:obj:`int`, optional): Chat id of the chat associated with this job. If
        passed, the corresponding :attr:`~telegram.ext.CallbackContext.chat_data` will
        be available in the callback.

        .. versionadded:: 20.0

    user_id (:obj:`int`, optional): User id of the user associated with this job. If
        passed, the corresponding :attr:`~telegram.ext.CallbackContext.user_data` will
        be available in the callback.

        .. versionadded:: 20.0
    job_kwargs (:obj:`dict`, optional): Arbitrary keyword arguments to pass to the
        :meth:`apscheduler.schedulers.base.BaseScheduler.add_job()`.

Returns:
    :class:`telegram.ext.Job`: The new :class:`Job` instance that has been added to the job
    queue.

ro   z"'last' must not be before 'first'!ry   )rp   rr   
start_dateend_daterO   rj   )rs   r   rK   
ValueErrorr<   rC   rU   total_secondsr   rt   re   ru   )r*   rg   ry   rz   r{   ri   rj   rk   rl   rm   rd   dt_firstdt_lastrv   s                 r+   run_repeatingJobQueue.run_repeatingF  s    D J(x((8TT[\))%0((.xG$6ABBh 2 233--/HNN""	
	
 	
 
r.   dayc	                 `   U(       d  0 nU=(       d    UR                   n[        XXVUS9n	U R                  R                  " U R                  4SX	4UUS:X  a  SOUUR
                  UR                  UR                  UR                  =(       d    U R                  R                  S.UD6n
Xl
        U	$ )a  Creates a new :class:`Job` that runs on a monthly basis and adds it to the queue.

.. versionchanged:: 20.0
    The ``day_is_strict`` argument was removed. Instead one can now pass ``-1`` to the
    :paramref:`day` parameter to have the job run on the last day of the month.

Args:
    callback (:term:`coroutine function`): The callback function that should be executed by
        the new job. Callback signature::

            async def callback(context: CallbackContext)

    when (:obj:`datetime.time`): Time of day at which the job should run. If the timezone
        (``when.tzinfo``) is :obj:`None`, the default timezone of the bot will be used,
        which is UTC unless :attr:`telegram.ext.Defaults.tzinfo` is used.
    day (:obj:`int`): Defines the day of the month whereby the job would run. It should
        be within the range of ``1`` and ``31``, inclusive. If a month has fewer days than
        this number, the job will not run in this month. Passing ``-1`` leads to the job
        running on the last day of the month.
    data (:obj:`object`, optional): Additional data needed for the callback function.
        Can be accessed through :attr:`Job.data` in the callback. Defaults to
        :obj:`None`.

        .. versionchanged:: 20.0
            Renamed the parameter ``context`` to :paramref:`data`.
    name (:obj:`str`, optional): The name of the new job. Defaults to
        :external:attr:`callback.__name__ <definition.__name__>`.
    chat_id (:obj:`int`, optional): Chat id of the chat associated with this job. If
        passed, the corresponding :attr:`~telegram.ext.CallbackContext.chat_data` will
        be available in the callback.

        .. versionadded:: 20.0

    user_id (:obj:`int`, optional): User id of the user associated with this job. If
        passed, the corresponding :attr:`~telegram.ext.CallbackContext.user_data` will
        be available in the callback.

        .. versionadded:: 20.0
    job_kwargs (:obj:`dict`, optional): Arbitrary keyword arguments to pass to the
        :meth:`apscheduler.schedulers.base.BaseScheduler.add_job()`.

Returns:
    :class:`telegram.ext.Job`: The new :class:`Job` instance that has been added to the job
    queue.

ro   cronr{   )rp   rr   rj   r   hourminutesecondr8   )rs   r   r   rt   re   r   r   r   r?   r8   ru   )r*   rg   rh   r   ri   rj   rk   rl   rm   rd   rv   s              r+   run_monthlyJobQueue.run_monthly  s    r J(x((8TT[\NN""
);;;;[[;DNN$;$;
 
 
r.   rR   .c	                    U(       d  0 nU=(       d    UR                   n[        XXVUS9n	U R                  R                  " U R                  4UX	4SSR                  U V
s/ s H  oR                  U
   PM     sn
5      UR                  UR                  UR                  UR                  =(       d    U R                  R                  S.UD6nXl        U	$ s  sn
f )a  Creates a new :class:`Job` that runs on a daily basis and adds it to the queue.

Note:
    For a note about DST, please see the documentation of `APScheduler`_.

.. _`APScheduler`: https://apscheduler.readthedocs.io/en/stable/modules/triggers/cron.html
                   #daylight-saving-time-behavior

Args:
    callback (:term:`coroutine function`): The callback function that should be executed by
        the new job. Callback signature::

            async def callback(context: CallbackContext)

    time (:obj:`datetime.time`): Time of day at which the job should run. If the timezone
        (:obj:`datetime.time.tzinfo`) is :obj:`None`, the default timezone of the bot will
        be used, which is UTC unless :attr:`telegram.ext.Defaults.tzinfo` is used.
    days (tuple[:obj:`int`], optional): Defines on which days of the week the job should
        run (where ``0-6`` correspond to sunday - saturday). By default, the job will run
        every day.

        .. versionchanged:: 20.0
            Changed day of the week mapping of 0-6 from monday-sunday to sunday-saturday.

    data (:obj:`object`, optional): Additional data needed for the callback function.
        Can be accessed through :attr:`Job.data` in the callback. Defaults to
        :obj:`None`.

        .. versionchanged:: 20.0
            Renamed the parameter ``context`` to :paramref:`data`.
    name (:obj:`str`, optional): The name of the new job. Defaults to
        :external:attr:`callback.__name__ <definition.__name__>`.
    chat_id (:obj:`int`, optional): Chat id of the chat associated with this job. If
        passed, the corresponding :attr:`~telegram.ext.CallbackContext.chat_data` will
        be available in the callback.

        .. versionadded:: 20.0

    user_id (:obj:`int`, optional): User id of the user associated with this job. If
        passed, the corresponding :attr:`~telegram.ext.CallbackContext.user_data` will
        be available in the callback.

        .. versionadded:: 20.0
    job_kwargs (:obj:`dict`, optional): Arbitrary keyword arguments to pass to the
        :meth:`apscheduler.schedulers.base.BaseScheduler.add_job()`.

Returns:
    :class:`telegram.ext.Job`: The new :class:`Job` instance that has been added to the job
    queue.

ro   r   ,)rj   rr   rp   day_of_weekr   r   r   r8   )rs   r   r   rt   re   join_CRON_MAPPINGr   r   r   r?   r8   ru   )r*   rg   rG   rR   ri   rj   rk   rl   rm   rd   drv   s               r+   	run_dailyJobQueue.run_daily  s    | J(x((8TT[\NN""
!FA"4"4Q"7!FG;;;;[[;DNN$;$;
 
 
 "Gs   Cc                     U=(       d    UR                   n[        XXEUS9nU R                  R                  " U R                  4X4US.UD6nXl        U$ )a  Creates a new custom defined :class:`Job`.

Args:
    callback (:term:`coroutine function`): The callback function that should be executed by
        the new job. Callback signature::

            async def callback(context: CallbackContext)

    job_kwargs (:obj:`dict`): Arbitrary keyword arguments. Used as arguments for
        :meth:`apscheduler.schedulers.base.BaseScheduler.add_job`.
    data (:obj:`object`, optional): Additional data needed for the callback function.
        Can be accessed through :attr:`Job.data` in the callback. Defaults to
        :obj:`None`.

        .. versionchanged:: 20.0
            Renamed the parameter ``context`` to :paramref:`data`.
    name (:obj:`str`, optional): The name of the new job. Defaults to
        :external:attr:`callback.__name__ <definition.__name__>`.
    chat_id (:obj:`int`, optional): Chat id of the chat associated with this job. If
        passed, the corresponding :attr:`~telegram.ext.CallbackContext.chat_data` will
        be available in the callback.

        .. versionadded:: 20.0

    user_id (:obj:`int`, optional): User id of the user associated with this job. If
        passed, the corresponding :attr:`~telegram.ext.CallbackContext.user_data` will
        be available in the callback.

        .. versionadded:: 20.0

Returns:
    :class:`telegram.ext.Job`: The new :class:`Job` instance that has been added to the job
    queue.

ro   )rr   rj   )rs   r   r   rt   re   ru   )	r*   rg   rm   ri   rj   rk   rl   rd   rv   s	            r+   
run_customJobQueue.run_customg  sW    X (x((8TT[\NN""4#4#4`D;T`U_`
r.   c                 x   #    U R                   R                  (       d  U R                   R                  5         gg7f)z+Starts the :class:`~telegram.ext.JobQueue`.N)r   runningstartr)   s    r+   r   JobQueue.start  s)      ~~%%NN  " &s   8:waitc                 ,  #    U(       a2  [         R                  " U R                  R                  SS06I Sh  vN   U R                  R
                  (       a8  U R                  R                  US9  [         R                  " S5      I Sh  vN   gg NX N7f)zShuts down the :class:`~telegram.ext.JobQueue`.

Args:
    wait (:obj:`bool`, optional): Whether to wait until all currently running jobs
        have finished. Defaults to :obj:`True`.

return_exceptionsTN)r   g{Gz?)asynciogatherr   _pending_futuresr   r   shutdownsleep)r*   r   s     r+   stopJobQueue.stop  s|      ..00"&   >>!!NN###. --%%%	 "	 &s"   5BBAB	B
BB)r`   .c                 V    [        S U R                  R                  5        5       5      $ )zReturns a tuple of all *scheduled* jobs that are currently in the :class:`JobQueue`.

Returns:
    tuple[:class:`Job`]: Tuple of all *scheduled* jobs.
c              3   L   #    U  H  n[         R                  U5      v   M     g 7frB   )r   from_aps_job).0rd   s     r+   	<genexpr> JobQueue.jobs.<locals>.<genexpr>  s      P6OsS%%c**6Os   "$)tupler   get_jobsr)   s    r+   jobsJobQueue.jobs  s"     Pdnn6M6M6OPPPr.   c                 J   ^ [        U4S jU R                  5        5       5      $ )zReturns a tuple of all *pending/scheduled* jobs with the given name that are currently
in the :class:`JobQueue`.

Returns:
    tuple[:class:`Job`]: Tuple of all *pending* or *scheduled* jobs matching the name.
c              3   J   >#    U  H  oR                   T:X  d  M  Uv   M     g 7frB   rj   )r   rd   rj   s     r+   r   ,JobQueue.get_jobs_by_name.<locals>.<genexpr>  s     DKS88t3CSSKs   #	#)r   r   )r*   rj   s    `r+   get_jobs_by_nameJobQueue.get_jobs_by_name  s     DDIIKDDDr.   r#   N)r#   3Application[Any, CCT, Any, Any, Any, JobQueue[CCT]])Fr0   r   r#   N)rc   zJobQueue[CCT]rd   r`   r#   N)NNNNN)NNNNNNNNNNN)T)+rs   
__module____qualname____firstlineno____doc__	__slots__r   r,   strr1   propertyr0   r   r(   rC   rE   r	   boolrK   r   rT   rU   rG   r   r^   staticmethodre   r   r   objectrS   rw   r   r   	_ALL_DAYSr   r   r   r   r   r   r   __static_attributes__r%   r.   r+   r   r   3   s   +Z ;IEM
	R# 	R K K "
 "
 "
H>** > QdQtQQ Q   E8--x/@/@(--OP    
			     E8--x/@/@(--QUUV  
(##	$	,
AP
A	
A - -6 "&"!%!%)-Rc"R E8--x/@/@(--OPR v	R
 smR #R #R X&R 
Rp _c]a!%"!%!%)-}c"} x1112} eX%7%79J9JHMMYZ[	}
 uUH$6$68I8I8==XYZ} v} sm} #} #} X&} 
}H "&"!%!%)-Lc"L mmL 	L
 vL smL #L #L X&L 
Ld !*!%"!%!%)-Rc"R mmR CHo	R
 vR smR #R #R X&R 
Rp "&"!%!%2c"2 2 v	2
 sm2 #2 #2 
2h#&t &t &.QeO, QES EU?-C Er.   c                      \ rS rSrSrSr    SS\\   S\\	   S\\
   S\\   S	\\   4
S
 jjrS\
S\	4S jrS\	S\4S jrS\4S jrS\
4S jr\SS j5       r\S\4S j5       r\S\4S j5       r\R,                  S\SS4S j5       r\S\\R.                     4S j5       r\SS j5       r    SS jr    SS jrS S jrSrg)!r   i  aB
  This class is a convenience wrapper for the jobs held in a :class:`telegram.ext.JobQueue`.
With the current backend APScheduler, :attr:`job` holds a :class:`apscheduler.job.Job`
instance.

Objects of this class are comparable in terms of equality. Two objects of this class are
considered equal, if their :class:`id <apscheduler.job.Job>` is equal.

This class is a :class:`~typing.Generic` class and accepts one type variable that specifies
the type of the argument ``context`` of :paramref:`callback`.

Important:
    If you want to use this class, you must install PTB with the optional requirement
    ``job-queue``, i.e.

    .. code-block:: bash

       pip install "python-telegram-bot[job-queue]"

Note:
    All attributes and instance methods of :attr:`job` are also directly available as
    attributes/methods of the corresponding :class:`telegram.ext.Job` object.

Warning:
    This class should not be instantiated manually.
    Use the methods of :class:`telegram.ext.JobQueue` to schedule jobs.

.. seealso:: :wiki:`Job Queue <Extensions---JobQueue>`

.. versionchanged:: 20.0

   * Removed argument and attribute ``job_queue``.
   * Renamed ``Job.context`` to :attr:`Job.data`.
   * Removed argument ``job``
   * To use this class, PTB must be installed via
     ``pip install "python-telegram-bot[job-queue]"``.

Args:
    callback (:term:`coroutine function`): The callback function that should be executed by the
        new job. Callback signature::

            async def callback(context: CallbackContext)

    data (:obj:`object`, optional): Additional data needed for the :paramref:`callback`
        function. Can be accessed through :attr:`Job.data` in the callback. Defaults to
        :obj:`None`.
    name (:obj:`str`, optional): The name of the new job. Defaults to
        :external:obj:`callback.__name__ <definition.__name__>`.
    chat_id (:obj:`int`, optional): Chat id of the chat that this job is associated with.

        .. versionadded:: 20.0
    user_id (:obj:`int`, optional): User id of the user that this job is associated with.

        .. versionadded:: 20.0
Attributes:
    callback (:term:`coroutine function`): The callback function that should be executed by the
        new job.
    data (:obj:`object`): Optional. Additional data needed for the :attr:`callback` function.
    name (:obj:`str`): Optional. The name of the new job.
    chat_id (:obj:`int`): Optional. Chat id of the chat that this job is associated with.

        .. versionadded:: 20.0
    user_id (:obj:`int`): Optional. User id of the user that this job is associated with.

        .. versionadded:: 20.0
)_enabledru   _removedrg   rk   ri   rj   rl   Nrg   ri   rj   rk   rl   c                     [         (       d  [        S5      eXl        X l        U=(       d    UR                  U l        X@l        XPl        SU l        SU l	        [        SS 5      U l        g )NzWTo use `Job`, PTB must be installed via `pip install "python-telegram-bot[job-queue]"`.FAPSJob)r&   r'   rg   ri   rs   rj   rk   rl   r   r   r   ru   )r*   rg   ri   rj   rk   rl   s         r+   r,   Job.__init__  s_     }5 
 +3&*	#'#<8+<+<	&-&-4(	r.   itemr#   c                 t     [        U R                  U5      $ ! [         a  n[        SU S35      UeSnAff = f)a  Overrides :py:meth:`object.__getattr__` to get specific attribute of the
:class:`telegram.ext.Job` object or of its attribute :class:`apscheduler.job.Job`,
if exists.

Args:
   item (:obj:`str`): The name of the attribute.

Returns:
    :object: The value of the attribute.

Raises:
    :exc:`AttributeError`: If the attribute does not exist in both
        :class:`telegram.ext.Job` and :class:`apscheduler.job.Job` objects.
zDNeither 'telegram.ext.Job' nor 'apscheduler.job.Job' has attribute ''N)getattrrd   AttributeError)r*   r   excs      r+   __getattr__Job.__getattr__1  sG    	488T** 	 VW[V\\]^	s    
727otherc                 j    [        XR                  5      (       a  U R                  UR                  :H  $ g)a   Defines equality condition for the :class:`telegram.ext.Job` object.
Two objects of this class are considered to be equal if their
:class:`id <apscheduler.job.Job>` are equal.

Returns:
    :obj:`True` if both objects have :paramref:`id` parameters identical.
    :obj:`False` otherwise.
F)r<   	__class__id)r*   r   s     r+   __eq__
Job.__eq__G  s)     e^^,,77ehh&&r.   c                 ,    [        U R                  5      $ )zBuilds a hash value for this object such that the hash of two objects is
equal if and only if the objects are equal in terms of :meth:`__eq__`.

Returns:
    :obj:`int`: The hash value of the object.
)hashr   r)   s    r+   __hash__Job.__hash__T  s     DGG}r.   c                     [        U U R                  R                  U R                  U R                  R
                  U R                  R                  S9$ )a  Give a string representation of the job in the form
``Job[id=..., name=..., callback=..., trigger=...]``.

As this class doesn't implement :meth:`object.__str__`, the default implementation
will be used, which is equivalent to :meth:`__repr__`.

Returns:
    :obj:`str`
)r   rj   rg   rp   )r   rd   r   rj   rg   rs   rp   r)   s    r+   r1   Job.__repr__]  s@     .xx{{]]++HH$$
 	
r.   c                     U R                   $ )z:class:`apscheduler.job.Job`: The APS Job this job is a wrapper for.

.. versionchanged:: 20.0
    This property is now read-only.
)ru   r)   s    r+   rd   Job.jobo  s     yyr.   c                     U R                   $ )z3:obj:`bool`: Whether this job is due to be removed.)r   r)   s    r+   removedJob.removedx       }}r.   c                     U R                   $ )z):obj:`bool`: Whether this job is enabled.)r   r)   s    r+   enabledJob.enabled}  r   r.   statusc                     U(       a  U R                   R                  5         OU R                   R                  5         Xl        g rB   )rd   resumepauser   )r*   r   s     r+   r   r     s&    HHOOHHNNr.   c                 .    U R                   R                  $ )a{  
:class:`datetime.datetime`: Datetime for the next job execution.
Datetime is localized according to :attr:`datetime.datetime.tzinfo`.
If job is removed or already ran it equals to :obj:`None`.

Warning:
    This attribute is only available, if the :class:`telegram.ext.JobQueue` this job
    belongs to is already started. Otherwise APScheduler raises an :exc:`AttributeError`.
)rd   next_run_timer)   s    r+   next_t
Job.next_t  s     xx%%%r.   c                 0    UR                   S   nXl        U$ )a]  Provides the :class:`telegram.ext.Job` that is associated with the given APScheduler
job.

Tip:
    This method can be useful when using advanced APScheduler features along with
    :class:`telegram.ext.JobQueue`.

.. versionadded:: 20.4

Args:
    aps_job (:class:`apscheduler.job.Job`): The APScheduler job

Returns:
    :class:`telegram.ext.Job`
rQ   )rr   ru   )clsaps_jobext_jobs      r+   r   Job.from_aps_job  s    " ,,q/r.   c                 j   #    [         R                  " U R                  U5      5      I Sh  vN   g N7f)aM  Executes the callback function independently of the jobs schedule. Also calls
:meth:`telegram.ext.Application.update_persistence`.

.. versionchanged:: 20.0
    Calls :meth:`telegram.ext.Application.update_persistence`.

Args:
    application (:class:`telegram.ext.Application`): The application this job is associated
        with.
N)r   shield_runr4   s     r+   rb   Job.run  s"      nnTYY{3444s   )313c           	      ,  #      UR                   R                  R                  X5      nUR                  5       I S h  vN   U R                  U5      I S h  vN   UR                  U S9  g ! [         a8  n[        R                  SU R                  US9   S nAUR                  U S9  g S nAff = f Nr N[! [         a?  nUR                  UR                  S X0S9SU R                   S3S9I S h  vN     S nANS nAff = f! UR                  U S9  f = f7f)NzEError while building CallbackContext for job %s. Job will not be run.)exc_info)rd   zJob:z:run:process_errorr   )context_typescontextfrom_job	Exception_LOGGERcriticalru   _mark_for_persistence_updaterefresh_datarg   create_taskprocess_errorr   )r*   r0   r   r   s       r+   r   Job._run  s    	?%33;;DDTW &&(((--((( 444>#    [II  ! 
  444># )( 	))))$)>DGG9$67 *   	 444>s   D%A+ B4 B0B4 B2B4 D+
B-5B(B4 D(B--B4 2B4 4
C=>/C8-C0.C83D  8C==D   DDc                 F    U R                   R                  5         SU l        g)z~
Schedules this job for removal from the :class:`JobQueue`. It will be removed without
executing its callback function again.
TN)rd   remover   r)   s    r+   schedule_removalJob.schedule_removal  s    
 	r.   r   )r#   r   )r   r   r#   r`   r   r   )rs   r   r   r   r   r   r   r   r   r   r   rS   r,   r   r   r   r   r1   r   rd   r   r   setterrC   r   classmethodr   rb   r   r
  r   r%   r.   r+   r   r     s   @D	I "&"!%!%)c") v) sm	)
 #) #)2  ,F t # 
# 
$         ^^d t   
&!2!23 
& 
&  (5P5	5 ?P?	?2r.   r   ))r   r   rC   r[   typingr   r   r   r   r   r   r	   r:   apscheduler.executors.asyncior
   apscheduler.schedulers.asyncior   r&   ImportErrortelegram._utils.loggingr   telegram._utils.reprr   telegram._utils.typesr   telegram.ext._extbotr   telegram.ext._utils.typesr   r   apscheduler.jobr   r   telegram.extr   r   ranger   rs   r  r   r%   r.   r+   <module>r     s   & 9    O O O=?M / ? * ' 61( %(O	
X*
5T
Ews| T
EnQ'#, QW  Ms   B   B+*B+