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

Improve type of function callbacks in register_upgrade_function and register_downgrade_function #1445

Conversation

JeanChristopheMorinPerso
Copy link
Member

Link the Issue(s) this Pull Request is related to.

Fixes #1425

Summarize your change.

Improve the advertised types of the callback functions in register_upgrade_function and register_downgrade_function functions.

See https://pybind11.readthedocs.io/en/stable/advanced/cast/functional.html for the Pybind11 documentation of pybind11/functional.h.

The help on both functions previously looked like:

register_downgrade_function(...) method of builtins.PyCapsule instance
    register_downgrade_function(schema_name: str, version_to_downgrade_from: int, downgrade_function: object) -> bool

register_upgrade_function(...) method of builtins.PyCapsule instance
    register_upgrade_function(schema_name: str, version_to_downgrade_from: int, upgrade_function: object) -> bool

while now it looks like:

register_downgrade_function(...) method of builtins.PyCapsule instance
    register_downgrade_function(schema_name: str, version_to_downgrade_from: int, downgrade_function: Callable[[opentimelineio._otio.AnyDictionary], None]) -> bool

register_upgrade_function(...) method of builtins.PyCapsule instance
    register_upgrade_function(schema_name: str, version_to_downgrade_from: int, upgrade_function: Callable[[opentimelineio._otio.AnyDictionary], None]) -> bool

…egister_downgrade_function

Signed-off-by: Jean-Christophe Morin <[email protected]>
Copy link
Collaborator

@ssteinbach ssteinbach left a comment

Choose a reason for hiding this comment

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

Nice!

@ssteinbach ssteinbach added this to the Public Beta 16 milestone Oct 5, 2022
@meshula meshula merged commit b3879f9 into AcademySoftwareFoundation:main Oct 6, 2022
@JeanChristopheMorinPerso JeanChristopheMorinPerso deleted the std_function_callback branch October 6, 2022 04:21
MichaelPlug pushed a commit to MichaelPlug/OpenTimelineIO that referenced this pull request Aug 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve type hints for register_upgrade_function and register_downgrade_function
3 participants