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

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

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

�k�`,��@s�ddlZddlZddlZddlmZmZmZmZddl	m
Z
mZddlm
Z
mZmZmZddlmZmZddlmZddlmZddlmZmZmZmZdd	lmZmZm Z m!Z!gd
�Z"e#�Z$dd�Z%d
d�Z&dd�Z'dd�Z(Gdd�de�Z)Gdd�de�Z*Gdd�de#�Z+Gdd�de#�Z,d5dd�Z-Gdd�de#�Z.Gdd �d e#�Z/Gd!d"�d"e/�Z0Gd#d$�d$e/�Z1Gd%d&�d&e/�Z2Gd'd(�d(e/�Z3Gd)d*�d*e/�Z4Gd+d,�d,e/�Z5Gd-d.�d.e/�Z6Gd/d0�d0e3�Z7Gd1d2�d2e
�Z8d3d4�Z9dS)6�N)�ConfigParser�
NoOptionError�NoSectionError�ParsingError)�AdminCommandError�IAdminCommandProvider)�	Component�ExtensionPoint�	TracError�
implements)�
AtomicFile�as_bool)�wait_for_file_mtime_change)�tag)�cleandoc�printout�
to_unicode�to_utf8)�N_�_�dgettext�tag_)�
Configuration�
ConfigSection�Option�
BoolOption�	IntOption�FloatOption�
ListOption�ChoiceOption�
PathOption�ExtensionOption�OrderedExtensionsOption�ConfigurationErrorcC�t|pd�S)Nr)�int��value�r(�-/usr/lib/python3/dist-packages/trac/config.py�_getint%�r*cCr$)Ng)�floatr&r(r(r)�	_getfloat)r+r-cCst|sgSt|t�r+t|ttf�rt�d�ttj|��|�}n|�|�}dd�|D�}nt|�}|s8dd�|D�}|S)N�|cS�g|]}|���qSr()�strip��.0�itemr(r(r)�
<listcomp>5�z_getlist.<locals>.<listcomp>cSsg|]}|dvr|�qS)�N�r(r1r(r(r)r49�)	�
isinstance�str�list�tuple�re�split�join�map�escape)r'�sep�
keep_empty�splitted�itemsr(r(r)�_getlist-s

rFcCs,t|j�}|rt|j|fi|jpi��}|S�N)r�__doc__r�
doc_domain�doc_args)�option_or_section�docr(r(r)�_getdoc=s
�rMcs*eZdZdZed�Zd�fdd�	Z�ZS)r#zEException raised when a value in the configuration file is not valid.zConfiguration ErrorNFcs$|durtd�}t��|||�dS)Nz*Look in the Trac log for more information.)r�super�__init__)�self�message�title�show_traceback��	__class__r(r)rOIszConfigurationError.__init__)NNF)�__name__�
__module__�__qualname__rHrrRrO�
__classcell__r(r(rTr)r#Esr#c@sfeZdZdZddd�Zdd�Zddefd	d
�Zddefdd�Zdd
d�Z	ddd�Z
dd�Zdd�ZdS)�UnicodeConfigParserzzA Unicode-aware version of ConfigParser. Arguments are encoded to
    UTF-8 and return values are decoded from UTF-8.
    TcKs(||_|�dd�tj|fi|��dS)N�
interpolation)�_ignorecase_option�
setdefaultrrO)rP�ignorecase_option�kwargsr(r(r)rO[szUnicodeConfigParser.__init__cCs|jr|��}|SrG)r\�lower)rP�optionr(r(r)�optionxform`szUnicodeConfigParser.optionxformFNc	Cs<ztj|||||d�WSttfy|tur�|YSw�N)�raw�vars)r�getrr�_use_default)rP�sectionrardre�fallbackr(r(r)rfes�zUnicodeConfigParser.getcCs6z
tj||||d�WSty|tur�|YSwrc)rrErrg)rPrhrdrerir(r(r)rEns�zUnicodeConfigParser.itemscCs(t|dur|nd�}t�||||�dSr6)rr�set)rPrhrar'�	value_strr(r(r)rjvszUnicodeConfigParser.set�utf-8cCst�|||�SrG)r�read)rP�filename�encodingr(r(r)rmzszUnicodeConfigParser.readcCs|��}t�|j�|_|SrG)rU�copy�	_sections)rP�parserr(r(r)�__copy__}�zUnicodeConfigParser.__copy__cCs|��}t�|j�|_|SrG)rUrp�deepcopyrq)rP�memorrr(r(r)�__deepcopy__�rtz UnicodeConfigParser.__deepcopy__�TrG)rl)
rVrWrXrHrOrbrgrfrErjrmrsrwr(r(r(r)rZOs

�	

rZc@s�eZdZdZifdd�Zdd�Zdd�Zdd	�Zd
d�Ze	dd
��Z
d7dd�Zd7dd�Zd7dd�Z
d7dd�Zd8dd�Zd7dd�Zdd�Zd9d d!�Zd9d"d#�Zd9d$d%�Zd:d'd(�Zd;d)d*�Zd+d,�Zd<d-d.�Zd/d0�Zd=d1d2�Zd3d4�Zd5d6�ZdS)>rz�Thin layer over `ConfigParser` from the Python standard library.

    In addition to providing some convenience methods, the class remembers
    the last modification time of the configuration file, and reparses it
    when the file has changed.
    cCs6||_t�|_d|_g|_d|_i|_|jdd�dS)NrT��force)rnrZrr�_pristine_parser�parents�
