Skip to content

Modify define_function_handling_dict_from_class to inject function to module directly - #4752

Open
alejoe91 wants to merge 1 commit into
mainfrom
modify-define-function
Open

Modify define_function_handling_dict_from_class to inject function to module directly#4752
alejoe91 wants to merge 1 commit into
mainfrom
modify-define-function

Conversation

@alejoe91

@alejoe91 alejoe91 commented Sep 3, 2026

Copy link
Copy Markdown
Member

Having something like:

bandpass_filter = define_function_handling_dict_from_class(BandpassFilterRecording, name="bandpass_filter")

extends the function to work with individual recordings and dicts of. The function signature and name are set to match the class and provided name. This could cause mismatches in the naming.

This PR uses a trick to add the new wrapped function directly to the caller module.

Related to #4319 : I suggest we do the same for define_funtction_from_class (already 2 mismatches found!!!) and use the pyi approach that Graham suggested to make IDEs happy.

@chrishalcrow @grahamfindlay thoughts?

@alejoe91 alejoe91 added core Changes to core module refactor Refactor of code, with no change to functionality labels Sep 3, 2026
import zarr


def define_function_handling_dict_from_class(source_class, name):

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

rename register_* instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Changes to core module refactor Refactor of code, with no change to functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant