diff --git a/pandas/core/internals/managers.py b/pandas/core/internals/managers.py index a7a9a77bab3bc..0ec281bb0fdce 100644 --- a/pandas/core/internals/managers.py +++ b/pandas/core/internals/managers.py @@ -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 diff --git a/pandas/core/missing.py b/pandas/core/missing.py index f3229b2876e5d..f2ec04c1fc05d 100644 --- a/pandas/core/missing.py +++ b/pandas/core/missing.py @@ -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 diff --git a/pandas/core/ops/docstrings.py b/pandas/core/ops/docstrings.py index e3a68ad328d55..839bdbfb2444a 100644 --- a/pandas/core/ops/docstrings.py +++ b/pandas/core/ops/docstrings.py @@ -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 @@ -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 @@ -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": diff --git a/pandas/io/html.py b/pandas/io/html.py index 9a91b16e52723..1534e42d8fb5a 100644 --- a/pandas/io/html.py +++ b/pandas/io/html.py @@ -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 @@ -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 @@ -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 = [] diff --git a/setup.cfg b/setup.cfg index ee28646d722f2..6c65695f6bc4a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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 @@ -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