_lastmtimerq�parse_if_needed)rPrn�paramsr(r(r)rO�szConfiguration.__init__cC�d|jj|jfS)Nz<%s %r>)rUrVrn�rPr(r(r)�__repr__��zConfiguration.__repr__cCs||��vS)zWReturn whether the configuration contains a section of the given
        name.
        )�sections�rP�namer(r(r)�__contains__�szConfiguration.__contains__cCs$||jvr
t||�|j|<|j|S)z9Return the configuration section with the specified name.)rq�Sectionr�r(r(r)�__getitem__�s

zConfiguration.__getitem__cCs|j�|d�|j�|�dSrG)rq�poprr�remove_sectionr�r(r(r)�__delitem__�szConfiguration.__delitem__cCstj�|j�S)zXReturn boolean indicating configuration file existence.

        :since: 1.0.11
        )�os�path�isfilernr�r(r(r)�exists�szConfiguration.existsr7cC�||�||�S�znReturn the value of the specified option.

        Valid default input is a string. Returns a string.
        �rf�rPrh�key�defaultr(r(r)rf��zConfiguration.getcCr�)a
Return the specified option as boolean value.

        If the value of the option is one of "yes", "true", "enabled", "on",
        or "1", this method wll return `True`, otherwise `False`.

        Valid default input is a string or a bool. Returns a bool.
        ��getboolr�r(r(r)r���zConfiguration.getboolcCr�)��Return the value of the specified option as integer.

        If the specified option can not be converted to an integer, a
        `ConfigurationError` exception is raised.

        Valid default input is a string or an int. Returns an int.
        ��getintr�r(r(r)r��r�zConfiguration.getintcCr�)��Return the value of the specified option as float.

        If the specified option can not be converted to a float, a
        `ConfigurationError` exception is raised.

        Valid default input is a string, float or int. Returns a float.
        ��getfloatr�r(r(r)r��r�zConfiguration.getfloat�,FcCs||�||||�S)a�Return a list of values that have been specified as a single
        comma-separated option.

        A different separator can be specified using the `sep` parameter. The
        `sep` parameter can specify multiple values using a list or a tuple.
        If the `keep_empty` parameter is set to `True`, empty elements are
        included in the list.

        Valid default input is a string or a list. Returns a string.
        )�getlist)rPrhr�r�rBrCr(r(r)r���zConfiguration.getlistcCr�)z�Return a configuration value as an absolute path.

        Relative paths are resolved relative to the location of this
        configuration file.

        Valid default input is a string. Returns a normalized path.
        ��getpathr�r(r(r)r��r�zConfiguration.getpathcCs||�||�dS�zlChange a configuration value.

        These changes are not persistent unless saved with `save()`.
        N)rj)rPrhr�r'r(r(r)rj�szConfiguration.setNcCs<i}t�|���D]\\}}}|�|j�|�|i�|<q	|S)z�Returns a dictionary of the default configuration values.

        If `compmgr` is specified, return only options declared in components
        that are enabled in the given `ComponentManager`.
        )r�get_registryrE�dumpsr�r])rP�compmgr�defaultsrhr�rar(r(r)r��s�
�zConfiguration.defaultscCs||�|�S)aOReturn a list of `(name, value)` tuples for every option in the
        specified section.

        This includes options that have default values that haven't been
        overridden. If `compmgr` is specified, only return default option
        values for components that are enabled in the given
        `ComponentManager`.
        )�options)rPrhr�r(r(r)r�s	zConfiguration.optionscCs |r||�|�dS||=dS)z'Remove the specified option or section.N)�remove)rPrhr�r(r(r)r�s
