Fixed type hint for patch_signals#36
Fixed type hint for patch_signals#36nicobako wants to merge 4 commits intostarfederation:developfrom
Conversation
|
This could be made more specific, but this PR isn't quite right. Signals can also be lists and dicts. I started making a helper for it in the action helper branch, but I haven't gotten back to work on it more. If we create a generic typealias for SignalValue like in that branch, then the proper annotation here would be something like like datastar-python/src/datastar_py/attributes/__init__.py Lines 103 to 111 in 3b9a5b8 |
|
Yeah, you are right, I didn't think of the case where the value could be a list or a dict. I just updated the PR to use |
|
Oh, lol. I thought I only had |
This is a small change to fix type hints for the
patch_signalsfunction.I believe that, if the signals is a
dict, then it needs to be json-encodable.Since you call
json.dumps()on line154, then it must be one of the basic types.From the
json.dumpsdocs:Thanks for the awesome python package!