pyroot_zen.entrypoints package

Submodules

pyroot_zen.entrypoints.at_cpp_lookup module

pyroot_zen.entrypoints.at_cpp_lookup.inject_after(hook)[source]

Signature: hook(name, module)

>>> foo = lambda name, module: None
>>> inject_after(foo)
>>> inject_after(foo)
Traceback (most recent call last):
...
ValueError: Hook name already used: <lambda>
pyroot_zen.entrypoints.at_cpp_lookup.inject_before(hook)[source]

Signature: hook(name)

>>> foo = lambda arg: None
>>> inject_before(foo)
>>> inject_before(foo)
Traceback (most recent call last):
...
ValueError: Hook name already used: <lambda>
pyroot_zen.entrypoints.at_cpp_lookup.remove(name)[source]
pyroot_zen.entrypoints.at_cpp_lookup.wrapper(func)[source]

pyroot_zen.entrypoints.at_roostats_lookup module

Apply hooks after the call from RooStats namespace. This has 2 forms:

  1. ROOT.RooStats.ProfileLikelihoodCalculator
  2. from ROOT.RooStats import ProfileLikelihoodCalculator
pyroot_zen.entrypoints.at_roostats_lookup.inject(hook)[source]
Hook signature:
attr = hook(attribute_name, retrieved_attr)
pyroot_zen.entrypoints.at_roostats_lookup.wrapper(old_getattribute)[source]

pyroot_zen.entrypoints.at_tobject_callable module

pyroot_zen.entrypoints.at_tobject_callable.hooked_TObject_callable(self, name)[source]
pyroot_zen.entrypoints.at_tobject_callable.inject(hook)[source]

The signature shoud be:

patched_caller = hook(class_name, attribute_name, original_caller)

pyroot_zen.entrypoints.at_tobject_setter module

pyroot_zen.entrypoints.at_tobject_setter.hooked_TObject_setter(*args)[source]

Shorten the setter to pythonic-descriptor

## Simple class >>> obj = ROOT.TH1F() >>> obj.name = ‘foo’ >>> obj.GetName() ‘foo’ >>> obj.nameTitle = ‘bar’, ‘baz’ # Setting by tuples >>> obj.non_existent_attribute = ‘foo’ Traceback (most recent call last): … AttributeError: ‘TH1F’ object has no attribute ‘non_existent_attribute’

Note: In this construction, duck-typing of the new attribute is forbidden, for ease-of-mind! Note: For special pointer-object like gPad, the hack is in _ExpandMacroFunction

## SetOwnership Usage: >> c = ROOT.TCanvas() >> c.ownership = False

Note: apply on top of above __setattr__ Note: Prefer not-auto so that user is in control.

pyroot_zen.entrypoints.at_tobject_setter.inject(hook)[source]

Inject the hook to apply to arguments before the actual setter call:

The signature shoud be:

new_setter = hook(class_name, attribute_name, original_setter)

Primary used to apply RooFit arglist/set patcher into setters, e.g., ModelConfig.SetSnapshot(RooArgSet)

Module contents

pyroot_zen.entrypoints.init()[source]