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

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

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

�k�` �@s�ddlZddlZddlZddlZddlTddlmZddlmZm	Z	m
Z
ej�d�Z
dZdZdZGd	d
�d
e�ZGdd�de�ZGd
d�de�ZGdd�de�ZGdd�de�Zdd�ZGdd�de�Zddd�Z		ddd�ZdS)�N)�*)�levenshtein_distance)�_�get_negotiated_locale�	has_babel�LANGz%Y-%m-%dz%Y-%m-%d %H:%M:%Sz
YYYY-MM-DDc@s eZdZdZdd�Zdd�ZdS)�IAdminPanelProviderz_Extension point interface for adding panels to the web-based
    administration interface.
    cC�dS)z�Return a list of available admin panels.

        The items returned by this function must be tuples of the form
        `(category, category_label, page, page_label)`.
        N�)�reqr
r
�0/usr/lib/python3/dist-packages/trac/admin/api.py�get_admin_panels$�z$IAdminPanelProvider.get_admin_panelscCr	)z�Process a request for an admin panel.

        This function should return a tuple of the form `(template, data)`,
        where `template` is the name of the template to use and `data` is
        the data to use when rendering the template.
        Nr
)r�category�page�	path_infor
r
r�render_admin_panel+rz&IAdminPanelProvider.render_admin_panelN)�__name__�
__module__�__qualname__�__doc__r
rr
r
r
rrsrc@seZdZdZddd�ZdS)�AdminCommandErrorz:Exception raised when an admin command cannot be executed.FNcCst�||�||_||_dS�N)�	TracError�__init__�
show_usage�cmd)�self�msgrrr
r
rr6s
zAdminCommandError.__init__)FN)rrrrrr
r
r
rr4src@�eZdZdZdd�ZdS)�IAdminCommandProviderzlExtension point interface for adding commands to the console
    administration interface `trac-admin`.
    cCr	)aReturn a list of available admin commands.

        The items returned by this function must be tuples of the form
        `(command, args, help, complete, execute)`, where `command`
        contains the space-separated command and sub-command names, `args`
        is a string describing the command arguments and `help` is the
        help text. The first paragraph of the help text is taken as a
        short help, shown in the list of commands.

        `complete` is called to auto-complete the command arguments, with
        the current list of arguments as its only argument. It should
        return a list of relevant values for the last argument in the list.

        `execute` is called to execute the command, with the command
        arguments passed as positional arguments.
        Nr
r
r
r
r�get_admin_commandsArz(IAdminCommandProvider.get_admin_commandsN)rrrrr!r
r
r
rr <sr c@s@eZdZdZee�Zgfdd�Zd
dd�Zdd�Z	dd
d�Z
dS)�AdminCommandManagerztrac-admin command manager.cCs`g}|jD]$}|��pgD]}|d��}|dt|��|kr(|�|dd��q
q|��|S)z.Return help information for a set of commands.rN�)�	providersr!�split�len�append�sort)r�args�commands�providerr�partsr
r
r�get_command_helpYs
��z$AdminCommandManager.get_command_helpFcCs�g}|jD]]}|��pgD]T}|d��}tt|�t|�d�}|d|�|d|�kr-q
t|�t|�krA|�|t|�d�q
|sa|ddurOgS|d|t|�d��p\gSq
q|S)z/Perform auto-completion on the given arguments.r�Nr#)r$r!r%�minr&r')rr)�cmd_only�compr+rr,�plenr
r
r�complete_commandds 
$��z$AdminCommandManager.complete_commandc	Gs�t|�}|jD]f}|��pgD]]}|d��}|dt|��|krl|d}|t|�d�}z	||�WStyI}zd�|�|_�d}~wtykt	�
t��d�}t|�dkrjtt
d�dd�|�d	���wqqtt
d
�dd��)z/Execute a command given by a list of arguments.rN�� �r.zInvalid argumentsT)rrzCommand not found)r)�listr$r!r%r&r�joinr�	TypeError�	traceback�
extract_tb�sys�exc_infor)	rr)r+rr,�f�fargs�e�tbr
r
r�execute_commandus2
�����z#AdminCommandManager.execute_command�cs|�sgSt�}|jD]}|��pgD]
}|�|d��d�qq
dd��t��fdd�|D��}dd�|D�}|d|�S)NrcSs,|�|�rdSt||�tt|�t|��S)Nr)�
startswithr�floatr&)r�argr
r
r�score�s
z7AdminCommandManager.get_similar_commands.<locals>.scorec3s�|]
}�|��|fVqdSrr
)�.0r�rFrGr
r�	<genexpr>�s�z;AdminCommandManager.get_similar_commands.<locals>.<genexpr>cSsg|]
\}}|dkr|�qS)g�?r
)rH�valrr
r
r�
<listcomp>�sz<AdminCommandManager.get_similar_commands.<locals>.<listcomp>)�setr$r!�addr%�sorted)rrF�n�cmdsr+r�similarsr
rIr�get_similar_commands�s
�z(AdminCommandManager.get_similar_commandsN�F)rC)rrrr�ExtensionPointr r$r-r3rBrSr
r
r
rr"Ts
r"c@r)�
PrefixListz8A list of prefixes for command argument auto-completion.cst�fdd�|D��S)Ncsh|]	}|���r|�qSr
)rD�rH�a��textr
r�	<setcomp>��z&PrefixList.complete.<locals>.<setcomp>)r7)rrZr
rYr�complete�szPrefixList.completeN�rrrrr]r
r
r
rrV��rVcCstj�|��tj�|��Sr)�os�path�normcaserD)ra�prefixr
r
r�path_startswith�srdc@r)�PathListz5A list of paths for command argument auto-completion.csFt�fdd�|D��}t|�dkr!tj�|d�s!|dd7<|S)z+Return the items in the list matching text.csh|]	}t|��r|�qSr
)rdrWrYr
rr[�r\z$PathList.complete.<locals>.<setcomp>r.rr5)r7r&r`ra�isdir)rrZ�matchesr
rYrr]�szPathList.completeNr^r
r
r
rre�r_reFc	Cs�tj�|�}tj�t��|�}t�}zt�|�}Wnty$|YSw|D]0}tj�tj�||��}ztj�	|�rF|�
tj�|d��n|sM|�
|�Wq'tyWYq'w|S)zYReturn a list of paths to filesystem entries in the same directory
    as the given path.�)r`ra�dirnamer8�getcwdre�listdir�OSError�normpathrfr')ra�	dirs_only�dname�d�result�dlist�entryr
r
r�get_dir_list�s(�
��rt��LANGUAGE�LC_ALL�LC_MESSAGESrcs�tr[ddlm}m��fdd�}|g}|D]}tj�|�}|s q|dkr/d|vr/|�d�d}|�|�q|rA|�|j	�dd��t
td	t||���}zt
|�WS|yZYd	Swd	S)
z\Return negotiated locale for console by locale environments and
    [trac] default_language.r)�UnknownLocaleError�parse_localecs,|sdSzd�td�|���WSYdS)Nr)r8�filter)�value�rzr
r�	normalize�sz%get_console_locale.<locals>.normalizerv�:�trac�default_languageN)r�
babel.coreryrzr`�environ�getr%r'�configr7r{�mapr)�env�lang�
categoriesryr~�localesrr|r
r}r�get_console_locale�s*
�r�rT)NNru)r`�os.pathr<r:�	trac.core�trac.util.textr�trac.util.translationrrrr�r�r�console_date_format�console_datetime_format�console_date_format_hint�	Interfacerrrr �	Componentr"r7rVrdrertr�r
r
r
r�<module>s,
J

�

https://t.me/RX1948 - 2025