pyroll-project / pyroll-core

PyRoll rolling simulation framework - core library.
https://pyroll.readthedocs.io
BSD 3-Clause "New" or "Revised" License
12 stars 7 forks source link

Hook Wrappers #74

Closed axtimhaus closed 1 year ago

axtimhaus commented 1 year ago

Implement hook wrapper functions (inspired by pluggy).

They take precedence over all other hook functions and allow to modify hook function results stemming from other places. They work as normal hook functions with trylast and tryfirst.

They must contain exactly one yield expression, the argument of yield, however, is ignored. It is just used to inject the lower level result value. Use a return statement to return the modified result. See the tests for examples.

Pay attention on:

There may be used multiple hook wrappers together in onion shell style.