zConfiguration.removeTcCs^t|j���}|jD]}|�|j|dd��q
|r!|�|�|��|r+|�t�|��t|�S)aLReturn a list of section names.

        If `compmgr` is specified, only the section names corresponding to
        options declared in components that are enabled in the given
        `ComponentManager` are returned.

        :param empty: If `True`, include sections from the registry that
            contain no options.
        F�r�)	rjrrr�r|�updater�rr��sorted)rPr�r��emptyr��parentr(r(r)r�s

zConfiguration.sectionscCr�)z�Returns True if option exists in section in either the project
        trac.ini or one of the parents, or is available through the Option
        registry.
        )�contains)rPrhrar�r(r(r)�
has_option(r�zConfiguration.has_optionc

s`i�t����D]\\}}}|��|i�|<q�fdd�}g}|��D]O}g}||D];}d}|jD]}|j||dd�rH||||�||��}nq2|j�||�rf||||j�||��}	|	|krf|�	||	f�q+|rr|�	|t
|�f�q#t�}
|D]\}}|
�|�|D]\}}|
�
|||�q�qxz|�|
�Wnty�t�|j�|_�wt�|j�|_dS)z4Write the configuration options to the primary file.cs$��|i��|�}|r|�|�S|SrG)rf�	normalize)rhr�r'ra��all_optionsr(r)r�6sz%Configuration.save.<locals>.normalizeNFr�)rr�rEr]r�r|r�rfrr�appendr�rZ�add_sectionrj�_write�	Exceptionrprur{)
rPrhr�rar�r�r�r�r��currentrrr��valr(r�r)�save/sN

�����
��zConfiguration.savec
Cs�|jr|jsdSd}tj�|j�}|s||jkrLt�|_z|j�|j�s-t	t
d|jd���Wnty?}zt	|�|�d}~ww||_t�
|j�|_d}|rT|��|_n|jD]
}||j|d�O}qW|rgi|_|S)NFz3Error reading '%(file)s', make sure it is readable.)�fileTry)rnr�r�r��getmtimer}rZrrrmr
rrrprur{�_get_parentsr|r~rq)rPrz�changed�modtime�er�r(r(r)r~\s4��
��
zConfiguration.parse_if_neededcCs6|jr|jrt�|jtj�rt|j�dSdSdSdSrG)rnr�r��access�W_OKrr�r(r(r)�touchxs
��zConfiguration.touchcs��fdd�}|rP|�d�r|dd�}|���d�}ddlm}|jD]*}|jd|j���d�}|dt|��|krM|j	�
�D]}t|t�rL||�qAq#dSt�
|��
�D]}||�qWdS)	z�Retrieve all default values and store them explicitly in the
        configuration, so that they can be saved to file.

        Values already set in the configuration are not overwritten.
        cs>|j}|j}�j||dd�s|�|j�}��|||�dSdS)NFr�)rhr�r�r�r�rj)rarhr�r'r�r(r)�set_option_default�s�z6Configuration.set_defaults.<locals>.set_option_defaultz.*N����.r��
ComponentMeta)�endswithr`r>�	trac.corer��_componentsrWrV�len�__dict__�valuesr9rr�)rPr��	componentr�r��cls�clsnamerar(r�r)�set_defaults}s&

