b.l.BzrLibraryState(object) : class documentation

Part of bzrlib.library_state View In Hierarchy

The state about how bzrlib has been configured.

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

Instance Variablessaved_stateThe bzrlib.global_state at the time __enter__ was called.
cleanupsAn ObjectWithCleanups which can be used for cleanups that should occur when the use of bzrlib is completed. This is initialised in __enter__ and executed in __exit__.
Method __init__ Create library start for normal use of bzrlib.
Method __enter__ Undocumented
Method __exit__ Undocumented
Method _start Do all initialization.
def __init__(self, ui, trace):
Create library start for normal use of bzrlib.

Most applications that embed bzrlib, including bzr itself, should just call bzrlib.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__.

ParametersuiA bzrlib.ui.ui_factory to use.
traceA bzrlib.trace.Config context manager to use, perhaps bzrlib.trace.DefaultConfig.
def __enter__(self):
Undocumented
def _start(self):
Do all initialization.
def __exit__(self, exc_type, exc_val, exc_tb):
Undocumented
API Documentation for Bazaar, generated by pydoctor at 2017-12-15 00:15:45.