TYP: IntervalIndex.right/left might be infered as function
See original GitHub issue-
I have checked that this issue has not already been reported.
-
I have confirmed this bug exists on the latest version of pandas.
-
(optional) I have confirmed this bug exists on the master branch of pandas.
import pandas as pd
index: pd.IntervalIndex = pd.IntervalIndex.from_arrays([1], [2])
reveal_type(index)
reveal_type(index.right)
index.right.array
pyright
info: Type of "index" is "IntervalIndex"
info: Type of "index.right" is "() -> Index"
error: Cannot access member "array" for type "function"
Member "array" is unknown (reportFunctionMemberAccess)
mypy
note: Revealed type is 'pandas.core.indexes.interval.IntervalIndex'
note: Revealed type is 'Any'
Output of pd.show_versions()
INSTALLED VERSIONS
commit : 2cb96529396d93b46abab7bbc73a208e708c642e python : 3.9.4.final.0 python-bits : 64 OS : Linux OS-release : 4.13.0-36-generic Version : #40~16.04.1-Ubuntu SMP Fri Feb 16 23:25:58 UTC 2018 machine : x86_64 processor : x86_64 byteorder : little LC_ALL : None LANG : en_US.UTF-8 LOCALE : en_US.UTF-8
pandas : 1.2.4 numpy : 1.20.3 pytz : 2021.1 dateutil : 2.8.1 pip : 21.0.1 setuptools : 52.0.0 Cython : None pytest : 6.2.4 hypothesis : None sphinx : None blosc : None feather : None xlsxwriter : None lxml.etree : None html5lib : None pymysql : None psycopg2 : None jinja2 : None IPython : 7.23.1 pandas_datareader: None bs4 : None bottleneck : None fsspec : 2021.05.0 fastparquet : None gcsfs : None matplotlib : 3.4.2 numexpr : 2.7.3 odfpy : None openpyxl : None pandas_gbq : None pyarrow : None pyxlsb : None s3fs : None scipy : 1.6.3 sqlalchemy : None tables : 3.6.1 tabulate : None xarray : None xlrd : None xlwt : None numba : None
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (7 by maintainers)
applies to all untyped decorators, xref #33455
@hauntsaninja I think you are right 😃 There are still many mypy errors but they are actually legitimate errors. These errors were not triggered before because anything that uses
@cache_readonly
resulted in typeAny
.I think the best way forward is to fix the many type errors uncovered through this and then lie to mypy (
cache_readonly = property
)