�
��
�zConfiguration.set_defaultscCsjg}|j�dd�r3|j�dd��d�D]}|��}tj�|�s+tj�tj�	|j
�|�}|�t|��q|S)N�inheritr�r�)
rrr�rfr>r0r�r��isabsr?�dirnamernr�r)rP�_parentsrnr(r(r)r��s�zConfiguration._get_parentscCs^|jsdSt|j�t|jd��}|�ddg�|�|�Wd�dS1s(wYdS)N�wz# -*- coding: utf-8 -*-
�
)rnrr�
writelines�write)rPrr�fdr(r(r)r��s
"�zConfiguration._write�r7)r7r�FrG)NTFrx)F)NN)rVrWrXrHrOr�r�r�r��propertyr�rfr�r�r�r�r�rjr�r�r�r�r�r�r~r�r�r�r�r(r(r(r)r�s6	

















-
rc@s�eZdZdZgd�Zdd�Zdd�Zd!dd	�ZeZd"dd�Z	e	Z
d#dd�Zd#dd�Zd#dd�Z
d#dd�Zd$dd�Zd#dd�Zd%dd�Zdd�Zdd �Zd
S)&r�zpProxy for a specific configuration section.

    Objects of this class should not be instantiated directly.
    ��configr��_cachecCs||_||_i|_dSrGr�)rPr�r�r(r(r)rO�s
zSection.__init__cCr��Nz	<%s [%s]>�rUrVr�r�r(r(r)r��r�zSection.__repr__TcCsR|jj�|j|�rdS|jjD]}||jj|dd�rdSq|o(|j|ftjvS)NTFr�)r�rrr�r�r|r�r�registry)rPr�r�r�r(r(r)r��s�zSection.containsNccs��t�}|jj�|j�r!|jj�|j�D]}|�|���|Vq|jjD]}||jj	dd�D]}|��}||vrB|�|�|Vq0q%|r`t
�|���D]\}}||jkr_|��|vr_|VqMdSdS)z�Iterate over the options in this section.

        If `compmgr` is specified, only return default option values for
        components that are enabled in the given `ComponentManager`.
        Fr�N)
rjr�rr�has_sectionr�r��addr`r|�iteraterr��keys)rPr�r�r�rar��loptionrhr(r(r)r��s*�
����zSection.iterater7cCs�|j�|t�}|tur
|S|jj�|j|�r |jj�|j|�}n0|jjD]}||j�|t�}|tur5nq$|turNtj	�|j|f�}|rK|�
|j�nt}nt}|turV|S||j|<|Sr�)r�rfrgr�rrr�r�r|rr�r�r�)rPr�r��cachedr'r�rar(r(r)rf�s(��
zSection.getcCst|�||��S)a6Return the value of the specified option as boolean.

        This method returns `True` if the option value is one of "yes",
        "true", "enabled", "on", or non-zero numbers, ignoring case.
        Otherwise `False` is returned.

        Valid default input is a string or a bool. Returns a bool.
        )r
rf)rPr�r�r(r(r)r��s	zSection.getboolc
C�@|�||�}zt|�WStyttd|j|t|�d���w)r�z8[%(section)s] %(entry)s: expected integer, got %(value)s�rh�entryr')rfr*�
ValueErrorr#rr��repr�rPr�r�r'r(r(r)r��
���zSection.getintc
Cr�)r�z6[%(section)s] %(entry)s: expected float, got %(value)sr�)rfr-r�r#rr�r�r�r(r(r)r�r�zSection.getfloatr�cCst|�||�||�S)a�Return a list of values that have been specified as a single
        comma-separated option.

        A different separator can be specified using the `sep` parameter. The
        `sep` parameter can specify multiple values using a list or a tuple.
        If the `keep_empty` parameter is set to `True`, empty elements are
        included in the list.

        Valid default input is a string or a list. Returns a list.
        )rFrf)rPr�r�rBrCr(r(r)r�'r�zSection.getlistcCsN|�||�}|s
|Stj�|�stj�tj�|jj�|�}tj�tj�	|��S)z�Return the value of the specified option as a path, relative to
        the location of this configuration file.

        Valid default input is a string. Returns a normalized path.
        )
rfr�r�r�r?r�r�rn�normcase�realpath)rPr�r�r�r(r(r)r�4szSection.getpathccs&�|�|�D]
}||�|�fVqdS)a*Return `(key, value)` tuples for every option in the section.

        This includes options that have default values that haven't been
        overridden. If `compmgr` is specified, only return default option
        values for components that are enabled in the given `ComponentManager`.
        N)r�rf)rPr�r�r(r(r)r�As��zSection.optionscCsB|j�|d�|jj�|j�s|jj�|j�|jj�|j||�Sr�)r�r�r�rrr�r�r�rj)rPr�r'r(r(r)rjKszSection.setcCsV|j�|d�|jj�|j�r'|jj�|j|�|jj�|j�s)|j|j=dSdSdS)z�Delete a key from this section.

        Like for `set()`, the changes won't persist until `save()` gets
        called.
        N)r�r�r�rrr�r��
remove_optionr�)rPr�r(r(r)r�Us�zSection.removerx)NTr�)r7r�TrG)rVrWrXrH�	__slots__rOr�r�r�r��__iter__rfr�r�r�r�r�r�rjr�r(r(r(r)r��s$











r�csj�dur|jSddlm}i�|jD]}|j��D]}t||�r$|�|<qqt��fdd�|j��D��S)z�Return the descriptor registry.

    If `compmgr` is specified, only return descriptors for components that
    are enabled in the given `ComponentManager`.
    Nrr�c3s2�|]}|d�vs���|d�r|VqdS)�N)�
is_enabled)r2�each�r��
componentsr(r)�	<genexpr>rs����z _get_registry.<locals>.<genexpr>)	r�r�r�r�r�r�r9�dictrE)r�r�r��comp�attrr(r�r)�
_get_registrybs

