-
Notifications
You must be signed in to change notification settings - Fork 140
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
In the example below blah is typed as any in pyright etc. Which destroys any type safety we have in a repo.
import weave
class ATestObj(weave.Object):
a: int
@weave.op
def a_test_add(self, b: int) -> int:
return self.a + b
d = ATestObj(a=1)
blah = d.a_test_add(b=2)Why is this the case? And why not use a simple t.cast in the decorator or helper to allow proper types?
def op(...) -> Callable[[Callable[P, R]], Callable[P, R]]:
def wrapper(func: Callable[P, R]) -> Callable[P, R]:
# ... existing logic ...
return cast(Callable[P, R], op_wrapper) # force casting
Weave Project Link
No response
Screenshots
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working