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__/ignores.cpython-39.pyc
a

�*�^��@s�dZddlmZddlZddlmZddlZddlZddlmZee	�d�ddl
mZgd	�Zd
d�Z
dd
�Zdd�Zdd�Ze�add�Zdd�Zdd�ZdS)zLists of ignore files, etc.�)�absolute_importN)�BytesIO�)�lazy_importzE
from breezy import (
    atomicfile,
    globbing,
    trace,
    )
)�bedding)
z*.az*.oz*.py[co]z*.soz	*.sw[nop]z*~z.#*z[#]*#�__pycache__zbzr-orphanscCs�t�}|��}z|�d��d�}Wnlty�|�d�}g}t|�D]B\}}z|�|�d��WqFty�t�d|d�YqF0qFYn0|D].}|�	d�}|r�|�
d�r�q�|�t�
|��q�|S)	z�Read in all of the lines in the file and turn it into an ignore list

    Continue in the case of utf8 decoding errors, and emit a warning when
    such and error is found. Optimise for the common case -- no decoding
    errors.
    �utf8�
�
�utf-8zA.bzrignore: On Line #%d, malformed utf8 character. Ignoring line.rz
�#)�set�read�decode�split�UnicodeDecodeError�	enumerate�appendZtraceZwarning�rstrip�
startswith�add�globbing�normalize_pattern)�f�ignoredZignore_fileZ
unicode_lines�linesZline_number�line�r�0/usr/lib/python3/dist-packages/breezy/ignores.py�parse_ignore_file7s,
��
rc
Cs�t��}tt�}zt|d�}Wn�ttfy�}zpt|dd�}|tj	fvrL�zt
t�Wn8ty�}z |jtjtj	fvr|�WYd}~n
d}~00|WYd}~Sd}~00zt
|�W|��S|��0dS)z9Get the list of user ignored files, possibly creating it.�rb�errnoN)r�user_ignore_config_pathr
�
USER_DEFAULTS�open�IOError�OSError�getattrr!ZENOENT�_set_user_ignores�EnvironmentErrorZEPERMr�close)�path�patternsr�e�errrrr�get_user_ignoresZs&�r/cCs\t��}t��t|d��.}|D]}|�|�d�d�q Wd�n1sN0YdS)a7Fill out the user ignore file with the given patterns

    This may raise an error if it doesn't have permission to
    write to the user ignore file.
    This is mostly used for testing, since it would be
    bad form to rewrite a user's ignore list.
    breezy only writes this file if it does not exist.
    �wbrr
N)rr"Zensure_config_dir_existsr$�write�encode)r,Zignore_pathr�patternrrrr(us
	r(cCs�t�}g}|D]*}t�|�}||vr|�|�|�|�q|sBgStt��d��.}|D]}|�|�	d�d�qVWd�n1s�0Y|S)z�Add entries to the user's ignore list if not present.

    :param new_ignores: A list of ignore patterns
    :return: The list of ignores that were added
    Zabrr
N)
r/rrrrr$rr"r1r2)Znew_ignoresrZto_add�ignorerr3rrr�add_unique_user_ignores�s

4r5cCst�t|��dS)a~Add some ignore patterns that only exists in memory.

    This is used by some plugins that want bzr to ignore files,
    but don't want to change a users ignore list.
    (Such as a conversion script that needs to ignore temporary files,
    but does not want to modify the project's ignore list.)

    :param ignores: A list or generator of ignore patterns.
    :return: None
    N)�_runtime_ignores�updater
)�ignoresrrr�add_runtime_ignores�sr9cCstS)z'Get the current set of runtime ignores.)r6rrrr�get_runtime_ignores�sr:c	CsJ|�|jj�}|�|�rdt|d��0}|��}|�d�dkr@d}nd}Wd�qr1sX0Ynd}tj�	�}t
|��}t|�}Wd�n1s�0Yt�
|d��f}|�|�t|�dkr�|�d�s�|�|�|D]&}||vr�|�|�	d	��|�|�q�Wd�n1�s0Y|�|jj��sF|�|jjg�dS)
a@Add more ignore patterns to the ignore file in a tree.
    If ignore file does not exist then it will be created.
    The ignore file will be automatically added under version control.

    :param tree: Working tree to update the ignore list.
    :param name_pattern_list: List of ignore patterns.
    :return: None
    r s
���r
N�r0rr)�abspathZ_formatZignore_filenameZhas_filenamer$r�find�os�linesepr2rrZ
atomicfileZ
AtomicFiler1�len�endswithZis_versionedr)	ZtreeZname_pattern_listZifnrZ
file_contents�newlineZsior8r3rrr�tree_ignores_add_patterns�s*

$

&

,rD)�__doc__Z
__future__rr!�iorr?Zbreezyr�globals�rr#rr/r(r5r
r6r9r:rDrrrr�<module>s"#