��rc@sHeZdZdZiZeddd��Zddd�Zdd	�Zd
d�Z	e
dd
��ZdS)rz&Descriptor for configuration sections.NcC�
tt|�S)z�Return the section registry, as a `dict` mapping section names to
        `ConfigSection` objects.

        If `compmgr` is specified, only return sections for components that
        are enabled in the given `ComponentManager`.
        )rr�r�r(r(r)r�|�
zConfigSection.get_registry�tracinicCs,||_||j|j<t|�|_||_||_dS)z!Create the configuration section.N)r�r�rrHrIrJ)rPr�rLrIrJr(r(r)rO�s


zConfigSection.__init__cCs8|dur|St|dd�}|rt|t�r||jSdSdS�Nr�)�getattrr9rr�)rP�instance�ownerr�r(r(r)�__get__�s
�zConfigSection.__get__cCr�r�r�r�r(r(r)r��r�zConfigSection.__repr__cC�t|�S)z(Return localized document of the section�rMr�r(r(r)rL��zConfigSection.docrG)rN)rVrWrXrHr��staticmethodr�rOrr�r�rLr(r(r(r)rws
	rc@sleZdZdZiZdd�Zeddd��Z		dd	d
�Zdd�Z	d
d�Z
dd�Zedd��Z
dd�Zdd�ZdS)rz%Descriptor for configuration options.cC�|�||�SrGr��rPrhr�r�r(r(r)�accessor�r+zOption.accessorNcCr)z�Return the option registry, as a `dict` mapping `(section, key)`
        tuples to `Option` objects.

        If `compmgr` is specified, only return options for components that are
        enabled in the given `ComponentManager`.
        )rrrr(r(r)r��rzOption.get_registryr7rcCsD||_||_|�|�|_||j|j|jf<t|�|_||_||_dS)a,Create the configuration option.

        :param section: the name of the configuration section this option
                        belongs to
        :param name: the name of the option
        :param default: the default value for the option
        :param doc: documentation of the option
        N)	rhr�r�r�r�rrHrIrJ)rPrhr�r�rLrIrJr(r(r)rO�s


zOption.__init__cCsN|dur|St|dd�}|r#t|t�r%||j}|�||j|j�}|SdSdSr)rr9rrhrr�r�)rPr	r
r�rhr'r(r(r)r�s
�zOption.__get__cCsttd���)Nz!Setting attribute is not allowed.)�AttributeErrorr)rPr	r'r(r(r)�__set__�r+zOption.__set__cCsd|jj|j|jfS)Nz<%s [%s] %r>)rUrVrhr�r�r(r(r)r��s�zOption.__repr__cCr)z'Return localized document of the optionr
r�r(r(r)rL�rz
Option.doccCs:|durdS|durdS|durdSt|t�r|St|�S)z8Return the value as a string to write to a trac.ini fileNr7T�enabledF�disabled)r9r:r�rPr'r(r(r)r��s
zOption.dumpscCs
|�|�S)z5Normalize the given value to write to a trac.ini file)r�rr(r(r)r��s
zOption.normalizerG�Nr7rN)rVrWrXrHr�rrr�rOrrr�r�rLr�r�r(r(r(r)r�s 	
�	
rc@� eZdZdZdd�Zdd�ZdS)rz-Descriptor for boolean configuration options.cCrrGr�rr(r(r)r�r+zBoolOption.accessorcCs|dvrt|�}|�|�S)N)TF)r
r�rr(r(r)r��s
zBoolOption.normalizeN�rVrWrXrHrr�r(r(r(r)r��rc@r)rz-Descriptor for integer configuration options.cCrrGr�rr(r(r)r�r+zIntOption.accessorcC�*zt|�}Wn	tyYnw|�|�SrG)r*r�r�rr(r(r)r����
zIntOption.normalizeNrr(r(r(r)r�rrc@r)rz+Descriptor for float configuration options.cCrrGr�rr(r(r)rr+zFloatOption.accessorcCrrG)r-r�r�rr(r(r)r�rzFloatOption.normalizeNrr(r(r(r)rrrc@s6eZdZdZ		ddd�Zd	d
�Zdd�Zd
d�ZdS)rzmDescriptor for configuration options that contain multiple values
    separated by a specific character.
    Nr�Fr7rc			Cs&||_||_t�|||||||�dSrG)rBrCrrO)	rPrhr�r�rBrCrLrIrJr(r(r)rOs
�zListOption.__init__cCs|�|||j|j�SrG)r�rBrCrr(r(r)rszListOption.accessorcsNt|ttf�r!�j}t|ttf�r|d}|��fdd�|D��St��|�S)Nrc3s �|]}t��|�pdVqdS)r7N)rr�)r2�vr�r(r)r�$s�z#ListOption.dumps.<locals>.<genexpr>)r9r;r<rBr?rr�)rPr'rBr(r�r)r�szListOption.dumpscCs|�t||j|j��SrG)r�rFrBrCrr(r(r)r�'szListOption.normalize)Nr�Fr7rN)rVrWrXrHrOrr�r�r(r(r(r)rs
�rc@s&eZdZdZ		d
dd�Zdd	�ZdS)rz�Descriptor for configuration options providing a choice among a list
    of items.

    The default value is the first choice in the list.
    r7rNTc	Cs<t�|||t|d�|||�tdd�|D��|_||_dS)NrcSsh|]}t|����qSr()rr0�r2�cr(r(r)�	<setcomp>6r8z(ChoiceOption.__init__.<locals>.<setcomp>)rrOrr;�choices�case_sensitive)rPrhr�r"rLrIrJr#r(r(r)rO2s
