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

[Feature]: Add a post_init method to get_class #1072

Closed
h-mayorquin opened this issue Mar 19, 2024 · 1 comment · Fixed by #1089
Closed

[Feature]: Add a post_init method to get_class #1072

h-mayorquin opened this issue Mar 19, 2024 · 1 comment · Fixed by #1089
Assignees
Labels
category: enhancement improvements of code or code behavior priority: low alternative solution already working and/or relevant to only specific user(s)
Milestone

Comments

@h-mayorquin
Copy link

What would you like to see added to HDMF?

Extensions creates can build an API for their work using the following:

AClass = get_class("ObjectOnTheSpec", "ndx-extension")

It would be nice to have a mechanism to do checks with their arugments when using the get_class convenience method.

What solution would you like?

Something that looks like this:

def post_init(**init_kwargs):
    
    # Do the check here

ACheckedClass = get_class("ObjectOnTheSpec", "ndx-extension", post_init=post_init)

Do you have any interest in helping implement the feature?

No.

@bendichter
Copy link
Contributor

Following the syntax for post_init in Python dataclasses, let's use this call signature def post_init(self)

@mavaylon1 mavaylon1 added this to the Next Release milestone Mar 26, 2024
@rly rly added category: enhancement improvements of code or code behavior priority: low alternative solution already working and/or relevant to only specific user(s) labels Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: enhancement improvements of code or code behavior priority: low alternative solution already working and/or relevant to only specific user(s)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants