Skip to content

Commit d759308

Browse files
authored
TYP: core.missing, ops.docstrings, internals.ops, internals.managers, io.html (#36959)
1 parent 5782dc0 commit d759308

File tree

5 files changed

+14
-25
lines changed

5 files changed

+14
-25
lines changed

pandas/core/internals/managers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1839,7 +1839,7 @@ def _consolidate(blocks):
18391839
gkey = lambda x: x._consolidate_key
18401840
grouper = itertools.groupby(sorted(blocks, key=gkey), gkey)
18411841

1842-
new_blocks = []
1842+
new_blocks: List[Block] = []
18431843
for (_can_consolidate, dtype), group_blocks in grouper:
18441844
merged_blocks = _merge_blocks(
18451845
list(group_blocks), dtype=dtype, can_consolidate=_can_consolidate

pandas/core/missing.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -717,8 +717,8 @@ def inner(invalid, limit):
717717
# just use forwards
718718
return f_idx
719719
else:
720-
b_idx = list(inner(invalid[::-1], bw_limit))
721-
b_idx = set(N - 1 - np.asarray(b_idx))
720+
b_idx_inv = list(inner(invalid[::-1], bw_limit))
721+
b_idx = set(N - 1 - np.asarray(b_idx_inv))
722722
if fw_limit == 0:
723723
return b_idx
724724

pandas/core/ops/docstrings.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from typing import Dict, Optional
55

66

7-
def _make_flex_doc(op_name, typ):
7+
def _make_flex_doc(op_name, typ: str):
88
"""
99
Make the appropriate substitutions for the given operation and class-typ
1010
into either _flex_doc_SERIES or _flex_doc_FRAME to return the docstring
@@ -22,10 +22,12 @@ def _make_flex_doc(op_name, typ):
2222
op_name = op_name.replace("__", "")
2323
op_desc = _op_descriptions[op_name]
2424

25+
op_desc_op = op_desc["op"]
26+
assert op_desc_op is not None # for mypy
2527
if op_name.startswith("r"):
26-
equiv = "other " + op_desc["op"] + " " + typ
28+
equiv = "other " + op_desc_op + " " + typ
2729
else:
28-
equiv = typ + " " + op_desc["op"] + " other"
30+
equiv = typ + " " + op_desc_op + " other"
2931

3032
if typ == "series":
3133
base_doc = _flex_doc_SERIES
@@ -39,8 +41,9 @@ def _make_flex_doc(op_name, typ):
3941
equiv=equiv,
4042
series_returns=op_desc["series_returns"],
4143
)
42-
if op_desc["series_examples"]:
43-
doc = doc_no_examples + op_desc["series_examples"]
44+
ser_example = op_desc["series_examples"]
45+
if ser_example:
46+
doc = doc_no_examples + ser_example
4447
else:
4548
doc = doc_no_examples
4649
elif typ == "dataframe":

pandas/io/html.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import numbers
99
import os
1010
import re
11-
from typing import Dict, List, Optional, Pattern, Sequence, Union
11+
from typing import Dict, List, Optional, Pattern, Sequence, Tuple, Union
1212

1313
from pandas._typing import FilePathOrBuffer
1414
from pandas.compat._optional import import_optional_dependency
@@ -435,7 +435,7 @@ def _expand_colspan_rowspan(self, rows):
435435
to subsequent cells.
436436
"""
437437
all_texts = [] # list of rows, each a list of str
438-
remainder = [] # list of (index, text, nrows)
438+
remainder: List[Tuple[int, str, int]] = [] # list of (index, text, nrows)
439439

440440
for tr in rows:
441441
texts = [] # the output for this row
@@ -910,6 +910,7 @@ def _parse(flavor, io, match, attrs, encoding, displayed_only, **kwargs):
910910
else:
911911
break
912912
else:
913+
assert retained is not None # for mypy
913914
raise retained
914915

915916
ret = []

setup.cfg

-15
Original file line numberDiff line numberDiff line change
@@ -202,18 +202,6 @@ check_untyped_defs=False
202202
[mypy-pandas.core.internals.construction]
203203
check_untyped_defs=False
204204

205-
[mypy-pandas.core.internals.managers]
206-
check_untyped_defs=False
207-
208-
[mypy-pandas.core.internals.ops]
209-
check_untyped_defs=False
210-
211-
[mypy-pandas.core.missing]
212-
check_untyped_defs=False
213-
214-
[mypy-pandas.core.ops.docstrings]
215-
check_untyped_defs=False
216-
217205
[mypy-pandas.core.resample]
218206
check_untyped_defs=False
219207

@@ -253,9 +241,6 @@ check_untyped_defs=False
253241
[mypy-pandas.io.formats.style]
254242
check_untyped_defs=False
255243

256-
[mypy-pandas.io.html]
257-
check_untyped_defs=False
258-
259244
[mypy-pandas.io.json._json]
260245
check_untyped_defs=False
261246

0 commit comments

Comments
 (0)