Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Added hints to mesolve, sesolve, result, Qobj, QobjEvo.
The aim is not to pass static type checker, but to help the user with hints:
Qobj.__mul__
is typed to support product with scalar, not otherQobj
, (for which__matmul__
should be used.)e_ops
are hinted to dict but also support single operator, list, tuple...solver.options
claim it return a dict not_SolverOptions
(which is a subclass of dict.)None
type. (result.final_state
type isQobj
event if it isNone
when not saved.)I created alias types:
Maybe some alias for dimensions object could be useful?
Knowing that we have extension modules, I used numbers.Number for complex hoping it support jax or tensorflow's scalars. Also
Any
used in some place where other type support can be added such asQobj.__init__
.Some of the type hint features I used were only added in python 3.10. We still tests with python 3.9, but it's old enough that we can remove it (according to spec-0000).