-
Notifications
You must be signed in to change notification settings - Fork 0
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
Support type checking for launch arguments #68
Labels
enhancement
New feature or request
Comments
Don't think there is a solution here. This is similar to |
Actually, maybe there are some ways to do this: python/typeshed#8703 |
Consider adding a decorator?
https://github.com/chrisgrimm/better_partial |
See typing.ParamSpec |
ChatGPT suggestion from typing import Callable, TypeVar, ParamSpec
P = ParamSpec("P")
R = TypeVar("R")
def call_func(func: Callable[P, R], args: P.args) -> R:
return func(*args)
# Example usage
def add(a: int, b: int) -> int:
return a + b
result = call_func(add, (1, 2)) # ✅ Correct usage
# result = call_func(add, (1, 2, 3)) # ❌ Type checker will flag this as an error
# result = call_func(add, ("one", "two")) # ❌ Type checker will flag this as an error
print(result) # Output: 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No description provided.
The text was updated successfully, but these errors were encountered: