Skip to content
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

TYP: enable disallow-untyped-decorators in CI #33455

Closed
simonjayhawkins opened this issue Apr 10, 2020 · 4 comments · Fixed by #43828
Closed

TYP: enable disallow-untyped-decorators in CI #33455

simonjayhawkins opened this issue Apr 10, 2020 · 4 comments · Fixed by #43828
Labels
Typing type annotations, mypy/pyright type checking
Milestone

Comments

@simonjayhawkins
Copy link
Member

xref #33160 (comment)

in order to ensure adding decorators or changing existing decorators don't lose types on our typed functions, we could enable this flag, after resolving the current violations. (expand details)

$ mypy pandas --disallow-untyped-decorators
pandas\core\window\numba_.py:58: error: Untyped decorator makes function "roll_apply" untyped
pandas\tseries\offsets.py:458: error: Untyped decorator makes function "freqstr" untyped
pandas\core\nanops.py:97: error: Untyped decorator makes function "f" untyped
pandas\core\nanops.py:477: error: Untyped decorator makes function "nansum" untyped
pandas\core\nanops.py:799: error: Untyped decorator makes function "nansem" untyped
pandas\core\nanops.py:849: error: Untyped decorator makes function "reduction" untyped
pandas\core\nanops.py:880: error: Untyped decorator makes function "nanargmax" untyped
pandas\core\nanops.py:916: error: Untyped decorator makes function "nanargmin" untyped
pandas\core\nanops.py:952: error: Untyped decorator makes function "nanskew" untyped
pandas\core\nanops.py:1036: error: Untyped decorator makes function "nankurt" untyped
pandas\core\nanops.py:1129: error: Untyped decorator makes function "nanprod" untyped
pandas\core\nanops.py:1309: error: Untyped decorator makes function "nancorr" untyped
pandas\core\nanops.py:1364: error: Untyped decorator makes function "nancov" untyped
pandas\core\apply.py:136: error: Untyped decorator makes function "dtypes" untyped
pandas\tseries\frequencies.py:333: error: Untyped decorator makes function "is_unique" untyped
pandas\tseries\frequencies.py:337: error: Untyped decorator makes function "is_unique_asi8" untyped
pandas\core\arrays\period.py:270: error: Untyped decorator makes function "dtype" untyped
pandas\core\base.py:198: error: Untyped decorator makes function "ndim" untyped
pandas\core\indexes\base.py:1619: error: Untyped decorator makes function "is_unique" untyped
pandas\core\indexes\base.py:1973: error: Untyped decorator makes function "inferred_type" untyped
pandas\core\indexes\base.py:1980: error: Untyped decorator makes function "is_all_dates" untyped
pandas\core\indexes\base.py:2021: error: Untyped decorator makes function "hasnans" untyped
pandas\core\indexes\base.py:3840: error: Untyped decorator makes function "array" untyped
pandas\core\arrays\integer.py:62: error: Untyped decorator makes function "is_signed_integer" untyped
pandas\core\arrays\integer.py:66: error: Untyped decorator makes function "is_unsigned_integer" untyped
pandas\core\arrays\integer.py:74: error: Untyped decorator makes function "numpy_dtype" untyped
pandas\core\arrays\integer.py:79: error: Untyped decorator makes function "kind" untyped
pandas\core\arrays\integer.py:83: error: Untyped decorator makes function "itemsize" untyped
pandas\core\arrays\integer.py:341: error: Untyped decorator makes function "dtype" untyped
pandas\core\arrays\categorical.py:497: error: Untyped decorator makes function "size" untyped
pandas\core\arrays\categorical.py:504: error: Untyped decorator makes function "itemsize" untyped
pandas\core\indexes\numeric.py:452: error: Untyped decorator makes function "is_unique" untyped
pandas\core\indexes\range.py:170: error: Untyped decorator makes function "_int64index" untyped
pandas\core\indexes\range.py:280: error: Untyped decorator makes function "nbytes" untyped
pandas\core\indexes\range.py:325: error: Untyped decorator makes function "is_monotonic_increasing" untyped
pandas\core\indexes\range.py:329: error: Untyped decorator makes function "is_monotonic_decreasing" untyped
pandas\core\indexes\multi.py:1133: error: Untyped decorator makes function "dtype" untyped
pandas\core\indexes\multi.py:1152: error: Untyped decorator makes function "nbytes" untyped
pandas\core\indexes\multi.py:1414: error: Untyped decorator makes function "inferred_type" untyped
pandas\core\indexes\multi.py:1450: error: Untyped decorator makes function "is_monotonic_increasing" untyped
pandas\core\indexes\multi.py:1474: error: Untyped decorator makes function "is_monotonic_decreasing" untyped
pandas\core\indexes\datetimes.py:279: error: Untyped decorator makes function "_is_dates_only" untyped
pandas\core\indexes\period.py:348: error: Untyped decorator makes function "_int64index" untyped
pandas\core\indexes\interval.py:384: error: Untyped decorator makes function "_multiindex" untyped
pandas\core\indexes\interval.py:388: error: Untyped decorator makes function "values" untyped
pandas\core\indexes\interval.py:430: error: Untyped decorator makes function "is_monotonic_decreasing" untyped
pandas\core\indexes\interval.py:1031: error: Untyped decorator makes function "intersection" untyped
pandas\core\groupby\ops.py:257: error: Untyped decorator makes function "is_monotonic" untyped
pandas\core\groupby\ops.py:270: error: Untyped decorator makes function "codes_info" untyped
pandas\core\groupby\ops.py:288: error: Untyped decorator makes function "ngroups" untyped
pandas\core\groupby\ops.py:298: error: Untyped decorator makes function "result_index" untyped
pandas\core\groupby\ops.py:818: error: Untyped decorator makes function "reconstructed_codes" untyped
pandas\core\groupby\grouper.py:395: error: Untyped decorator makes function "result_index" untyped
pandas\core\groupby\grouper.py:420: error: Untyped decorator makes function "groups" untyped
pandas\core\window\rolling.py:1802: error: Untyped decorator makes function "is_datetimelike" untyped
pandas\core\window\rolling.py:1808: error: Untyped decorator makes function "_on" untyped
pandas\tests\frame\methods\test_replace.py:14: error: Untyped decorator makes function "mix_ab" untyped
pandas\tests\frame\methods\test_replace.py:19: error: Untyped decorator makes function "mix_abc" untyped
Found 58 errors in 20 files (checked 987 source files)

@simonjayhawkins simonjayhawkins added the Typing type annotations, mypy/pyright type checking label Apr 10, 2020
@jbrockmendel
Copy link
Member

It looks like a lot of these come down to mypy not knowing that cache_readonly is property-like. could we make a stub file just for that?

@simonjayhawkins
Copy link
Member Author

sure.

i've got master...simonjayhawkins:cache_readonly that might help. can't remember if it works though!

@jbrockmendel
Copy link
Member

hmm looks like this mostly works, but doesn't play nicely with having some subclasses use property and others cache_readonly

@simonjayhawkins
Copy link
Member Author

but doesn't play nicely with having some subclasses use property and others cache_readonly

I would probably be in favour of adding ignores for these cases so that we can enable the disallow-untyped-decorators checks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Typing type annotations, mypy/pyright type checking
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants