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

�*�^y�@sJdZddlmZdgZddlZddlmZee�d�Gdd�de�ZdS)	z9The core state needed to make use of bzr is managed here.�)�absolute_import�BzrLibraryStateN�)�lazy_importzl
from breezy import (
    cleanup,
    config,
    osutils,
    symbol_versioning,
    trace,
    ui,
    )
c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)ra�The state about how breezy has been configured.

    This is the core state needed to make use of bzr. The current instance is
    currently always exposed as breezy._global_state, but we desired to move
    to a point where no global state is needed at all.

    :ivar exit_stack: An ExitStack which can be used for cleanups that
        should occur when the use of breezy is completed. This is initialised
        in __enter__ and executed in __exit__.
    cCs&||_||_t��|_i|_d|_dS)aECreate library start for normal use of breezy.

        Most applications that embed breezy, including bzr itself, should just
        call breezy.initialize(), but it is possible to use the state class
        directly. The initialize() function provides sensible defaults for a
        CLI program, such as a text UI factory.

        More options may be added in future so callers should use named
        arguments.

        BzrLibraryState implements the Python 2.5 Context Manager protocol
        PEP343, and can be used with the with statement. Upon __enter__ the
        global variables in use by bzr are set, and they are cleared on
        __exit__.

        :param ui: A breezy.ui.ui_factory to use.
        :param trace: A breezy.trace.Config context manager to use, perhaps
            breezy.trace.DefaultConfig.
        FN)�_ui�_traceZconfigZCommandLineStoreZcmdline_overrides�
config_stores�started)�self�ui�trace�r
�6/usr/lib/python3/dist-packages/breezy/library_state.py�__init__4s

zBzrLibraryState.__init__cCs|js|��|S)N)r	�_start�r
r
r
r�	__enter__QszBzrLibraryState.__enter__cCs�t��|_tjddkr,|j�tjdd��|j�	�tj
j|_|j
dur^|j
tj
_|j
�	�tjdurptd��|t_d|_dS)zDo all initialization.��finalT)�overrideNzBreezy already initialized)Zcleanup�	ExitStack�
exit_stack�breezy�version_info�callbackZsymbol_versioningZsuppress_deprecation_warningsrrr�
ui_factory�_orig_uir�
_global_state�RuntimeErrorr	rr
r
rrVs

�





zBzrLibraryState._startcCs�|dur$|j��D]\}}|��q|j��t��t��t�	�|j
dur`|j
�ddd�|j�ddd�|j
t_dt_dS)NF)r�itemsZsave_changesr�closerZ_flush_stdout_stderrZ_flush_traceZosutilsZreport_extension_load_failuresr�__exit__rrrrrr)r
�exc_typeZexc_valZexc_tb�kZstorer
r
rr!ns


zBzrLibraryState.__exit__N)�__name__�
__module__�__qualname__�__doc__rrrr!r
r
r
rr(s
)	r'Z
__future__r�__all__rr�globals�objectrr
r
r
r�<module>s