HEX
Server: LiteSpeed
System: Linux kapuas.iixcp.rumahweb.net 5.14.0-427.42.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Nov 1 14:58:02 EDT 2024 x86_64
User: mirz4654 (1666)
PHP: 8.1.33
Disabled: system,exec,escapeshellarg,escapeshellcmd,passthru,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,popen,pclose,dl,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setsid,posix_setuid,posix_setpgid,ini_alter,show_source,define_syslog_variables,symlink,syslog,openlog,openlog,closelog,ocinumcols,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dll,ftp,myshellexec,socket_bind,mail,posix_getwpuid
Upload Files
File: //usr/local/lib/python3.9/site-packages/celery/__pycache__/schedules.cpython-39.pyc
a

X>h��@s�dZddlmZddlZddlmZmZddlmZddlmZm	Z	m
Z
ddlmZm
Z
mZmZmZmZddlmZdd	lmZd
dlmZd
dlmZd
d
lmZmZmZmZmZm Z m!Z!m"Z"m#Z#dZ$edd�Z%dZ&dZ'dZ(dZ)dZ*dZ+ee,e-ee,fZ.ddd�dd�Z/Gdd�de0�Z1Gdd�d�Z2Gd d!�d!e2�Z3Gd"d#�d#�Z4Gd$d%�d%e2�Z5d0d'd(d)d*d+�d,d-�Z6Gd.d/�d/e2�Z7dS)1z;Schedules define the intervals at which periodic tasks run.�)�annotationsN)�bisect�bisect_left)�
namedtuple)�datetime�	timedelta�tzinfo)�Any�Callable�Iterable�Mapping�Sequence�Union)�cached_property)�Celery�)�current_app)�
AttributeDict)	�ffwd�humanize_seconds�localize�maybe_make_aware�maybe_timedelta�	remaining�timezone�weekday�	yearmonth)�ParseException�schedule�crontab�crontab_parser�maybe_schedule�solar�
schedstate��is_due�nextzJInvalid crontab pattern.  Valid range is {min}-{max}. '{value}' was found.zoArgument cronspec needs to be of any of the following types: int, str, or an iterable type. {type!r} was given.z}<crontab: {0._orig_minute} {0._orig_hour} {0._orig_day_of_month} {0._orig_month_of_year} {0._orig_day_of_week} (m/h/dM/MY/d)>z?Argument latitude {lat} is invalid, must be between -90 and 90.zBArgument longitude {lon} is invalid, must be between -180 and 180.zAArgument event "{event}" is invalid, must be one of {all_events}.zCronspec | None�Cronspec��s�returncCs|durdS|S)N�*�)r)r,r,�:/usr/local/lib/python3.9/site-packages/celery/schedules.py�	cronfield9sr.c@seZdZdZdS)rzARaised by :class:`crontab_parser` when the input can't be parsed.N)�__name__�
__module__�__qualname__�__doc__r,r,r,r-r=src@s�eZdZd)ddd�dd�Zdd�d	d
�Zddd�d
d�Zddd�dd�Zd*dddd�dd�Zedd�dd��Z	e	j
ddd�dd��Z	edd�dd��Zedd�d d!��Z
ddd"�d#d$�Zd%dd&�d'd(�ZdS)+�BaseScheduleN�Callable | None�
Celery | None��nowfun�appcCs||_||_dS�N)r7�_app)�selfr7r8r,r,r-�__init__CszBaseSchedule.__init__r�r*cCs|jp|jj�Sr9)r7r8�now�r;r,r,r-r>GszBaseSchedule.nowr��last_run_atr*cCs
t��dSr9��NotImplementedError�r;rAr,r,r-�remaining_estimateJszBaseSchedule.remaining_estimate�tuple[bool, datetime]cCs
t��dSr9rBrDr,r,r-r%MszBaseSchedule.is_dueT�bool)�dt�naive_as_utcr*cCst||j|d�S)N�rI)r�tz)r;rHrIr,r,r-rPszBaseSchedule.maybe_make_awarercCs|jpt��Sr9)r:rZ_get_current_objectr?r,r,r-r8TszBaseSchedule.app�None)r8r*cCs
||_dSr9)r:)r;r8r,r,r-r8XsrcCs|jjSr9)r8rr?r,r,r-rK\szBaseSchedule.tzcCs
|jjjSr9)r8�confZ
enable_utcr?r,r,r-�utc_enabled`szBaseSchedule.utc_enabled)rHr*cCs|jst�|�S|Sr9)rNrZto_local_fallback)r;rHr,r,r-�to_localds
zBaseSchedule.to_localr	��otherr*cCst|t�r|j|jkStSr9)�
isinstancer3r7�NotImplemented�r;rQr,r,r-�__eq__is
zBaseSchedule.__eq__)NN)T)r/r0r1r<r>rEr%r�propertyr8�setterrrKrNrOrUr,r,r,r-r3As �r3cs�eZdZUdZdZded<d%ddddd	d
��fdd�
Zd
dd�dd�Zd
dd�dd�Zdd�dd�Z	ddd�dd�Z
dd�dd�Zed d�d!d"��Z
edd�d#d$��Z�ZS)&ra�Schedule for periodic task.

    Arguments:
        run_every (float, ~datetime.timedelta): Time interval.
        relative (bool):  If set to True the run time will be rounded to the
            resolution of the interval.
        nowfun (Callable): Function returning the current date and time
            (:class:`~datetime.datetime`).
        app (Celery): Celery app instance.
    FrG�relativeNzfloat | timedelta | Noner4r5rL)�	run_everyrXr7r8r*cs$t|�|_||_t�j||d�dS)Nr6)rrYrX�superr<)r;rYrXr7r8��	__class__r,r-r<}s
zschedule.__init__rrr@cCs"t|�|�|j|�|���|j�Sr9)rrrYr>rXrDr,r,r-rE�s�zschedule.remaining_estimaterFcCsD|�|�}|�|�}t|��d�}|dkr8td|jd�Std|d�S)aGReturn tuple of ``(is_due, next_time_to_check)``.

        Notes:
            - next time to check is in seconds.

            - ``(True, 20)``, means the task should be run now, and the next
                time to check is in 20 seconds.

            - ``(False, 12.3)``, means the task is not due, but that the
              scheduler should check again in 12.3 seconds.

        The next time to check is used to save energy/CPU cycles,
        it does not need to be accurate but will influence the precision
        of your schedule.  You must also keep in mind
        the value of :setting:`beat_max_loop_interval`,
        that decides the maximum number of seconds the scheduler can
        sleep between re-checking the periodic task intervals.  So if you
        have a task that changes schedule at run-time then your next_run_at
        check will decide how long it will take before a change to the
        schedule takes effect.  The max loop interval takes precedence
        over the next check at value returned.

        .. admonition:: Scheduler max interval variance

            The default max loop interval may vary for different schedulers.
            For the default scheduler the value is 5 minutes, but for example
            the :pypi:`django-celery-beat` database scheduler the value
            is 5 seconds.
        rTr$F)rrE�max�
total_secondsr#�seconds)r;rA�	rem_deltaZremaining_sr,r,r-r%�s

zschedule.is_due�strr=cCsd|j�d�S)Nz<freq: �>)�
human_secondsr?r,r,r-�__repr__�szschedule.__repr__r	rPcCs t|t�r|j|jkS|j|kSr9)rRrrYrTr,r,r-rU�s
zschedule.__eq__z4tuple[type, tuple[timedelta, bool, Callable | None]]cCs|j|j|j|jffSr9)r\rYrXr7r?r,r,r-�
__reduce__�szschedule.__reduce__�int | floatcCst|j��d�S)Nr)r]rYr^r?r,r,r-r_�szschedule.secondscCs
t|j�Sr9)rr_r?r,r,r-rc�szschedule.human_seconds)NFNN)r/r0r1r2rX�__annotations__r<rEr%rdrUrerVr_rc�
__classcell__r,r,r[r-ros
�%rc@s�eZdZdZeZdZdZdZd$ddd�d	d
�Zddd
�dd�Z	ddd�dd�Z
ddd�dd�Zddd�dd�Zddd�dd�Z
ddd�dd�Zddd �d!d"�Zd#S)%r a�Parser for Crontab expressions.

    Any expression of the form 'groups'
    (see BNF grammar below) is accepted and expanded to a set of numbers.
    These numbers represent the units of time that the Crontab needs to
    run on:

    .. code-block:: bnf

        digit   :: '0'..'9'
        dow     :: 'a'..'z'
        number  :: digit+ | dow+
        steps   :: number
        range   :: number ( '-' number ) ?
        numspec :: '*' | range
        expr    :: numspec ( '/' steps ) ?
        groups  :: expr ( ',' expr ) *

    The parser is a general purpose one, useful for parsing hours, minutes and
    day of week expressions.  Example usage:

    .. code-block:: pycon

        >>> minutes = crontab_parser(60).parse('*/15')
        [0, 15, 30, 45]
        >>> hours = crontab_parser(24).parse('*/4')
        [0, 4, 8, 12, 16, 20]
        >>> day_of_week = crontab_parser(7).parse('*')
        [0, 1, 2, 3, 4, 5, 6]

    It can also parse day of month and month of year expressions if initialized
    with a minimum of 1.  Example usage:

    .. code-block:: pycon

        >>> days_of_month = crontab_parser(31, 1).parse('*/3')
        [1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31]
        >>> months_of_year = crontab_parser(12, 1).parse('*/2')
        [1, 3, 5, 7, 9, 11]
        >>> months_of_year = crontab_parser(12, 1).parse('2-12/2')
        [2, 4, 6, 8, 10, 12]

    The maximum possible expanded value returned is found by the formula:

        :math:`max_ + min_ - 1`
    z(\w+?)-(\w+)z/(\w+)?z\*�<r�int)�max_�min_cCsj||_||_t�|j|j�|jft�|j�|jft�|j|j�|j	ft�d|jd�|j
ff|_dS)N�^�$)rkrl�re�compile�_range�_steps�_range_steps�
_expand_range�_star�_star_steps�_expand_star�pats)r;rkrlr,r,r-r<�s�zcrontab_parser.__init__razset[int])�specr*cCs:t�}|�d�D]$}|s"|�d��|t|�|��O}q|S)N�,z
empty part)�set�splitr�_parse_part)r;ry�acc�partr,r,r-�parses
zcrontab_parser.parsez	list[int])rr*cCs:|jD]&\}}|�|�}|r||���Sq|�|f�Sr9)rx�match�groupsrt)r;r�regex�handler�mr,r,r-r}s

zcrontab_parser._parse_partz
Sequence[str])�toksr*cCsr|�|d�}t|�dkrl|�|d�}||krZtt||j|j��tt|j|d��Stt||d��S|gS)Nrr)�_expand_number�len�list�rangerlrk)r;r��fr�tor,r,r-rts�zcrontab_parser._expand_rangecCsBt|�dks|ds|�d��|�|dd��ddt|d��S)N���empty filter)r�rrtrj�r;r�r,r,r-rss
zcrontab_parser._range_stepscCs0|r|ds|�d��|��ddt|d��S)Nrr�)rrwrjr�r,r,r-rv"s
zcrontab_parser._star_stepsr	)�argsr*cGstt|j|j|j��Sr9)r�r�rlrk)r;r�r,r,r-rw'szcrontab_parser._expand_starr(cCs�t|t�r |ddkr |�d��zt|�}Wnbty�zt|�}WnBty�zt|�}Wn"ty�td|�d���Yn0Yn0Yn0|j|j	d}||kr�td|�d|�d���||jkr�td	|�d
|j�d���|S)Nr�-znegative numbers not supportedzInvalid weekday literal �.rzInvalid end range: z > zInvalid beginning range: z < )
rRrarrj�
ValueErrorr�KeyErrorrrlrk)r;r)�iZmax_valr,r,r-r�*s,
"�
�zcrontab_parser._expand_numberN)rir)r/r0r1r2rrqrrrur<r�r}rtrsrvrwr�r,r,r,r-r �s/

r c	s�eZdZdZd5dddddddd��fdd�
Zed	dd
�dd��Zed6ddddd�dd��Zddddd�dd�Z	d	d�dd�Z
dd�dd�Zddd��fd d!�Zd"e
fdd#d$d%d&�d'd(�Ze
fdd$d)d*�d+d,�Zdd-d.�d/d0�Zdd1d2��fd3d4�Z�ZS)7ra�Crontab schedule.

    A Crontab can be used as the ``run_every`` value of a
    periodic task entry to add :manpage:`crontab(5)`-like scheduling.

    Like a :manpage:`cron(5)`-job, you can specify units of time of when
    you'd like the task to execute.  It's a reasonably complete
    implementation of :command:`cron`'s features, so it should provide a fair
    degree of scheduling needs.

    You can specify a minute, an hour, a day of the week, a day of the
    month, and/or a month in the year in any of the following formats:

    .. attribute:: minute

        - A (list of) integers from 0-59 that represent the minutes of
          an hour of when execution should occur; or
        - A string representing a Crontab pattern.  This may get pretty
          advanced, like ``minute='*/15'`` (for every quarter) or
          ``minute='1,13,30-45,50-59/2'``.

    .. attribute:: hour

        - A (list of) integers from 0-23 that represent the hours of
          a day of when execution should occur; or
        - A string representing a Crontab pattern.  This may get pretty
          advanced, like ``hour='*/3'`` (for every three hours) or
          ``hour='0,8-17/2'`` (at midnight, and every two hours during
          office hours).

    .. attribute:: day_of_week

        - A (list of) integers from 0-6, where Sunday = 0 and Saturday =
          6, that represent the days of a week that execution should
          occur.
        - A string representing a Crontab pattern.  This may get pretty
          advanced, like ``day_of_week='mon-fri'`` (for weekdays only).
          (Beware that ``day_of_week='*/2'`` does not literally mean
          'every two days', but 'every day that is divisible by two'!)

    .. attribute:: day_of_month

        - A (list of) integers from 1-31 that represents the days of the
          month that execution should occur.
        - A string representing a Crontab pattern.  This may get pretty
          advanced, such as ``day_of_month='2-30/2'`` (for every even
          numbered day) or ``day_of_month='1-7,15-21'`` (for the first and
          third weeks of the month).

    .. attribute:: month_of_year

        - A (list of) integers from 1-12 that represents the months of
          the year during which execution can occur.
        - A string representing a Crontab pattern.  This may get pretty
          advanced, such as ``month_of_year='*/3'`` (for the first month
          of every quarter) or ``month_of_year='2-12/2'`` (for every even
          numbered month).

    .. attribute:: nowfun

        Function returning the current date and time
        (:class:`~datetime.datetime`).

    .. attribute:: app

        The Celery app instance.

    It's important to realize that any day on which execution should
    occur must be represented by entries in all three of the day and
    month attributes.  For example, if ``day_of_week`` is 0 and
    ``day_of_month`` is every seventh day, only months that begin
    on Sunday and are also in the ``month_of_year`` attribute will have
    execution events.  Or, ``day_of_week`` is 1 and ``day_of_month``
    is '1-7,15-21' means every first and third Monday of every month
    present in ``month_of_year``.
    r+r'r	rL)�minute�hour�day_of_week�day_of_month�
month_of_year�kwargsr*cs�t|�|_t|�|_t|�|_t|�|_t|�|_||_|�|d�|_|�|d�|_	|�|d�|_
|�|dd�|_|�|dd�|_t
�jfi|��dS)N�ri��r�)r.�_orig_minute�
_orig_hour�_orig_day_of_week�_orig_day_of_month�_orig_month_of_year�_orig_kwargs�_expand_cronspecr�r�r�r�r�rZr<)r;r�r�r�r�r�r�r[r,r-r<�s




zcrontab.__init__ra)rr*cCs$|�d�\}}}}}||||||�S)uW
        Create a Crontab from a cron expression string. For example ``crontab.from_string('* * * * *')``.

        .. code-block:: text

            ┌───────────── minute (0–59)
            │ ┌───────────── hour (0–23)
            │ │ ┌───────────── day of the month (1–31)
            │ │ │ ┌───────────── month (1–12)
            │ │ │ │ ┌───────────── day of the week (0–6) (Sunday to Saturday)
            * * * * *
        � )r|)�clsrr�r�r�r�r�r,r,r-�from_string�szcrontab.from_stringrrjzset[Any])�cronspecrkrlr*cCs�t|t�r|h}nTt|t�r.t||��|�}n8t|t�r>|}n(t|t�rRt|�}nttj	t
|�d���|D]4}|||ks�||krjttj	||d||d���qj|S)aExpand cron specification.

        Takes the given cronspec argument in one of the forms:

        .. code-block:: text

            int         (like 7)
            str         (like '3-5,*/15', '*', or 'monday')
            set         (like {0,15,30,45}
            list        (like [8-17])

        And convert it to an (expanded) set representing all time unit
        values on which the Crontab triggers.  Only in case of the base
        type being :class:`str`, parsing occurs.  (It's fast and
        happens only once for each Crontab instance, so there's no
        significant performance overhead involved.)

        For the other base types, merely Python type conversions happen.

        The argument ``max_`` is needed to determine the expansion of
        ``*`` and ranges.  The argument ``min_`` is needed to determine
        the expansion of ``*`` and ranges for 1-based cronspecs, such as
        day of month or month of year.  The default is sufficient for minute,
        hour, and day of week.
        )�typer)�minr]�value)
rRrjrar r�r{r�	TypeError�CRON_INVALID_TYPE�formatr�r��CRON_PATTERN_INVALID)r�rkrl�result�numberr,r,r-r��s




�
zcrontab._expand_cronspecrr)rA�	next_hour�next_minuter*c	s0t�jd��t�j��t�j��ddddd�dd��ddddd�����fdd��d	d
������fdd�}�j�jvr�t��j��_t	��j��_
n(d
�_t��j��_
�j
t��kr�d
�_
|�t�j��j
��jd�}|�
�d�jvr��q�jd7_|�q�t�j��j
��j��d
d
d�S)aZFind next delta.

        Takes a :class:`~datetime.datetime` of last run, next minute and hour,
        and returns a :class:`~celery.utils.time.ffwd` for the next
        scheduled day and time.

        Only called when ``day_of_month`` and/or ``month_of_year``
        cronspec is specified to further limit scheduled task execution.
        )�yearrjrG)r��month�dayr*cSs,zt|||d�Wnty&YdS0dS)N�r�r�r�TF)rr�r�r,r,r-�day_out_of_range�s
z0crontab._delta_to_next.<locals>.day_out_of_rangecs�jt|||���dd��kS)NFrJ)rrr�)rAr�r�r;r,r-�is_before_last_run�s��z2crontab._delta_to_next.<locals>.is_before_last_runrLr=cs�td�D]�}�jt��kpL��j��j��j�pL��j��j��j�}|r�d�_�jd7_�jt��kr�d�_�jd7_qq�qtd��dS)Ni�rrz:unable to rollover, time specification is probably invalid)r��domr�r��moy�RuntimeError)�_�flag)�datedatar��
days_of_monthr��months_of_yearr,r-�	roll_over�s(����z)crontab._delta_to_next.<locals>.roll_overrr�r�r)r�r�r�r�r��second�microsecond)rr��sortedr�r�r�rr�r�rr�r�r�
isoweekdayr�r)r;rAr�r�r��thr,)	r�r�r�r�rAr�r�r�r;r-�_delta_to_next�s<

��zcrontab._delta_to_nextr=cCs
t�|�Sr9)�	CRON_REPRr�r?r,r,r-rd-szcrontab.__repr__zItuple[type, tuple[Cronspec, Cronspec, Cronspec, Cronspec, Cronspec], Any]cCs"|j|j|j|j|j|jf|jfSr9)r\r�r�r�r�r�r�r?r,r,r-re0s��zcrontab.__reduce__zMapping[str, Any])�stater*cst�jfi|��dSr9)rZr<)r;r�r[r,r-�__setstate__7szcrontab.__setstate__Nz
tzinfo | Noner�ztuple[datetime, Any, datetime])rArKrr*cs�|����|�|���}���d��j|jvoD�j|jvoD�|jv}|o��j|jko��j|jko��j|jko��j	|j	vo��j
t|j
�k}|r�t�fdd�|j
D��}||ddd�}n�t|j
�}|o҈j	t|j	�k}	|	�rt�fdd�|j	D��}
||
|ddd�}n�t|j	�}
|j
dk�o"|jdk}|�r|t�fd	d
�|jD��pF|j�}|�k}
||
�r`d�pbd|dd|
|ddd�}n|��|
|�}|���||�|�fS)
Nr�c3s|]}|�jkr|VqdSr9)r�)�.0r��rAr,r-�	<genexpr>Ss
�z*crontab.remaining_delta.<locals>.<genexpr>r)r�r�r�c3s|]}|�jkr|VqdSr9)r�)r�r�r�r,r-r�\s
�)r�r�r�r�r+csg|]}|�kr|�qSr,r,)r�r�)�dow_numr,r-�
<listcomp>es�z+crontab.remaining_delta.<locals>.<listcomp>r)�weeksrr�r�r�r�)rr>r�r�r�r�r�r�r�r�r�r]r�r�r�r�rO)r;rArKrr>Zexecute_this_dateZexecute_this_hourr��deltaZ
execute_todayr�Zall_dom_moyZnext_dayZadd_weekr,)r�rAr-�remaining_delta<sh

��
�
�
�
��	
��
��
�	�zcrontab.remaining_deltar)rArr*cCst|j||d��S)z�Estimate of next run time.

        Returns when the periodic task should run next as a
        :class:`~datetime.timedelta`.
        )r)rr�)r;rArr,r,r-rEvs	zcrontab.remaining_estimaterFr@c
Cs�|�|�}|��}t|d�}|dk}|jjj}d}|dur�|}|}	|dkrv|t|�}|�|�}|��}|dkrB|}	qB|	|k}|r�d}|s�|r�|�|���}t|��d�}t||�S)a�Return tuple of ``(is_due, next_time_to_run)``.

        If :setting:`beat_cron_starting_deadline`  has been specified, the
        scheduler will make sure that the `last_run_at` time is within the
        deadline. This prevents tasks that could have been run according to
        the crontab, but didn't, from running again unexpectedly.

        Note:
            Next time to run is in seconds.

        SeeAlso:
            :meth:`celery.schedules.schedule.is_due` for more information.
        rFN)	rEr^r]r8rMZbeat_cron_starting_deadline�absr>r#)
r;rAr`Zrem_secs�rem�dueZ
deadline_secsZhas_passed_deadlineZlast_date_checkedZlast_feasible_rem_secsr,r,r-r%�s,




zcrontab.is_duerGrPcsVt|t�rR|j|jkoP|j|jkoP|j|jkoP|j|jkoP|j|jkoPt��|�St	Sr9)
rRrr�r�r�r�r�rZrUrSrTr[r,r-rU�s

�
�
�
�
�zcrontab.__eq__)r+r+r+r+r+)r)r/r0r1r2r<�classmethodr��staticmethodr�r�rdrer�rr�rEr%rUrhr,r,r[r-rCs(M� �.M�;�1rFz&int | float | timedelta | BaseSchedulerGr5z float | timedelta | BaseSchedule)r)rXr8r*cCsB|dur>t|ttf�r t|d�}t|t�r8t|||d�S||_|S)z;Return schedule from number, timedelta, or actual schedule.N)r_)r8)rR�floatrjrrr8)r)rXr8r,r,r-r!�s

r!c
s�eZdZdZhd�Zdddddddddd	�	Zd
d
d
d
dddddd	�	Zd
d
d
dddd
d
d
d	�	Zdddddd��fdd�Zdd�dd�Z	dd�dd�Z
ddd�dd �Zdd!d�d"d#�Zdd$d%�d&d'�Z
�ZS)(r"aSSolar event.

    A solar event can be used as the ``run_every`` value of a
    periodic task entry to schedule based on certain solar events.

    Notes:

        Available event values are:

            - ``dawn_astronomical``
            - ``dawn_nautical``
            - ``dawn_civil``
            - ``sunrise``
            - ``solar_noon``
            - ``sunset``
            - ``dusk_civil``
            - ``dusk_nautical``
            - ``dusk_astronomical``

    Arguments:
        event (str): Solar event that triggers this task.
            See note for available values.
        lat (float): The latitude of the observer.
        lon (float): The longitude of the observer.
        nowfun (Callable): Function returning the current date and time
            as a class:`~datetime.datetime`.
        app (Celery): Celery app instance.
    >	�
solar_noon�
dawn_nautical�sunset�sunrise�
dawn_civil�dawn_astronomical�
dusk_nautical�
dusk_civil�dusk_astronomicalz-18z-12z-6z-0:34�0Z18)	r�r�r�r�r�r�r�r�r�Znext_risingZnext_transitZnext_settingTFrarfr	rL)�event�lat�lonr�r*cs�td�|_||_||_||_t�jfi|��||jvrVtt	j
|d�t|j��d���|dksf|dkrvtt
j
|d���|dks�|dkr�ttj
|d	���|j��}t|�|_t|�|_d
|_|j||_d
|_||_|j||_|j||_dS)N�ephemz, )r�Z
all_eventsi�����Z)r�iL����)r�r)�
__import__r�r�r�r�rZr<�_all_eventsr��SOLAR_INVALID_EVENTr��joinr��SOLAR_INVALID_LATITUDE�SOLAR_INVALID_LONGITUDEZObserverraZelev�	_horizonsZhorizonZpressure�cal�_methods�method�
_use_center_l�
use_center)r;r�r�r�r�r�r[r,r-r<s,

�


zsolar.__init__z1tuple[type, tuple[str, int | float, int | float]]r=cCs|j|j|j|jffSr9)r\r�r�r�r?r,r,r-re4szsolar.__reduce__cCsd�|j|j|j�S)Nz)<solar: {} at latitude {}, longitude: {}>)r�r�r�r�r?r,r,r-rd7s�zsolar.__repr__rrr@cCs�|�|�}t|tj�}||j_zH|jrHt|j|j�|j	�
�||jd�}nt|j|j�|j	�
�|d�}Wn2|j	jy�|j�|j	�
��t
dd�}Yn0|�|���}|�|���}||}|S)a2Return estimate of next time to run.

        Returns:
            ~datetime.timedelta: when the periodic task should
                run next, or if it shouldn't run today (e.g., the sun does
                not rise today), returns the time when the next check
                should take place.
        )�startr�)r�r)�minutes)rrr�utcr��dater��getattrr�r��SunZCircumpolarErrorZnext_antitransitrrr>)r;rAZlast_run_at_utcZnext_utcr&r>r�r,r,r-rE<s*	
�
�
��zsolar.remaining_estimaterFcCsJ|�|�}t|��d�}|dk}|r@|�|���}t|��d�}t||�S)z�Return tuple of ``(is_due, next_time_to_run)``.

        Note:
            next time to run is in seconds.

        See Also:
            :meth:`celery.schedules.schedule.is_due` for more information.
        r)rEr]r^r>r#)r;rAr`r�r�r,r,r-r%_s	
zsolar.is_duerGrPcCs2t|t�r.|j|jko,|j|jko,|j|jkStSr9)rRr"r�r�r�rSrTr,r,r-rUps

�
�zsolar.__eq__)r/r0r1r2r�r�r�r�r<rerdrEr%rUrhr,r,r[r-r"�sL���#r")FN)8r2�
__future__rrorr�collectionsrrrr�typingr	r
rrr
rZkombu.utils.objectsrZceleryr�rZutils.collectionsrZ
utils.timerrrrrrrrr�__all__r#r�r�r�r�r�r�rjrar'r.�	Exceptionrr3rr rr!r"r,r,r,r-�<module>sB ,
.U