Repository navigation
TYP: Type the options of lsmr and of the IVSystemGMM estimators with … - #843
Merged
Merged
Conversation
…TypedDicts The options that are passed on with ** had a union of value types, so mypy checked every parameter of the callee against the whole union and reported seven errors: five for scipy.sparse.linalg.lsmr in lsmr_annihilate, one for the weight matrix of IVSystemGMM and one for its covariance. - _LSMROptions lists the keyword arguments of lsmr. _options_key takes a Mapping, which a TypedDict is. - _WeightConfig and _KernelWeightConfig, and _GMMCovConfig and _GMMKernelCovConfig, list the options of the weight matrices and of the covariances of IVSystemGMM. Only the kernel estimators take kernel, bandwidth and optimal_bw, so the kernel estimator is constructed directly, and the others through GMM_W_EST and GMM_COV_EST as before. The public signatures are unchanged, and so are the estimators that are constructed and the options they receive.
find_constant is annotated to return an int, but returned a NumPy integer. The demeaning paths of PanelOLS returned the integer 0 as the weighted mean of the dependent variable of a model without a constant, where the return type is a float64 array; it is now the 0-d array np.array(0.0). fit uses that mean only if the model has a constant, so the results do not change.
Run mypy with pandas-stubs and scipy-stubs on pushes to main and on pull requests. The result is informational: new releases of mypy and of the stubs often add errors, so a failure does not fail the check. It adds a warning annotation with the number of errors, and the log lists them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
…TypedDicts
The options that are passed on with ** had a union of value types, so mypy
checked every parameter of the callee against the whole union and reported
seven errors: five for scipy.sparse.linalg.lsmr in lsmr_annihilate, one for
the weight matrix of IVSystemGMM and one for its covariance.
Mapping, which a TypedDict is.
_GMMKernelCovConfig, list the options of the weight matrices and of the
covariances of IVSystemGMM. Only the kernel estimators take kernel,
bandwidth and optimal_bw, so the kernel estimator is constructed directly,
and the others through GMM_W_EST and GMM_COV_EST as before.
The public signatures are unchanged, and so are the estimators that are
constructed and the options they receive.