§
    cÌc1  ã                   óè   — d Z ddlZddlmZmZmZmZmZ dZdZ	 e
e	¦  «        Zda G d„ dej        ¦  «        Z G d	„ d
¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Zd„ Zd„ Z e¦   «          dS )zrRule-based definition of preferences for selected files in selected branches

See ``bzr help rules`` for details.
é    Né   )ÚbeddingÚcmdlineÚerrorsÚglobbingÚosutilsz	.bzrruleszname c                   ó   — e Zd ZdZd„ ZdS )ÚUnknownRulesz)Unknown rules detected: %(unknowns_str)s.c                 ón   — t           j                             | d                     |¦  «        ¬¦  «         d S )Nz, )Úunknowns_str)r   ÚBzrErrorÚ__init__Újoin)ÚselfÚunknownss     ú./usr/lib/python3/dist-packages/breezy/rules.pyr   zUnknownRules.__init__0   s/   € ÝŒ× Ò  °D·I²I¸hÑ4GÔ4GÐ ÑHÔHÐHÐHÐHó    N)Ú__name__Ú
__module__Ú__qualname__Ú_fmtr   © r   r   r
   r
   ,   s-   € € € € € à7€DðIð Ið Ið Ið Ir   r
   c                   ó$   — e Zd ZdZd„ Zd„ Zd„ ZdS )Ú_RulesSearcherz/An object that provides rule-based preferences.c                 ó*   — t          | j        ¦  «        ‚)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.
        )ÚNotImplementedErrorÚ	get_items)r   Úpaths     r   r   z_RulesSearcher.get_items7   s   € õ " $¤.Ñ1Ô1Ð1r   c                 ó*   — t          | j        ¦  «        ‚)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.
        )r   Úget_selected_items)r   r   Únamess      r   r    z!_RulesSearcher.get_selected_items@   s   € õ " $Ô"9Ñ:Ô:Ð:r   c                 óF   — |                       ||g¦  «        D ]\  }}|c S dS )zlGet a single preference for a single file.

        :returns: The string preference value, or None.
        N)r    )r   r   Úpreference_nameÚkeyÚvalues        r   Úget_single_valuez_RulesSearcher.get_single_valueL   s8   € ð
 ×1Ò1°$¸Ð8IÑJÔJð 	ð 	‰JˆC�ØˆLˆLˆLØˆtr   N)r   r   r   Ú__doc__r   r    r&   r   r   r   r   r   4   sG   € € € € € Ø9Ð9ð2ð 2ð 2ð
;ð 
;ð 
;ðð ð ð ð r   r   c                   ó    — e Zd Zd„ Zd„ Zd„ ZdS )Ú_IniBasedRulesSearcherc                 ó  — t          j        |d¬¦  «        | _        | j                             ¦   «         }g }i | _        |D ]a}|                     t          ¦  «        rEt          j        |t          d…         ¦  «        }| 
                    |¦  «         |D ]}|| j        |<   ŒŒbt          |¦  «        t          |¦  «        k     rd„ |D ¦   «         }t          |¦  «        ‚|rt          j        |¦  «        | _        dS d| _        dS )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.
        zutf-8)ÚencodingNc                 óF   — g | ]}|                      t          ¦  «        °|‘ŒS r   )Ú
startswithÚFILE_PREFS_PREFIX)Ú.0Úss     r   ú
<listcomp>z3_IniBasedRulesSearcher.__init__.<locals>.<listcomp>j   s@   € ð @ð @ð @˜aØ Ÿ|š|Õ,=Ñ>Ô>ð@˜ð @ð @ð @r   )Ú	configobjÚ	ConfigObjÚ_cfgÚkeysÚpattern_to_sectionr-   r.   r   ÚsplitÚFILE_PREFS_PREFIX_LENÚextendÚlenr
   r   Ú_OrderedGlobsterÚ	_globster)r   ÚinifileÚsectionsÚpatternsr0   Úfile_patternsÚfpr   s           r   r   z_IniBasedRulesSearcher.__init__X   s  € õ Ô'¨¸'ÐBÑBÔBˆŒ	Ø”9—>’>Ñ#Ô#ˆØˆØ"$ˆÔØð 	4ð 	4ˆAØ�|Š|Õ-Ñ.Ô.ð 4Ý '¤¨aÕ0EÐ0FÐ0FÔ.GÑ HÔ H�Ø—’ Ñ.Ô.Ð.Ø'ð 4ð 4�BØ23�DÔ+¨BÑ/Ð/øÝˆx‰=Œ=�3˜x™=œ=Ò(Ð(ð@ð @ 8ð @ñ @ô @ˆHå˜xÑ(Ô(Ð(Øð 	"Ý%Ô6°xÑ@Ô@ˆDŒNˆNˆNà!ˆDŒNˆNˆNr   c                 óÂ   — | j         €dS | j                              |¦  «        }|€dS | j        | j        |                  }t	          |                     ¦   «         ¦  «        S )úSee _RulesSearcher.get_items.Nr   )r<   Úmatchr4   r6   ÚtupleÚitems)r   r   ÚpatÚalls       r   r   z _IniBasedRulesSearcher.get_itemsr   sX   € àŒ>Ð!Ø�2ØŒn×"Ò" 4Ñ(Ô(ˆØˆ;Ø�2à”)˜DÔ3°CÔ8Ô9ˆCÝ˜Ÿš™œÑ%Ô%Ð%r   c                 ó¸   ‡— | j         €dS | j                              |¦  «        }|€dS | j        | j        |                  Št	          ˆfd„|D ¦   «         ¦  «        S )ú&See _RulesSearcher.get_selected_items.Nr   c              3   óF   •K  — | ]}|‰                      |¦  «        fV — Œd S ©N)Úget)r/   ÚkrH   s     €r   ú	<genexpr>z<_IniBasedRulesSearcher.get_selected_items.<locals>.<genexpr>†   s1   øè è € Ð8Ð8¨Q˜!˜SŸWšW Q™ZœZ˜Ð8Ð8Ð8Ð8Ð8Ð8r   )r<   rD   r4   r6   rE   )r   r   r!   rG   rH   s       @r   r    z)_IniBasedRulesSearcher.get_selected_items}   sf   ø€ àŒ>Ð!Ø�2ØŒn×"Ò" 4Ñ(Ô(ˆØˆ;Ø�2à”)˜DÔ3°CÔ8Ô9ˆCÝÐ8Ð8Ð8Ð8°%Ð8Ñ8Ô8Ñ8Ô8Ð8r   N©r   r   r   r   r   r    r   r   r   r)   r)   V   sA   € € € € € ð"ð "ð "ð4	&ð 	&ð 	&ð	9ð 	9ð 	9ð 	9ð 	9r   r)   c                   ó    — e Zd Zd„ Zd„ Zd„ ZdS )Ú_StackedRulesSearcherc                 ó   — || _         dS )zwConstruct a _RulesSearcher based on a stack of other ones.

        :param searchers: a sequence of searchers.
        N)Ú	searchers)r   rT   s     r   r   z_StackedRulesSearcher.__init__‹   s   € ð
 #ˆŒˆˆr   c                 óP   — | j         D ]}|                     |¦  «        }|r|c S ŒdS )rC   r   )rT   r   )r   r   ÚsearcherÚresults       r   r   z_StackedRulesSearcher.get_items’   sA   € àœð 	ð 	ˆHØ×'Ò'¨Ñ-Ô-ˆFØð Ø���ðàˆrr   c                 óR   — | j         D ]}|                     ||¦  «        }|r|c S ŒdS )rJ   r   )rT   r    )r   r   r!   rV   rW   s        r   r    z(_StackedRulesSearcher.get_selected_itemsš   sC   € àœð 	ð 	ˆHØ×0Ò0°°uÑ=Ô=ˆFØð Ø���ðàˆrr   NrP   r   r   r   rR   rR   ‰   sA   € € € € € ð#ð #ð #ðð ð ðð ð ð ð r   rR   c                  óN   — t          j        t          j        ¦   «         d¦  «        S )z#Return the default rules file path.Úrules)r   Úpathjoinr   Ú
config_dirr   r   r   Ú
rules_pathr]   £   s   € åÔ�GÔ.Ñ0Ô0°'Ñ:Ô:Ð:r   c                  ó<   — t          t          ¦   «         ¦  «        ad S rL   )r)   r]   Ú_per_user_searcherr   r   r   Úreset_rulesr`   ¨   s   € å/µ
±´Ñ=Ô=ÐÐÐr   )r'   r2   Ú r   r   r   r   r   ÚRULES_TREE_FILENAMEr.   r:   r8   r_   r   r
   r   r)   rR   r]   r`   r   r   r   ú<module>rc      sm  ðð"ð ð
 Ð Ð Ð ðð ð ð ð ð ð ð ð ð ð ð ð ð ð "Ð ð Ð Ø˜Ð-Ñ.Ô.Ð ð Ð ðIð Ið Ið Ið I�6”?ñ Iô Ið Iðð ð ð ð ñ ô ð ðD09ð 09ð 09ð 09ð 09˜^ñ 09ô 09ð 09ðfð ð ð ð ˜Nñ ô ð ð4;ð ;ð ;ð
>ð >ð >ð
 €�„€€€r   