�
zChoiceOption.__init__cCs�|�||�}|jdd�}|jsdd�|D�}|��}z|�|�}Wn tyBttd|j|t	|�d�
dd�t|j�D��d���w|j|S)NcSr/r()r`rr(r(r)r4=r5z)ChoiceOption.accessor.<locals>.<listcomp>zE[%(section)s] %(entry)s: expected one of (%(choices)s), got %(value)s�, css�|]}d|VqdS)z"%s"Nr(rr(r(r)r�Fs��z(ChoiceOption.accessor.<locals>.<genexpr>)rhr�r'r")rfr"r#r`�indexr�r#rr�r�r?r�)rPrhr�r�r'r"�idxr(r(r)r9s$
����
zChoiceOption.accessor)r7rNT)rVrWrXrHrOrr(r(r(r)r+s
�rc@seZdZdZdd�ZdS)r z�Descriptor for file system path configuration options.

    Relative paths are resolved to absolute paths using the directory
    containing the configuration file as the reference.
    cCrrGr�rr(r(r)rRr+zPathOption.accessorN)rVrWrXrHrr(r(r(r)r Ksr c@s&eZdZdZ		d	dd�Zdd�ZdS)
r!z�Name of a component implementing `interface`. Raises a
    `ConfigurationError` if the component cannot be found in the list of
    active components implementing the interface.Nr7rc	Cs$t�|||||||�t|�|_dSrG)rrOr	�xtnpt)rPrhr��	interfacer�rLrIrJr(r(r)rO[s�zExtensionOption.__init__c
Csx|dur|St�|||�}|j�|�D]}|jj|kr|Sqttdt�	|jj
j�t�	|�t�	d|j|jf�d���)Nz�Cannot find an implementation of the %(interface)s interface named %(implementation)s. Please check that the Component is enabled or update the option %(option)s in trac.ini.�[%s] %s�r(�implementationra)
rrr'�
extensionsrUrVr#rr�coder(rhr�)rPr	r
r'�implr(r(r)ras���zExtensionOption.__get__r�rVrWrXrHrOrr(r(r(r)r!Vs
�r!c@s(eZdZdZ			d
dd�Zdd	�ZdS)r"z�A comma separated, ordered, list of components implementing
    `interface`. Can be empty.

    If `include_missing` is true (the default) all components implementing the
    interface are returned, with those specified by the option ordered first.
    NTr7rc			Cs,tj|||||||d�t|�|_||_dS)N)rLrIrJ)rrOr	r'�include_missing)	rPrhr�r(r�r0rLrIrJr(r(r)rOzs
�

