b.h.Hooks(dict) : class documentation

Part of bzrlib.hooks View In Hierarchy

Known subclasses: bzrlib.branch.BranchHooks, bzrlib.commands.CommandHooks, bzrlib.config._ConfigHooks, bzrlib.config._OldConfigHooks, bzrlib.info.InfoHooks, bzrlib.lock.LockHooks, bzrlib.merge.MergeHooks, bzrlib.msgeditor.MessageEditorHooks, bzrlib.plugins.launchpad.lp_propose.ProposeMergeHooks, bzrlib.smart.client.SmartClientHooks, bzrlib.smart.server.SmartServerHooks, bzrlib.status.StatusHooks, bzrlib.tests.transport_util.TransportHooks, bzrlib.version_info_formats.format_rio.RioVersionInfoBuilderHooks

A dictionary mapping hook name to a list of callables.

e.g. ['FOO'] Is the list of items to be called when the FOO hook is triggered.

Method __init__ Create a new hooks dictionary.
Method add_hook Add a hook point to this dictionary.
Method create_hook Create a hook which can have callbacks registered for it.
Method docs Generate the documentation for this Hooks instance.
Method get_hook_name Get the name for a_callable for UI display.
Method install_named_hook_lazy Install a_callable in to the hook hook_name lazily, and label it.
Method install_named_hook Install a_callable in to the hook hook_name, and label it name.
Method uninstall_named_hook Uninstall named hooks.
Method name_hook Associate name with a_callable to show users what is running.
def __init__(self, module=None, member_name=None):
Create a new hooks dictionary.
ParametersmoduleThe module from which this hooks dictionary should be loaded (used for lazy hooks)
member_nameName under which this hooks dictionary should be loaded. (used for lazy hooks)
def add_hook(self, name, doc, introduced, deprecated=None):
Add a hook point to this dictionary.
ParametersnameThe name of the hook, for clients to use when registering.
docThe docs for the hook.
introducedWhen the hook was introduced (e.g. (0, 15)).
deprecatedWhen the hook was deprecated, None for not-deprecated.
@symbol_versioning.deprecated_method(symbol_versioning.deprecated_in((2, 4)))
def create_hook(self, hook):
Create a hook which can have callbacks registered for it.
ParametershookThe hook to create. An object meeting the protocol of bzrlib.hooks.HookPoint. It's name is used as the key for future lookups.
def docs(self):
Generate the documentation for this Hooks instance.

This introspects all the individual hooks and returns their docs as well.

def get_hook_name(self, a_callable):
Get the name for a_callable for UI display.

If no name has been registered, the string 'No hook name' is returned. We use a fixed string rather than repr or the callables module because the code names are rarely meaningful for end users and this is not intended for debugging.

def install_named_hook_lazy(self, hook_name, callable_module, callable_member, name):
Install a_callable in to the hook hook_name lazily, and label it.
Parametershook_nameA hook name. See the __init__ method for the complete list of hooks.
callable_moduleName of the module in which the callable is present.
callable_memberMember name of the callable.
nameA name to associate the callable with, to show users what is running.
def install_named_hook(self, hook_name, a_callable, name):
Install a_callable in to the hook hook_name, and label it name.
Parametershook_nameA hook name. See the __init__ method for the complete list of hooks.
a_callableThe callable to be invoked when the hook triggers. The exact signature will depend on the hook - see the __init__ method for details on each hook.
nameA name to associate a_callable with, to show users what is running.
def uninstall_named_hook(self, hook_name, label):
Uninstall named hooks.
Parametershook_nameHook point name
labelLabel of the callable to uninstall
def name_hook(self, a_callable, name):
Associate name with a_callable to show users what is running.
API Documentation for Bazaar, generated by pydoctor at 2022-06-16 00:25:16.