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

Return func early if all parameters are satisfied by defaults #123

Open
lucyleeow opened this issue Nov 25, 2024 · 0 comments
Open

Return func early if all parameters are satisfied by defaults #123

lucyleeow opened this issue Nov 25, 2024 · 0 comments

Comments

@lucyleeow
Copy link
Contributor

Description

Discussed in #122

During injection, if a function with annotation but all of which are satisfied by a defaults, i.e. after

bound = sig.bind_partial(*args, **kwargs)
bound.apply_defaults()

we could bail early and just return the func, like we do when there are no annotations:

if (code and not code.co_argcount) and "return" not in getattr(
func, "__annotations__", {}
):
return func

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

No branches or pull requests

1 participant