https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/trac/notification/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/trac/notification/__pycache__/model.cpython-310.pyc
o

�k�`8�@s@ddlmZmZmZddgZGdd�de�ZGdd�de�ZdS)�)�datetime_now�utc�
to_utimestamp�Subscription�Watchc@s�eZdZdZdZdd�Zdd�Zdd�Zd	d
�Zdd�Z	e
d
d��Ze
d$dd��Ze
d$dd��Z
e
dd��Ze
dd��Ze
d%dd��Ze
dd��Ze
dd��Ze
dd��Zd d!�Zd"d#�ZdS)&r��env�values)�id�sid�
authenticated�distributor�format�priority�adverb�classcC�||_i|_dS�Nr��selfr�r�9/usr/lib/python3/dist-packages/trac/notification/model.py�__init__�
zSubscription.__init__cs*d��fdd��jD��}d�jj|fS)N� c3s$�|]
}d|�j�|�fVqdS)z%s=%rN)r	�get��.0�name�rrr�	<genexpr> s��z(Subscription.__repr__.<locals>.<genexpr>z<%s %s>)�join�fields�	__class__�__name__)rr	rrr�__repr__s�zSubscription.__repr__cC�||jvr	t|��|j�|�Sr�r"�KeyErrorr	r�rrrrr�__getitem__$�
zSubscription.__getitem__cC� ||jvr	t|��||j|<dSr�r"r(r	�rr�valuerrr�__setitem__)�
zSubscription.__setitem__c		CsP||d<||d<t|�|d<||d<|pd|d<t|�|d<||d<||d<dS)	Nr
rrr
rrrr��int)	rr
rrr
rrr�class_rrr�_from_database.szSubscription._from_databasecCs�|j�K}t|�||d|d|d��d}ttt��}|��}|�d|||dt|d�|d|dp5dt|�|d|d	f	�|�	|d
�Wd�S1sQwYdS)zid and priority overwritten.rrr
�a
                INSERT INTO
                notify_subscription (time, changetime, sid, authenticated,
                                     distributor, format, priority, adverb,
                                     class)
                VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)rNrr�notify_subscription)
�db_transaction�len�find_by_sid_and_distributorrrr�cursor�executer3�get_last_id)�clsr�subscription�dbr�nowr;rrr�add9s$����

$�zSubscription.addNc
s�|j�e}d|i}|dus|dur||d<|rdnd|d<|j|fi|��D]}n		Wd�dS|d|df�|�||d|d|d�}ttt����fdd	�t|d�D�}	|�d
|	�Wd�dS1skwYdS)Nr
rr6rrz+DELETE FROM notify_subscription WHERE id=%sr
c�*g|]\}}||dkr|�|df�qS�rr
r�r�new_priority�sub�rArr�
<listcomp>]�
�z'Subscription.delete.<locals>.<listcomp>�w
                UPDATE notify_subscription
                SET priority=%s, changetime=%s WHERE id=%s
                )r8�_findr:rrr�	enumerate�executemany)
r>r�rule_idrrr@�kwargsrG�subsr	rrHr�deleteNs*�	�
��"�zSubscription.deletecsJ|j��}d|i}|dus|dur||d<|rdnd|d<|j|fi|��D]}n		Wd�dS|�||d|d|d�}	d|krLt|	�ksVn	Wd�dSt|	�D]\}
}|d|krfn
qZ	Wd�dS|	�|d|	�|
��ttt	����fdd�t|	d�D�}|�
d	|�Wd�dS1s�wYdS)
Nr
rr6rrr
crCrDrrErHrrrI{rJz%Subscription.move.<locals>.<listcomp>rK)r8rLr:r9rM�insert�poprrrrN)r>rrOrrrr@rPrGrQ�idxr	rrHr�movees<�	��
��
��"�zSubscription.movecCs�t|�}|j��}i}|d||f�D]\}}}	|�||	fg��|�q|��D]}
|
jdd�q&i}ttt��}|D]X}
|
d}|�|d�||d7<||}||
df}|�	|�ry||�
�}|d||
d|
d	pmd||
d
|
d|f�q9|d|||||
d|
d	p�d||
d
|
df	�q9g}|��D]}
|�|
�q�|r�|dd
�dt
|��|�Wd�dSWd�dS1s�wYdS)Nz�                    SELECT id, distributor, class FROM notify_subscription
                    WHERE sid=%s AND authenticated=%sT)�reverser
rr6rz�                        UPDATE notify_subscription
                        SET changetime=%s,distributor=%s,format=%s,priority=%s,
                            adverb=%s,class=%s
                        WHERE id=%srrz�                        INSERT INTO notify_subscription (
                            time,changetime,sid,authenticated,distributor,
                            format,priority,adverb,class)
                        VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s)z0DELETE FROM notify_subscription WHERE id IN (%s)�,)z%s)r3r8�
setdefault�appendr	�sortrrrrrT�extendr!r9)r>rrr�
subscriptionsr@�ids_map�id_r
r4�ids�
prioritiesrArG�prio�key�
delete_idsrrr�replace_all�sT�
����	���("�zSubscription.replace_allcCsF|j�}|d|p	d||t|�f�Wd�dS1swYdS)Nz�
                UPDATE notify_subscription
                   SET format=%s
                 WHERE distributor=%s
                   AND sid=%s
                   AND authenticated=%s
            �r8r3)r>rr
rrrr@rrr�$update_format_by_distributor_and_sid�s
�"�z1Subscription.update_format_by_distributor_and_sidc+s�|j�~�g}g}t|���D]&\}}|�d�r|dd�}|dkr&t|�}|���|�d�|�|�qd}|rC|dd�|�7}|r_t|t	t
f�sO|f}|dd	��fd
d�|D��7}���}	|	�||�|	D]}
t
|�}|j|
�|VqkWd�dS1s�wYdS)N�_���r�=%szdSELECT id, sid, authenticated, distributor, format, priority, adverb, class FROM notify_subscription� WHERE � AND �
 ORDER BY �, c3��|]}��|�VqdSr��quoter�r@rrr ���z%Subscription._find.<locals>.<genexpr>)�db_query�sorted�items�endswithr3rZrqr!�
isinstance�tuple�listr;r<rr5)r>r�orderrP�
conditions�argsrr/�queryr;�rowrGrrrrrL�s8�
�
�"�zSubscription._findcC�t|j||||dd��S)Nr)rrr
r{�rzrL)r>rrrr
rrrr:���z(Subscription.find_by_sid_and_distributorc
Cs0g}|D]\}}|�|j||||dd��q|S)z1uids should be a collection to tuples (sid, auth)r)r4rrr{)r\rL)r>r�uidsr4rQrrrrr�find_by_sids_and_class�s
�z#Subscription.find_by_sids_and_classcCst|j||d��S)N)r4r�)r>rr4rrr�
find_by_class�szSubscription.find_by_classc	CsF|jd|jd|jd|jdd|jdpdt|jd�|jdfS)Nrr
rrrrr)r	r3rrrr�subscription_tuple�s�zSubscription.subscription_tuplecCsd|jj�$}|��}ttt��}|�d|t|jd�|jdf�Wd�dS1s+wYdS)Nz�
                UPDATE notify_subscription
                   SET changetime=%s, priority=%s
                 WHERE id=%s
            rr
)	rr8r;rrrr<r3r	)rr@r;rArrr�_update_priority�s
�"�zSubscription._update_priority)NNr)r$�
__module__�__qualname__�	__slots__r"rr%r*r0r5�classmethodrBrRrVrergrLr:r�r�r�r�rrrrrs8

/


	
c@s�eZdZdZdZdd�Zdd�Zdd�Zd	d
�Ze	dd��Z
e	d
d��Ze	dd��Ze	dd��Z
e	ddd��Ze	dd��Ze	dd��Ze	dd��Ze	dd��ZdS)rr)r
rrr�realm�targetcCrrrrrrrrrzWatch.__init__cCr&rr'r)rrrr*r+zWatch.__getitem__cCr,rr-r.rrrr0r1zWatch.__setitem__cCs8||d<||d<t|�|d<||d<||d<||d<dS)Nr
rrrr�r�r2)rr
rrr4r�r�rrrr5szWatch._from_databasec		CsN|j�}|D]}|d|t|�|||f�qWd�dS1s wYdS)Nz�
                    INSERT INTO notify_watch (sid, authenticated, class,
                                              realm, target)
                    VALUES (%s, %s, %s, %s, %s)
                rf)	r>rrrr4r��targetsr@r�rrrrB!s��"�z	Watch.addcCs8|j�}|d|f�Wd�dS1swYdS)Nz&DELETE FROM notify_watch WHERE id = %s�r8)r>r�watch_idr@rrrrR+s"�zWatch.deletecCs@|j�}|d|t|�|f�Wd�dS1swYdS)Nz{
                DELETE FROM notify_watch
                WHERE sid = %s AND authenticated = %s AND class = %s
            rf)r>rrrr4r@rrr�delete_by_sid_and_class0s
�"�zWatch.delete_by_sid_and_classcCs<|j�}|d|||f�Wd�dS1swYdS)Nzv
                DELETE FROM notify_watch
                WHERE class = %s AND realm = %s AND target = %s
            r�)r>rr4r�r�r@rrr� delete_by_class_realm_and_target8s
�"�z&Watch.delete_by_class_realm_and_targetNc+s(�|j���g}g}t|���D].\}}|�d�r|dd�}|dkr&t|�}|���|�d�|dkr8t|�}|�|�qd}|rK|dd�|�7}|rgt|t	t
f�sW|f}|dd	��fd
d�|D��7}���}	|	�||�|	D]}
t
|�}|j|
�|VqsWd�dS1s�wYdS)NrhrirrjzESELECT id, sid, authenticated, class, realm, target FROM notify_watchrkrlrmrnc3rorrprrrrrr VrszWatch._find.<locals>.<genexpr>)rtrurvrwr3rZrqr!rxryrzr;r<rr5)r>rr{rPr|r}rr/r~r;r�watchrrrrrL@s<�
�
�"�zWatch._findcCr�)Nr�)rrr4r{r�)r>rrrr4rrr�find_by_sid_and_class^r�zWatch.find_by_sid_and_classc	Cst|j|||||dd��S)Nr�)rrr4r�r{r�)r>rrrr4r�r�rrr�"find_by_sid_class_realm_and_targetcs�z(Watch.find_by_sid_class_realm_and_targetcCst|j||||d��S)N)r4r�r�r�)r>rr4r�r�rrr�find_by_class_realm_and_targetisz$Watch.find_by_class_realm_and_targetcCst|j|||d��S)N)r4r�r�)r>rr4r�rrr�find_by_class_and_realmmszWatch.find_by_class_and_realmr)r$r�r�r�r"rr*r0r5r�rBrRr�r�rLr�r�r�r�rrrrrs2
	





N)�trac.util.datefmtrrr�__all__�objectrrrrrr�<module>s
r

https://t.me/RX1948 - 2025