Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add register_hooks utility #247

Closed
wants to merge 23 commits into from
Closed

Add register_hooks utility #247

wants to merge 23 commits into from

Conversation

RimRihana
Copy link
Contributor

@RimRihana RimRihana commented May 22, 2024

This PR implements the register_hook function:

  • It wraps the target method by adding the hook to be registered to the original target method
  • It also raises a TypeError in case the signatures accept different arguments

This PR also add a simple example that shows how to use the register_hook function.

@RimRihana RimRihana added the new feature New functionality label May 22, 2024
@RimRihana RimRihana self-assigned this May 22, 2024
CHANGELOG.md Outdated Show resolved Hide resolved
@RimRihana RimRihana force-pushed the dev_callables branch 3 times, most recently from a4611fc to 15b475f Compare May 29, 2024 14:09
@RimRihana RimRihana marked this pull request as draft May 29, 2024 14:11
@RimRihana RimRihana marked this pull request as ready for review May 29, 2024 14:15
@Scienfitz Scienfitz marked this pull request as draft June 3, 2024 09:03
@Scienfitz
Copy link
Collaborator

@RimRihana please publish this when you and Adrian are happy for this to be reviewed

@RimRihana RimRihana force-pushed the dev_callables branch 2 times, most recently from 7e80489 to 3cdf0da Compare June 5, 2024 09:26
@RimRihana RimRihana marked this pull request as ready for review June 5, 2024 09:27
CHANGELOG.md Outdated Show resolved Hide resolved
baybe/utils/basic.py Outdated Show resolved Hide resolved
baybe/utils/basic.py Outdated Show resolved Hide resolved
examples/Basics/callable.py Outdated Show resolved Hide resolved
baybe/utils/basic.py Outdated Show resolved Hide resolved
baybe/utils/basic.py Outdated Show resolved Hide resolved
tests/test_utils.py Outdated Show resolved Hide resolved
baybe/utils/basic.py Show resolved Hide resolved
baybe/utils/basic.py Outdated Show resolved Hide resolved
baybe/utils/basic.py Outdated Show resolved Hide resolved
baybe/utils/basic.py Outdated Show resolved Hide resolved
baybe/utils/basic.py Outdated Show resolved Hide resolved
baybe/utils/basic.py Outdated Show resolved Hide resolved
examples/Custom_Hooks/callable.py Outdated Show resolved Hide resolved
examples/Custom_Hooks/callable.py Outdated Show resolved Hide resolved
examples/Custom_Hooks/callable.py Outdated Show resolved Hide resolved
examples/Custom_Hooks/callable.py Outdated Show resolved Hide resolved
examples/Custom_Hooks/callable.py Outdated Show resolved Hide resolved
@RimRihana RimRihana force-pushed the dev_callables branch 2 times, most recently from 7f88bab to 46219bc Compare June 11, 2024 12:50
examples/Custom_Hooks/callable.py Outdated Show resolved Hide resolved
examples/Custom_Hooks/callable.py Outdated Show resolved Hide resolved
@AdrianSosic AdrianSosic changed the title Add register_callable() Add register_hooks utility Jun 12, 2024
CHANGELOG.md Show resolved Hide resolved
examples/Custom_Hooks/basics.py Outdated Show resolved Hide resolved
examples/Custom_Hooks/basics.py Outdated Show resolved Hide resolved
tests/test_utils.py Show resolved Hide resolved
Copy link
Collaborator

@AVHopp AVHopp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am sufficiently happy with this PR to accept it.

baybe/utils/basic.py Show resolved Hide resolved
baybe/utils/basic.py Show resolved Hide resolved
@AdrianSosic
Copy link
Collaborator

Closed in favor of #275 and #276

@AdrianSosic AdrianSosic deleted the dev_callables branch June 20, 2024 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature New functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants