o
    óT·j@  ã                   @   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__©ÚselfÚjob_id©Ú	__class__© ú]/home/dinkstrade/pdmp-scanner/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   Ú	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   )Ú	enumerateÚnext_run_timeÚextend)r   ÚjobsÚiÚjobÚ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   r5   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   r0   r2   r3   r4   r6   r7   r8   r9   r<   r   r   r   r   r       s2    
	

	





r   )Ú	metaclass)
r   Úabcr   r   ÚKeyErrorr   r   Ú
ValueErrorr   r   r   r   r   r   Ú<module>   s    