Skip to content

Commit 7686bcf

Browse files
authored
TYP: enable reportUnknownMemberType (#1639)
* TYP: enable `reportUnknownMemberType` * simplify import * remove reportUnknownLambdaType and useLibraryCodeForTypes * add comment * more accurate ignores * matplotlib/matplotlib#31003 * pyright is pyright_strict
1 parent def7c89 commit 7686bcf

27 files changed

Lines changed: 195 additions & 200 deletions

‎.github/workflows/comment_commands.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ permissions:
88

99
env:
1010
# store mapping of commands to use with poetry
11-
RUN_COMMAND: '{"/pandas_nightly": "pytest --nightly", "/pyright_strict": "pyright_strict", "/mypy_nightly": "mypy --mypy_nightly"}'
11+
RUN_COMMAND: '{"/pandas_nightly": "pytest --nightly", "/mypy_nightly": "mypy --mypy_nightly"}'
1212
# store mapping of labels to display in the check runs
13-
DISPLAY_COMMAND: '{"/pandas_nightly": "Pandas nightly tests", "/pyright_strict": "Pyright strict tests", "/mypy_nightly": "Mypy nightly tests"}'
13+
DISPLAY_COMMAND: '{"/pandas_nightly": "Pandas nightly tests", "/mypy_nightly": "Mypy nightly tests"}'
1414

1515
jobs:
1616
optional_tests:
1717
name: "Optional tests run"
1818
runs-on: ubuntu-latest
1919
timeout-minutes: 10
2020
# if more commands are added, they will need to be added here too as we don't have access to env at this stage
21-
if: (github.event.issue.pull_request) && contains(fromJSON('["/pandas_nightly", "/pyright_strict", "/mypy_nightly"]'), github.event.comment.body)
21+
if: (github.event.issue.pull_request) && contains(fromJSON('["/pandas_nightly", "/mypy_nightly"]'), github.event.comment.body)
2222

2323
steps:
2424
- name: Get head sha, branch name and store value

‎.github/workflows/optional.yml‎

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,3 @@ jobs:
3838

3939
- name: Run mypy tests with mypy nightly
4040
run: poetry run poe mypy --mypy_nightly
41-
42-
pyright_strict:
43-
runs-on: ubuntu-latest
44-
timeout-minutes: 10
45-
46-
steps:
47-
- uses: actions/checkout@v5
48-
49-
- name: Install project dependencies
50-
uses: ./.github/setup
51-
with:
52-
os: ubuntu-latest
53-
python-version: '3.11'
54-
55-
- name: Run pyright tests with full strict mode
56-
run: poetry run poe pyright_strict

‎docs/tests.md‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,9 @@ The following tests are **optional**. Some of them are run by the CI but it is o
1818

1919
- Run pytest against pandas nightly: `poe pytest --nightly`
2020
- Use mypy nightly to validate the annotations: `poe mypy --mypy_nightly`
21-
- Use pyright in full strict mode: `poe pyright_strict`
2221
- Run stubtest to compare the installed pandas-stubs against pandas (this will fail): `poe stubtest`. If you have created an allowlist to ignore certain errors: `poe stubtest path_to_the_allow_list`
2322

2423
Among the tests above, the following can be run directly during a PR by commenting in the discussion.
2524

2625
- Run pytest against pandas nightly by commenting `/pandas_nightly`
2726
- Use mypy nightly to validate the annotations by commenting `/mypy_nightly`
28-
- Use pyright in full strict mode by commenting `/pyright_strict`

‎pandas-stubs/__init__.pyi‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,13 @@ from pandas.io.api import (
100100
HDFStore as HDFStore,
101101
read_clipboard as read_clipboard,
102102
read_csv as read_csv,
103+
read_excel as read_excel,
103104
read_feather as read_feather,
104105
read_fwf as read_fwf,
105106
read_hdf as read_hdf,
106107
read_html as read_html,
107108
read_json as read_json,
109+
read_orc as read_orc,
108110
read_parquet as read_parquet,
109111
read_pickle as read_pickle,
110112
read_sas as read_sas,
@@ -116,12 +118,6 @@ from pandas.io.api import (
116118
read_table as read_table,
117119
read_xml as read_xml,
118120
)
119-
from pandas.io.api import (
120-
read_excel as read_excel, # pyright: ignore[reportUnknownVariableType]
121-
)
122-
from pandas.io.api import (
123-
read_orc as read_orc, # pyright: ignore[reportUnknownVariableType]
124-
)
125121
from pandas.io.json._normalize import json_normalize as json_normalize
126122
from pandas.tseries import offsets as offsets
127123
from pandas.tseries.api import infer_freq as infer_freq

‎pandas-stubs/_libs/tslibs/nattype.pyi‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# pyright: strict
21
from datetime import (
32
datetime,
43
timedelta,

‎pandas-stubs/_libs/tslibs/timedeltas.pyi‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# pyright: strict
21
from datetime import (
32
date,
43
datetime,

‎pandas-stubs/_libs/tslibs/timestamps.pyi‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# pyright: strict
21
from datetime import (
32
date as _date,
43
datetime,

‎pandas-stubs/core/generic.pyi‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,7 @@ class NDFrame:
119119
@final
120120
def to_excel(
121121
self,
122-
excel_writer: ( # pyright: ignore[reportUnknownParameterType]
123-
FilePath | WriteExcelBuffer | ExcelWriter
124-
),
122+
excel_writer: FilePath | WriteExcelBuffer | ExcelWriter,
125123
sheet_name: _str = "Sheet1",
126124
na_rep: _str = "",
127125
float_format: _str | None = ...,

‎pandas-stubs/core/strings/accessor.pyi‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# pyright: strict
21
from builtins import slice as _slice
32
from collections.abc import (
43
Callable,

‎pandas-stubs/io/api.pyi‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,12 @@ from pandas.io.clipboards import read_clipboard as read_clipboard
22
from pandas.io.excel import (
33
ExcelFile as ExcelFile,
44
ExcelWriter as ExcelWriter,
5-
)
6-
from pandas.io.excel import (
7-
read_excel as read_excel, # pyright: ignore[reportUnknownVariableType]
5+
read_excel as read_excel,
86
)
97
from pandas.io.feather_format import read_feather as read_feather
108
from pandas.io.html import read_html as read_html
119
from pandas.io.json import read_json as read_json
12-
from pandas.io.orc import (
13-
read_orc as read_orc, # pyright: ignore[reportUnknownVariableType]
14-
)
10+
from pandas.io.orc import read_orc as read_orc
1511
from pandas.io.parquet import read_parquet as read_parquet
1612
from pandas.io.parsers import (
1713
read_csv as read_csv,

0 commit comments

Comments
 (0)