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/wiki/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

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

�k�`'�@s�ddlZddlmZddlmZddlTddlmZddlm	Z	ddl
mZmZddl
mZmZmZdd	lmZdd
lmZGdd�de�ZdS)
�N)�cached)�
ConfigSection)�*)�lazy)�tag)�_�N_)�IWikiChangeListener�IWikiMacroProvider�
WikiSystem)�
WikiParser)�"split_url_into_path_query_fragmentc@s�eZdZdZeee�edd�ZdZ	e
�dej
e
j�Ze
�d�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zedd��Zdd�Zdd �Zd!d"�Zd#d$�Z e!d%d&��Z"d'S)(�InterWikiMapzInterWiki map manager.�	interwikiaEvery option in the `[interwiki]` section defines one InterWiki
        prefix. The option name defines the prefix. The option value defines
        the URL, optionally followed by a description separated from the URL
        by whitespace. Parametric URLs are supported as well.

        '''Example:'''
        {{{
        [interwiki]
        MeatBall = http://www.usemod.com/cgi-bin/mb.pl?
        PEP = http://www.python.org/peps/pep-$1.html Python Enhancement Proposal $1
        tsvn = tsvn: Interact with TortoiseSvn
        }}}
        �InterMapTxtz#(%s)[ \t]+([^ \t]+)(?:[ \t]+#(.*))?z\$\dcCs|��|jvS�N)�upper�
interwiki_map��self�ns�r�5/usr/lib/python3/dist-packages/trac/wiki/interwiki.py�__contains__9�zInterWikiMap.__contains__cCs|j|��Sr)rrrrrr�__getitem__<rzInterWikiMap.__getitem__cCs
t|j�Sr)�listr�rrrr�keys?s
zInterWikiMap.keyscs�fdd�}t�tj||�S)z8Replace "$1" by the first args, "$2" by the second, etc.cs@t|��dd��}d|krt��krnn�|dSdS)N�r�)�int�group�len)�match�num��argsrr�setargEs,z$InterWikiMap._expand.<locals>.setarg)�re�subr�_argspec_re)r�txtr'r(rr&r�_expandCszInterWikiMap._expandcCs,|s|S|�||�}||kr||dS|S)z9Like expand, but also append first arg if there's no "$".r)r-)rr,r'�expandedrrr�_expand_or_appendJszInterWikiMap._expand_or_appendcCs�||\}}}tdgdd�t�tj|�D��}t|�\}}}|dkr,|�d|d�}n|g}|�||�}t|�\}	}
}|rK|
rKd|
|dd�f}
n|
pN|}
|pR|}|	|
|}|�|�s`d}|�	||�}
|
|krqt
d	||d
�}
||
fS)ztReturn `(url, title)` for the given InterWiki `ns`.

        Expand the colon-separated `target` arguments.
        rcSsg|]
}t|dd���qS)rN)r!)�.0�arrr�
<listcomp>Wsz$InterWikiMap.url.<locals>.<listcomp>�:rz%s&%sNr z%(target)s in %(name)s)�target�name)�maxr)�findallrr+r
�splitr/�_is_safe_urlr-r)rrr4�url�title�	maxargnum�query�fragmentr'�ntarget�nquery�	nfragment�expanded_url�expanded_titlerrrr:Qs.
�
�zInterWikiMap.urlcC�|jtjkr
|`dSdSr�r5r�
_page_namer�r�pagerrr�wiki_page_addedp��zInterWikiMap.wiki_page_addedcCrDrrE)rrH�version�t�comment�authorrrr�wiki_page_changedtrJzInterWikiMap.wiki_page_changedcCrDrrErGrrr�wiki_page_deletedxrJzInterWikiMap.wiki_page_deletedcCrDrrErGrrr�wiki_page_version_deleted|rJz&InterWikiMap.wiki_page_version_deletedcCsddlm}i}||jtj�j}d}|�d�D]9}|rI|�d�r#d}qt�	tj
|�}|rH|��\}}}	|��}|	r=|	��n|}	|||	f||�
�<q|�d�rPd}q|j��D])\}}
|
�dd�}
|
r|
d��}t|
�dkrt|
d��n|}	|||	f||�
�<qV|S)	zVMap from upper-cased namespaces to (namespace, prefix, title)
        values.
        r)�WikiPageF�
z----TNr)�trac.wiki.modelrR�envrrF�textr8�
startswithr)r$�
_interwiki_re�groups�stripr�interwiki_section�optionsr#)rrR�map�content�in_map�line�m�prefixr:r;�valuerrrr�s4
�
��zInterWikiMap.interwiki_mapccs�dVdS)N�	InterWikirrrrr�
get_macros�s�
zInterWikiMap.get_macroscCsdtd�fS)N�messagesz<Provide a description list for the known InterWiki prefixes.)r)rr5rrr�get_macro_description�s�z"InterWikiMap.get_macro_descriptionc	
Cs�g}t|���D]}||\}}}|�||||�|dg�||kr"|n|d��qtjt�t�t�t	d���t�t�t	d����dd�|D�dd�S)	N�
RecentChanges)rbr:r;�rc_url�description�Prefix�SitecSsHg|] }t�t�tj|d|dd��t�tj|d|dd����qS)rbri)�hrefrjr:)r�tr�tdr1)r0�wrrrr2�s���z-InterWikiMap.expand_macro.<locals>.<listcomp>zwiki interwiki)�class_)
�sortedr�appendr/r�tablern�th�emr)	r�	formatterr5r^�
interwikis�krbr:r;rrr�expand_macro�s 
����zInterWikiMap.expand_macrocCs*t|j�jpd|vp|�dd�d|jvS)Nr3rr)rrU�render_unsafe_contentr8�
_safe_schemes)rr:rrrr9�s
��zInterWikiMap._is_safe_urlcCstt|j�j�Sr)�setrrU�safe_schemesrrrrr|�szInterWikiMap._safe_schemesN)#�__name__�
__module__�__qualname__�__doc__�
implementsr	r
rr[rFr)�compiler�LINK_SCHEME�UNICODErXr+rrrr-r/r:rIrOrPrQrrrergrzr9rr|rrrrrs>
���

r)r)�
trac.cacher�trac.configr�	trac.core�	trac.utilr�trac.util.htmlr�trac.util.translationrr�
trac.wiki.apir	r
r�trac.wiki.parserr�trac.wiki.formatterr
�	Componentrrrrr�<module>s

https://t.me/RX1948 - 2025