Skip to content

TYP: core.missing, ops.docstrings, internals.ops, internals.managers, io.html #36959

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

Merged
merged 5 commits into from
Oct 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pandas/core/internals/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1845,7 +1845,7 @@ def _consolidate(blocks):
gkey = lambda x: x._consolidate_key
grouper = itertools.groupby(sorted(blocks, key=gkey), gkey)

new_blocks = []
new_blocks: List[Block] = []
for (_can_consolidate, dtype), group_blocks in grouper:
merged_blocks = _merge_blocks(
list(group_blocks), dtype=dtype, can_consolidate=_can_consolidate
Expand Down
4 changes: 2 additions & 2 deletions pandas/core/missing.py
Original file line number Diff line number Diff line change
Expand Up @@ -717,8 +717,8 @@ def inner(invalid, limit):
# just use forwards
return f_idx
else:
b_idx = list(inner(invalid[::-1], bw_limit))
b_idx = set(N - 1 - np.asarray(b_idx))
b_idx_inv = list(inner(invalid[::-1], bw_limit))
b_idx = set(N - 1 - np.asarray(b_idx_inv))
if fw_limit == 0:
return b_idx

Expand Down
13 changes: 8 additions & 5 deletions pandas/core/ops/docstrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing import Dict, Optional


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

op_desc_op = op_desc["op"]
assert op_desc_op is not None # for mypy
if op_name.startswith("r"):
equiv = "other " + op_desc["op"] + " " + typ
equiv = "other " + op_desc_op + " " + typ
else:
equiv = typ + " " + op_desc["op"] + " other"
equiv = typ + " " + op_desc_op + " other"

if typ == "series":
base_doc = _flex_doc_SERIES
Expand All @@ -39,8 +41,9 @@ def _make_flex_doc(op_name, typ):
equiv=equiv,
series_returns=op_desc["series_returns"],
)
if op_desc["series_examples"]:
doc = doc_no_examples + op_desc["series_examples"]
ser_example = op_desc["series_examples"]
if ser_example:
doc = doc_no_examples + ser_example
else:
doc = doc_no_examples
elif typ == "dataframe":
Expand Down
5 changes: 3 additions & 2 deletions pandas/io/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import numbers
import os
import re
from typing import Dict, List, Optional, Pattern, Sequence, Union
from typing import Dict, List, Optional, Pattern, Sequence, Tuple, Union

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

for tr in rows:
texts = [] # the output for this row
Expand Down Expand Up @@ -910,6 +910,7 @@ def _parse(flavor, io, match, attrs, encoding, displayed_only, **kwargs):
else:
break
else:
assert retained is not None # for mypy
raise retained

ret = []
Expand Down
15 changes: 0 additions & 15 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -202,18 +202,6 @@ check_untyped_defs=False
[mypy-pandas.core.internals.construction]
check_untyped_defs=False

[mypy-pandas.core.internals.managers]
check_untyped_defs=False

[mypy-pandas.core.internals.ops]
check_untyped_defs=False

[mypy-pandas.core.missing]
check_untyped_defs=False

[mypy-pandas.core.ops.docstrings]
check_untyped_defs=False

[mypy-pandas.core.resample]
check_untyped_defs=False

Expand Down Expand Up @@ -253,9 +241,6 @@ check_untyped_defs=False
[mypy-pandas.io.formats.style]
check_untyped_defs=False

[mypy-pandas.io.html]
check_untyped_defs=False

[mypy-pandas.io.json._json]
check_untyped_defs=False

Expand Down