-
Notifications
You must be signed in to change notification settings - Fork 3
Description
As pointed out in #44 (comment), Python's typing.Literal
doesn't support floats. While this is technically something that should flagged by type checkers and not by docstub, we should still help deal with this.
Cases like {1, -1, 2, -2, inf, -inf, ‘fro’, ‘nuc’}
in numpy.linalg.matrix_norm seem sensible and there might be other cases, that use nan
or 0.0
. So their should be a way to keep using floats and possible other types in the docstring, but arrive at a valid type for stubs.
An idea from #43 (comment): something is both annotated inline and in a docstring, docstub currently uses the annotation in the docstring. However, we might want to reverse that. That way one could keep using {inf, -inf, ...}
in the docstring but type it inline as float | Literal[...]
.
cc @OriolAbril