HEX
Server: Apache/2.4.65 (Debian)
System: Linux kubikelcreative 5.10.0-35-amd64 #1 SMP Debian 5.10.237-1 (2025-05-19) x86_64
User: www-data (33)
PHP: 8.4.13
Disabled: NONE
Upload Files
File: //proc/276314/root/usr/lib/python3/dist-packages/parsedatetime/__pycache__/context.cpython-39.pyc
a

�<�^,�@s4dZddlmZGdd�de�ZGdd�de�ZdS)z4
parsedatetime/context.py

Context related classes

�)�localc@sDeZdZdZdd�Zedd��Zdd�Zdd	�Zd
d�Z	dd
�Z
dS)�pdtContextStackz\
    A thread-safe stack to store context(s)

    Internally used by L{Calendar} object
    cCst�|_dS�N)r�_pdtContextStack__local��self�r�7/usr/lib/python3/dist-packages/parsedatetime/context.py�__init__szpdtContextStack.__init__cCst|jd�sg|j_|jjS)N�stack)�hasattrrrrrrr	Z__stackszpdtContextStack.__stackcCs|j�|�dSr)�_pdtContextStack__stack�append�r�ctxrrr	�pushszpdtContextStack.pushcCs&z|j��WSty YdS0dSr)r
�pop�
IndexErrorrrrr	rszpdtContextStack.popcCs,z|jdWSty&td��Yn0dS)N���zcontext stack is empty)r
r�RuntimeErrorrrrr	�last%szpdtContextStack.lastcCs|jSr)r
rrrr	�isEmpty+szpdtContextStack.isEmptyN)�__name__�
__module__�__qualname__�__doc__r
�propertyr
rrrrrrrr	rs
rc@s*eZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
eeBeBeBZe	e
BeBeBe
BZedfed
fedfedfe	dfe
dfedfedfe
dfg	Zeeeeeeeee	e	e	e	e	e	e	e
e
eeeeeeeee
d�Zd*dd�Zdd�Zdd�Zedd��Zedd ��Zed!d"��Zed#d$��Zd%d&�Zd'd(�Zd)S)+�
pdtContexta�
    Context contains accuracy flag detected by L{Calendar.parse()}

    Accuracy flag uses bitwise-OR operation and is combined by:

        ACU_YEAR - "next year", "2014"
        ACU_MONTH - "March", "July 2014"
        ACU_WEEK - "last week", "next 3 weeks"
        ACU_DAY - "tomorrow", "July 4th 2014"
        ACU_HALFDAY - "morning", "tonight"
        ACU_HOUR - "18:00", "next hour"
        ACU_MIN - "18:32", "next 10 minutes"
        ACU_SEC - "18:32:55"
        ACU_NOW - "now"

    ��accuracy������ �@���year�month�week�day�halfday�hour�min�sec�now)r)Zyearsr*Zmonthsr+Zweeksr,Zdaysr-ZmorningZ	afternoonZeveningZnightZtonightZmidnightr.Zhoursr/ZminuteZminsZminutesr0�secondZsecsZsecondsr1rcCs
||_dS)z�
        Default constructor of L{pdtContext} class.

        @type  accuracy: integer
        @param accuracy: Accuracy flag

        @rtype:  object
        @return: L{pdtContext} instance
        Nr)rrrrr	r
ws
zpdtContext.__init__cGs0|D]&}t|t�s|j|}|j|O_qdS)z/
        Updates current accuracy flag
        N)�
isinstance�int�_ACCURACY_REVERSE_MAPPINGr)rr�accrrr	�updateAccuracy�s

zpdtContext.updateAccuracycCs|�|j�dS)zK
        Uses another L{pdtContext} instance to update current one
        N)r7r)r�contextrrr	�update�szpdtContext.updatecCst|j|j@�S)zE
        Returns True if current context is accurate to date
        )�boolr�ACU_DATErrrr	�hasDate�szpdtContext.hasDatecCst|j|j@�S)zE
        Returns True if current context is accurate to time
        )r:r�ACU_TIMErrrr	�hasTime�szpdtContext.hasTimecCst|jo
d�t|jod�BS)z5
        Returns the old date/time flag code
        r r!)r4r<r>rrrr	�dateTimeFlag�szpdtContext.dateTimeFlagcCs
t|j�S)zJ
        Returns True if current context is accurate to date/time
        )r:rrrrr	�
hasDateOrTime�szpdtContext.hasDateOrTimecCsPg}|jD]$\}}||j@r
|�d|���q
|rDdd�|�}nd}d|S)NzpdtContext.ACU_%sz	accuracy=z | �zpdtContext(%s))�_ACCURACY_MAPPINGrr�upper�join)rZ
accuracy_reprr6�namerrr	�__repr__�s
zpdtContext.__repr__cCs|j|jkSrrrrrr	�__eq__�szpdtContext.__eq__N)r)rrrr�	__slots__ZACU_YEARZ	ACU_MONTHZACU_WEEKZACU_DAYZACU_HALFDAYZACU_HOURZACU_MINZACU_SECZACU_NOWr;r=rBr5r
r7r9rr<r>r?r@rFrGrrrr	r/s~��
	



rN)rZ	threadingr�objectrrrrrr	�<module>s#