HEX
Server: Apache
System: Linux infong-uk86 4.4.400-icpu-106 #2 SMP Mon Sep 15 08:23:40 UTC 2025 x86_64
User: u44115835 (4976590)
PHP: 8.4.17
Disabled: NONE
Upload Files
File: //kunden/lib/python3/dist-packages/breezy/__pycache__/rules.cpython-39.pyc
a

�*�^a�@s�dZddlmZddlZddlmZmZmZmZm	Z	dZ
dZee�Z
daGdd	�d	ej�ZGd
d�de�ZGdd
�d
e�ZGdd�de�Zdd�Zdd�Ze�dS)zrRule-based definition of preferences for selected files in selected branches

See ``bzr help rules`` for details.
�)�absolute_importN�)�bedding�cmdline�errors�globbing�osutilsz	.bzrruleszname c@seZdZdZdd�ZdS)�UnknownRulesz)Unknown rules detected: %(unknowns_str)s.cCstjj|d�|�d�dS)Nz, )Zunknowns_str)r�BzrError�__init__�join)�self�unknowns�r�./usr/lib/python3/dist-packages/breezy/rules.pyr2szUnknownRules.__init__N)�__name__�
__module__�__qualname__Z_fmtrrrrrr	.sr	c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�_RulesSearcherz/An object that provides rule-based preferences.cCst|j��dS)z�Return the preferences for a path as name,value tuples.

        :param path: tree relative path
        :return: () if no rule matched, otherwise a sequence of name,value
          tuples.
        N)�NotImplementedError�	get_items)r
�pathrrrr9sz_RulesSearcher.get_itemscCst|j��dS)a�Return selected preferences for a path as name,value tuples.

        :param path: tree relative path
        :param names: the list of preferences to lookup
        :return: () if no rule matched, otherwise a sequence of name,value
          tuples. The sequence is the same length as names,
          tuple order matches the order in names, and
          undefined preferences are given the value None.
        N)r�get_selected_items)r
r�namesrrrrBs
z!_RulesSearcher.get_selected_itemscCs"|�||g�D]\}}|SdS)zlGet a single preference for a single file.

        :returns: The string preference value, or None.
        N)r)r
rZpreference_name�key�valuerrr�get_single_valueNsz_RulesSearcher.get_single_valueN)rrr�__doc__rrrrrrrr6s	rc@s$eZdZdd�Zdd�Zdd�ZdS)�_IniBasedRulesSearchercCs�tj|dd�|_|j��}g}i|_|D]>}|�t�r(t�|t	d��}|�
|�|D]}||j|<qVq(t|�t|�kr�dd�|D�}t|��n|r�t
�|�|_nd|_dS)z�Construct a _RulesSearcher based on an ini file.

        The content will be decoded as utf-8.

        :param inifile: the name of the file or a sequence of lines.
        zutf-8)�encodingNcSsg|]}|�t�s|�qSr)�
startswith�FILE_PREFS_PREFIX)�.0�srrr�
<listcomp>ls
�z3_IniBasedRulesSearcher.__init__.<locals>.<listcomp>)�	configobjZ	ConfigObj�_cfg�keys�pattern_to_sectionr r!r�split�FILE_PREFS_PREFIX_LEN�extend�lenr	rZ_OrderedGlobster�	_globster)r
ZinifileZsectionsZpatternsr#Z
file_patterns�fprrrrrZs 



z_IniBasedRulesSearcher.__init__cCsF|jdurdS|j�|�}|dur&dS|j|j|}t|���SdS)�See _RulesSearcher.get_items.Nr)r-�matchr&r(�tuple�items)r
r�pat�allrrrrts
z _IniBasedRulesSearcher.get_itemscsP|jdurdS|j�|�}|dur&dS|j|j|�t�fdd�|D��SdS)�&See _RulesSearcher.get_selected_items.Nrc3s|]}|��|�fVqdS�N)�get)r"�k�r4rr�	<genexpr>��z<_IniBasedRulesSearcher.get_selected_items.<locals>.<genexpr>)r-r0r&r(r1)r
rrr3rr9rrs
z)_IniBasedRulesSearcher.get_selected_itemsN�rrrrrrrrrrrXsrc@s$eZdZdd�Zdd�Zdd�ZdS)�_StackedRulesSearchercCs
||_dS)zwConstruct a _RulesSearcher based on a stack of other ones.

        :param searchers: a sequence of searchers.
        N)�	searchers)r
r>rrrr�sz_StackedRulesSearcher.__init__cCs&|jD]}|�|�}|r|SqdS)r/r)r>r)r
r�searcher�resultrrrr�s



z_StackedRulesSearcher.get_itemscCs(|jD]}|�||�}|r|SqdS)r5r)r>r)r
rrr?r@rrrr�s


z(_StackedRulesSearcher.get_selected_itemsNr<rrrrr=�sr=cCst�t��d�S)z#Return the default rules file path.Zrules)rZpathjoinrZ
config_dirrrrr�
rules_path�srAcCstt��adSr6)rrA�_per_user_searcherrrrr�reset_rules�srC)rZ
__future__rr%�rrrrrZRULES_TREE_FILENAMEr!r,r*rBr
r	�objectrrr=rArCrrrr�<module>s
"3