-
Notifications
You must be signed in to change notification settings - Fork 306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add type stub file for @wrapt.decorator
#2442
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Added a stub file containing type hint annotations for ``@wrapt.decorator``. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
[mypy] | ||
python_version = 3.9 | ||
pretty = true | ||
mypy_path = ./type_stubs | ||
exclude = (?x)( | ||
docs| | ||
\.run| | ||
\.tox | ||
/docs/ | ||
| /\.run/ | ||
| /\.tox/ | ||
) | ||
|
||
enable_error_code = ignore-without-code | ||
|
@@ -54,9 +55,6 @@ ignore_missing_imports = true | |
[mypy-setuptools.*] | ||
ignore_missing_imports = true | ||
|
||
[mypy-wrapt.*] | ||
ignore_missing_imports = true | ||
|
||
[mypy-plasmapy._dev.scm_version] | ||
ignore_errors = true | ||
|
||
|
@@ -68,9 +66,6 @@ ignore_errors = true | |
# gradually make PlasmaPy consistent with mypy's strict mode, we can | ||
# remove the disabled error codes file-by-file. | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All of the changes in this file made below this line were done automatically, as described in #2424. This PR is removing a lot of the mypy errors that we had been ignoring, while also uncovering some new errors for code that wasn't type checked because it depended on |
||
[mypy-plasmapy] | ||
disable_error_code = no-untyped-def | ||
|
||
[mypy-plasmapy.analysis.fit_functions] | ||
disable_error_code = assignment,attr-defined,misc,name-match,no-any-return,no-untyped-call,no-untyped-def,type-arg | ||
|
||
|
@@ -105,7 +100,7 @@ disable_error_code = arg-type,no-untyped-call,no-untyped-def | |
disable_error_code = no-untyped-call,no-untyped-def | ||
|
||
[mypy-plasmapy.analysis.time_series.excess_statistics] | ||
disable_error_code = no-untyped-call,no-untyped-def,var-annotated | ||
disable_error_code = no-untyped-def,var-annotated | ||
|
||
[mypy-plasmapy.analysis.time_series.running_moments] | ||
disable_error_code = name-match,no-untyped-call,no-untyped-def | ||
|
@@ -210,19 +205,19 @@ disable_error_code = assignment,attr-defined,call-overload,misc,name-defined,no- | |
disable_error_code = assignment,attr-defined,call-overload,misc,name-defined,no-untyped-call,no-untyped-def,syntax | ||
|
||
[mypy-plasmapy.formulary.collisions.tests.test_coulomb] | ||
disable_error_code = attr-defined,no-untyped-call,no-untyped-def | ||
disable_error_code = attr-defined,no-untyped-def | ||
|
||
[mypy-plasmapy.formulary.collisions.tests.test_dimensionless] | ||
disable_error_code = attr-defined,no-untyped-call,no-untyped-def | ||
disable_error_code = attr-defined,no-untyped-def | ||
|
||
[mypy-plasmapy.formulary.collisions.tests.test_frequencies] | ||
disable_error_code = attr-defined,no-untyped-call,no-untyped-def,union-attr | ||
|
||
[mypy-plasmapy.formulary.collisions.tests.test_lengths] | ||
disable_error_code = attr-defined,no-untyped-call,no-untyped-def | ||
disable_error_code = attr-defined,no-untyped-def | ||
|
||
[mypy-plasmapy.formulary.collisions.tests.test_misc] | ||
disable_error_code = attr-defined,no-untyped-call,no-untyped-def | ||
disable_error_code = attr-defined,no-untyped-def | ||
|
||
[mypy-plasmapy.formulary.densities] | ||
disable_error_code = assignment,attr-defined,misc,no-untyped-call,syntax | ||
|
@@ -270,58 +265,46 @@ disable_error_code = attr-defined,misc,no-any-return,no-redef,no-untyped-call,no | |
disable_error_code = attr-defined,misc,no-any-return,no-untyped-call,no-untyped-def,syntax,union-attr | ||
|
||
[mypy-plasmapy.formulary.tests.test_densities] | ||
disable_error_code = attr-defined,no-untyped-call,no-untyped-def | ||
disable_error_code = attr-defined,no-untyped-def | ||
|
||
[mypy-plasmapy.formulary.tests.test_dielectric] | ||
disable_error_code = no-untyped-def | ||
|
||
[mypy-plasmapy.formulary.tests.test_dimensionless] | ||
disable_error_code = attr-defined,no-untyped-call,no-untyped-def | ||
|
||
[mypy-plasmapy.formulary.tests.test_distribution] | ||
disable_error_code = attr-defined,no-untyped-def | ||
|
||
[mypy-plasmapy.formulary.tests.test_drifts] | ||
disable_error_code = no-untyped-def | ||
[mypy-plasmapy.formulary.tests.test_distribution] | ||
disable_error_code = attr-defined | ||
|
||
[mypy-plasmapy.formulary.tests.test_fermi_integral] | ||
disable_error_code = arg-type,attr-defined,no-untyped-def | ||
disable_error_code = arg-type,attr-defined | ||
|
||
[mypy-plasmapy.formulary.tests.test_frequencies] | ||
disable_error_code = attr-defined,no-untyped-call,no-untyped-def | ||
|
||
[mypy-plasmapy.formulary.tests.test_ionization] | ||
disable_error_code = no-untyped-def | ||
disable_error_code = attr-defined,no-untyped-def | ||
|
||
[mypy-plasmapy.formulary.tests.test_lengths] | ||
disable_error_code = attr-defined,no-untyped-call,no-untyped-def | ||
|
||
[mypy-plasmapy.formulary.tests.test_magnetostatics] | ||
disable_error_code = no-untyped-def | ||
disable_error_code = attr-defined,no-untyped-def | ||
|
||
[mypy-plasmapy.formulary.tests.test_mathematics] | ||
disable_error_code = no-untyped-def | ||
|
||
[mypy-plasmapy.formulary.tests.test_misc] | ||
disable_error_code = attr-defined,no-untyped-call,no-untyped-def | ||
disable_error_code = attr-defined,no-untyped-def | ||
|
||
[mypy-plasmapy.formulary.tests.test_plasma_frequency] | ||
disable_error_code = attr-defined,call-overload,no-untyped-call,no-untyped-def | ||
disable_error_code = attr-defined,call-overload,no-untyped-def | ||
|
||
[mypy-plasmapy.formulary.tests.test_quantum] | ||
disable_error_code = attr-defined,no-untyped-call,no-untyped-def | ||
|
||
[mypy-plasmapy.formulary.tests.test_radiation] | ||
disable_error_code = no-untyped-def | ||
|
||
[mypy-plasmapy.formulary.tests.test_relativity] | ||
disable_error_code = attr-defined,no-untyped-def | ||
|
||
[mypy-plasmapy.formulary.tests.test_speeds] | ||
disable_error_code = attr-defined,no-untyped-call,no-untyped-def | ||
disable_error_code = attr-defined,no-untyped-def | ||
|
||
[mypy-plasmapy.formulary.tests.test_thermal_speed] | ||
disable_error_code = attr-defined,no-untyped-call,no-untyped-def | ||
disable_error_code = attr-defined,no-untyped-def | ||
|
||
[mypy-plasmapy.formulary.tests.test_transport] | ||
disable_error_code = attr-defined,no-untyped-call,no-untyped-def | ||
|
@@ -345,7 +328,7 @@ disable_error_code = type-arg,var-annotated | |
disable_error_code = arg-type,assignment,misc,no-any-return,no-untyped-call,no-untyped-def,union-attr | ||
|
||
[mypy-plasmapy.particles.decorators] | ||
disable_error_code = arg-type,assignment,index,misc,no-any-return,no-untyped-call,no-untyped-def,operator,return-value,type-arg,union-attr,var-annotated | ||
disable_error_code = arg-type,assignment,call-arg,index,misc,no-any-return,no-untyped-call,no-untyped-def,operator,return-value,type-arg,union-attr,var-annotated | ||
|
||
[mypy-plasmapy.particles.ionization_state] | ||
disable_error_code = arg-type,assignment,call-overload,misc,no-any-return,no-untyped-call,no-untyped-def,operator,return-value,type-arg | ||
|
@@ -417,7 +400,7 @@ disable_error_code = misc,no-untyped-def | |
disable_error_code = misc,name-match,no-any-return,no-untyped-call,no-untyped-def,type-arg,var-annotated | ||
|
||
[mypy-plasmapy.plasma.plasma_base] | ||
disable_error_code = no-untyped-call,no-untyped-def,var-annotated | ||
disable_error_code = no-untyped-def,var-annotated | ||
|
||
[mypy-plasmapy.plasma.sources.openpmd_hdf5] | ||
disable_error_code = arg-type,no-untyped-call,no-untyped-def | ||
|
@@ -437,17 +420,14 @@ disable_error_code = no-untyped-def | |
[mypy-plasmapy.plasma.sources.tests.test_plasmablob] | ||
disable_error_code = attr-defined,no-untyped-def | ||
|
||
[mypy-plasmapy.plasma.tests.test_equilibria1d] | ||
disable_error_code = no-untyped-def | ||
|
||
[mypy-plasmapy.plasma.tests.test_grids] | ||
disable_error_code = abstract,no-untyped-call,no-untyped-def | ||
|
||
[mypy-plasmapy.plasma.tests.test_lundquist] | ||
disable_error_code = attr-defined,no-untyped-call,no-untyped-def | ||
disable_error_code = attr-defined,no-untyped-call | ||
|
||
[mypy-plasmapy.plasma.tests.test_plasma_base] | ||
disable_error_code = attr-defined,no-untyped-call,no-untyped-def | ||
disable_error_code = attr-defined,no-untyped-def | ||
|
||
[mypy-plasmapy.plasma.tests.test_plasma_factory] | ||
disable_error_code = attr-defined,no-untyped-def | ||
|
@@ -465,7 +445,7 @@ disable_error_code = attr-defined,misc,no-untyped-call,no-untyped-def,var-annota | |
disable_error_code = attr-defined,no-untyped-def | ||
|
||
[mypy-plasmapy.tests._helpers.tests.sample_functions] | ||
disable_error_code = misc,no-untyped-def,valid-type | ||
disable_error_code = no-untyped-def,valid-type | ||
|
||
[mypy-plasmapy.utils._pytest_helpers.pytest_helpers] | ||
disable_error_code = arg-type,assignment,attr-defined,no-untyped-call,no-untyped-def,type-arg,var-annotated | ||
|
@@ -477,7 +457,7 @@ disable_error_code = attr-defined,call-arg,no-untyped-def | |
disable_error_code = type-arg | ||
|
||
[mypy-plasmapy.utils.calculator] | ||
disable_error_code = arg-type,no-untyped-def | ||
disable_error_code = arg-type | ||
|
||
[mypy-plasmapy.utils.calculator.main_interface] | ||
disable_error_code = no-untyped-call,no-untyped-def | ||
|
@@ -501,7 +481,7 @@ disable_error_code = no-untyped-call,no-untyped-def | |
disable_error_code = arg-type,assignment,no-untyped-call,no-untyped-def,type-arg,var-annotated | ||
|
||
[mypy-plasmapy.utils.decorators.converter] | ||
disable_error_code = no-untyped-def | ||
disable_error_code = call-arg,no-untyped-call,no-untyped-def | ||
|
||
[mypy-plasmapy.utils.decorators.deprecation] | ||
disable_error_code = assignment,attr-defined,no-untyped-def | ||
|
@@ -519,7 +499,7 @@ disable_error_code = attr-defined,call-overload,index,misc,name-defined,no-untyp | |
disable_error_code = attr-defined,misc,no-untyped-def | ||
|
||
[mypy-plasmapy.utils.decorators.tests.test_deprecation] | ||
disable_error_code = no-untyped-call,no-untyped-def | ||
disable_error_code = misc,no-untyped-call | ||
|
||
[mypy-plasmapy.utils.decorators.tests.test_helpers] | ||
disable_error_code = no-untyped-call,no-untyped-def | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
__all__ = ["decorator"] | ||
|
||
from typing import Any, Callable, TypeVar | ||
|
||
_F = TypeVar("_F", bound=Callable[..., Any]) | ||
|
||
def decorator( | ||
wrapper: _F, | ||
enabled: Any = None, | ||
adapter: Any = None, | ||
proxy: Any = None, | ||
) -> _F: ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This corrects the paths to exclude when doing static type checking with mypy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Independent of the new stub file, correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, this is an independent change.