z OrderedExtensionsOption.__init__c
s�|dur|St�|||��g�g}|j�|�D]}|�|jj�|js)|jj�vr.��|�qtt	��t	|��}|r]t
tdt�
|jjj�tdd�t|�D��t�
d|j|jf�d�����fdd�}t�|d�S)	Nz�Cannot find implementation(s) of the %(interface)s interface named %(implementation)s. Please check that the Component is enabled or update the option %(option)s in trac.ini.css.�|]\}}|dkrdndt�|�fVqdS)rr$N)rr-)r2r&r.r(r(r)r��s
��
�z2OrderedExtensionsOption.__get__.<locals>.<genexpr>r)r*cs,|jj}|�vrd��|�fSd��|�fS)Nrr�)rUrVr%)r.r��r��orderr(r)r��sz,OrderedExtensionsOption.__get__.<locals>.key�r�)rrr'r,r�rUrVr0r�rjr#rrr-r(�	enumeraterhr�)rPr	r
�implementing_classesr.�	not_foundr�r(r1r)r�s.
����zOrderedExtensionsOption.__get__)NTr7rNr/r(r(r(r)r"rs
�r"c@sBeZdZdZee�dd�Zdd�Zdd�Zdd	�Z	d
dd�Z
d
S)�ConfigurationAdminz8trac-admin command provider for trac.ini administration.ccsB�ddd|j|jfVddd|j|jfVddd	|j|jfVdS)
Nz
config getz<section> <option>z/Get the value of the given option in "trac.ini"z
config removez<section> [<option>]z6Remove the specified option or section from "trac.ini"z
config setz<section> <option> <value>z0Set the value for the given option in "trac.ini")�_complete_config�_do_get�
_do_remove�_do_setr�r(r(r)�get_admin_commands�s���
�z%ConfigurationAdmin.get_admin_commandscCsFt|�dkr
|jjdd�St|�dkr!dd�|j|d��D�SdS)Nr�T)r��cSsg|]\}}|�qSr(r()r2r�r'r(r(r)r4�r5z7ConfigurationAdmin._complete_config.<locals>.<listcomp>r)r�r�r�r�)rP�argsr(r(r)r8�s
�z#ConfigurationAdmin._complete_configcCs6|j�||�sttd||d���t|j�||��dS)N�:Option '%(option)s' doesn't exist in section '%(section)s'�rarh)r�r�rrrrf�rPrhrar(r(r)r9�s��zConfigurationAdmin._do_getcCsb|j�|||�|dkrt|�r|jj|d�|j��|dkr-|dkr/|jjdd�dSdSdS)Nr�)r�r�r�Try)r�rjr
r�r�r~)rPrhrar'r(r(r)r;�s
�zConfigurationAdmin._do_setNcCs�|r|j�||�sttd||d���||jvrttd|d���|j�||�|j��|dkr<|dkr>|jjdd�dSdSdS)	Nr?r@z#Section '%(section)s' doesn't exist)rhr�r�Try)r�r�rrr�r�r~rAr(r(r)r:�s��

�
�zConfigurationAdmin._do_removerG)rVrWrXrHrrr<r8r9r;r:r(r(r(r)r7�sr7cCs�i}t�|j���D]\\}}}||�|i�|<q
g}|j�|j�D]F}g}|j�||j�D])\}}|�|i��|�}|rF|j	}	|�
|�}
nd}	t|�}
|�|||
|	kd��q.|j
dd�d�|�||d��q"|j
dd�d�|S)aXReturns a list of dictionaries containing the `name` and `options`
    of each configuration section. The value of `options` is a list of
    dictionaries containing the `name`, `value` and `modified` state of
    each configuration option. The `modified` value is True if the value
    differs from its default.

    :since: version 1.1.2
    r7)r�r'�modifiedcS�|dS�Nr�r()�or(r(r)�<lambda>��z get_configinfo.<locals>.<lambda>r3)r�r�cSrCrDr()�sr(r(r)rF�rG)rr�r�rEr]r�r�r�rfr�r�r:r��sort)�envr�rhr�rar�r�r'�
registeredr��
normalizedr(r(r)�get_configinfo�s*	�
�rMrG):rp�os.pathr�r=�configparserrrrr�
trac.adminrrr�rr	r
r�	trac.utilrr
�trac.util.compatr�trac.util.htmlr�trac.util.textrrrr�trac.util.translationrrrr�__all__�objectrgr*r-rFrMr#rZrr�rrrrrrrrr r!r"r7rMr(r(r(r)�<module>sJ
9(
5'J 05

https://t.me/RX1948 - 2025