o
    _J@h@                     @   s^   d dl Z d dlmZmZ G dd deZG dd deZG dd deZG d	d
 d
edZ	dS )    N)ABCMetaabstractmethodc                           e Zd ZdZ fddZ  ZS )JobLookupErrorzBRaised when the job store cannot find a job for update or removal.c                       t  d| d d S )NzNo job by the id of z
 was foundsuper__init__selfZjob_id	__class__ M/var/www/html/venv/lib/python3.10/site-packages/apscheduler/jobstores/base.pyr	         zJobLookupError.__init____name__
__module____qualname____doc__r	   __classcell__r   r   r   r   r          r   c                       r   )ConflictingIdErrorz8Raised when the uniqueness of job IDs is being violated.c                    r   )NzJob identifier (z ) conflicts with an existing jobr   r
   r   r   r   r	      r   zConflictingIdError.__init__r   r   r   r   r   r      r   r   c                       r   )TransientJobErrorzs
    Raised when an attempt to add transient (with no func_ref) job to a persistent job store is
    detected.
    c                    r   )NzJob (z`) cannot be added to this job store because a reference to the callable could not be determined.r   r
   r   r   r   r	      s   
zTransientJobError.__init__r   r   r   r   r   r      s    r   c                   @   s   e Zd ZdZdZdZedZdd Z	dd Z
dd	 Zed
d Zedd Zedd Zedd Zedd Zedd Zedd Zedd Zdd ZdS )BaseJobStorezSAbstract base class that defines the interface that every job store must implement.Nzapscheduler.jobstoresc                 C   s"   || _ || _td| | _dS )ax  
        Called by the scheduler when the scheduler is being started or when the job store is being
        added to an already running scheduler.

        :param apscheduler.schedulers.base.BaseScheduler scheduler: the scheduler that is starting
            this job store
        :param str|unicode alias: alias of this job store as it was assigned to the scheduler
        zapscheduler.jobstores.N)
_scheduler_aliaslogging	getLogger_logger)r   Z	scheduleraliasr   r   r   start'   s   
zBaseJobStore.startc                 C      dS )z2Frees any resources still bound to this job store.Nr   r   r   r   r   shutdown5       zBaseJobStore.shutdownc                 C   sN   t |D ] \}}|jd ur$|dkr!|d | }|d |= ||  d S qd S )Nr   )	enumerateZnext_run_timeextend)r   jobsijobZpaused_jobsr   r   r   _fix_paused_jobs_sorting8   s   


z%BaseJobStore._fix_paused_jobs_sortingc                 C   r"   )aG  
        Returns a specific job, or ``None`` if it isn't found..

        The job store is responsible for setting the ``scheduler`` and ``jobstore`` attributes of
        the returned job to point to the scheduler and itself, respectively.

        :param str|unicode job_id: identifier of the job
        :rtype: Job
        Nr   r
   r   r   r   
lookup_jobA   r%   zBaseJobStore.lookup_jobc                 C   r"   )a  
        Returns the list of jobs that have ``next_run_time`` earlier or equal to ``now``.
        The returned jobs must be sorted by next run time (ascending).

        :param datetime.datetime now: the current (timezone aware) datetime
        :rtype: list[Job]
        Nr   )r   nowr   r   r   get_due_jobsM   r%   zBaseJobStore.get_due_jobsc                 C   r"   )z
        Returns the earliest run time of all the jobs stored in this job store, or ``None`` if
        there are no active jobs.

        :rtype: datetime.datetime
        Nr   r#   r   r   r   get_next_run_timeW   r%   zBaseJobStore.get_next_run_timec                 C   r"   )a  
        Returns a list of all jobs in this job store.
        The returned jobs should be sorted by next run time (ascending).
        Paused jobs (next_run_time == None) should be sorted last.

        The job store is responsible for setting the ``scheduler`` and ``jobstore`` attributes of
        the returned jobs to point to the scheduler and itself, respectively.

        :rtype: list[Job]
        Nr   r#   r   r   r   get_all_jobs`   r%   zBaseJobStore.get_all_jobsc                 C   r"   )z
        Adds the given job to this store.

        :param Job job: the job to add
        :raises ConflictingIdError: if there is another job in this store with the same ID
        Nr   r   r*   r   r   r   add_jobm   r%   zBaseJobStore.add_jobc                 C   r"   )z
        Replaces the job in the store with the given newer version.

        :param Job job: the job to update
        :raises JobLookupError: if the job does not exist
        Nr   r1   r   r   r   
update_jobv   r%   zBaseJobStore.update_jobc                 C   r"   )z
        Removes the given job from this store.

        :param str|unicode job_id: identifier of the job
        :raises JobLookupError: if the job does not exist
        Nr   r
   r   r   r   
remove_job   r%   zBaseJobStore.remove_jobc                 C   r"   )z!Removes all jobs from this store.Nr   r#   r   r   r   remove_all_jobs   r%   zBaseJobStore.remove_all_jobsc                 C   s   d| j j dS )N<>)r   r   r#   r   r   r   __repr__   s   zBaseJobStore.__repr__)r   r   r   r   r   r   r   r   r   r!   r$   r+   r   r,   r.   r/   r0   r2   r3   r4   r5   r8   r   r   r   r   r       s2    
	

	





r   )	metaclass)
r   abcr   r   KeyErrorr   r   
ValueErrorr   r   r   r   r   r   <module>   s    