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

�*�^X�@sTdZddlmZddlmZGdd�dej�ZGdd�dej�ZGd	d
�d
e�Z	dS)z�TreeBuilder helper class.

TreeBuilders are used to build trees of various shapes or properties. This
can be extremely useful in testing for instance.
�)�absolute_import�)�errorsc@seZdZdZdS)�AlreadyBuildingz,The tree builder is already building a tree.N��__name__�
__module__�__qualname__Z_fmt�r
r
�4/usr/lib/python3/dist-packages/breezy/treebuilder.pyrsrc@seZdZdZdS)�NotBuildingzNot currently building a tree.Nrr
r
r
rr!src@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�TreeBuilderzUA TreeBuilder allows the creation of specific content in one tree at a
    time.
    cCsd|_d|_dS)zConstruct a TreeBuilder.NF)�_tree�
_root_done��selfr
r
r�__init__+szTreeBuilder.__init__cCs�|��|js$|j�ddd�d|_|D]X}|�d�rL|j�|dd��q(d}d	|�d
�|f}|j�|dd�|j�||�q(dS)aBuild recipe into the current tree.

        :param recipe: A sequence of paths. For each path, the corresponding
            path in the current tree is created and added. If the path ends in
            '/' then a directory is added, otherwise a regular file is added.
        �sroot-idZ	directoryT�/N����
scontents of %s%szutf-8�file)�_ensure_buildingrr�add�endswith�mkdir�encodeZput_file_bytes_non_atomic)rZrecipe�name�endZcontentr
r
r�build0s
zTreeBuilder.buildcCs|jdurt�dS)z:Raise NotBuilding if there is no current tree being built.N)rrrr
r
rrDs
zTreeBuilder._ensure_buildingcCs |��|j}d|_|��dS)z!Finish building the current tree.N)rrZunlock�rZtreer
r
r�finish_treeIszTreeBuilder.finish_treecCs"|jdurt�||_|j��dS)z�Start building on tree.

        :param tree: A tree to start building on. It must provide the
            MutableTree interface.
        N)rrZlock_tree_writer r
r
r�
start_treePs
zTreeBuilder.start_treeN)	rrr	�__doc__rrrr!r"r
r
r
rr
&sr
N)
r#Z
__future__rrrZBzrErrorrr�objectr
r
r
r
r�<module>s