From 2139bc590a6bbac3b2bc108001b309230d3f57a2 Mon Sep 17 00:00:00 2001 From: Brock Date: Wed, 7 Oct 2020 13:44:27 -0700 Subject: [PATCH 1/5] TYP: missing --- pandas/core/missing.py | 4 ++-- setup.cfg | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) 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/setup.cfg b/setup.cfg index ee28646d722f2..ca16417e2081c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -208,9 +208,6 @@ 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 From 6769ec86138d1fc7f8d84ec033eaccd5060f7507 Mon Sep 17 00:00:00 2001 From: Brock Date: Wed, 7 Oct 2020 13:48:05 -0700 Subject: [PATCH 2/5] TYP: ops.docstrings --- pandas/core/ops/docstrings.py | 13 ++++++++----- setup.cfg | 3 --- 2 files changed, 8 insertions(+), 8 deletions(-) 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/setup.cfg b/setup.cfg index ca16417e2081c..c028e84418e03 100644 --- a/setup.cfg +++ b/setup.cfg @@ -208,9 +208,6 @@ check_untyped_defs=False [mypy-pandas.core.internals.ops] check_untyped_defs=False -[mypy-pandas.core.ops.docstrings] -check_untyped_defs=False - [mypy-pandas.core.resample] check_untyped_defs=False From 1077dd8456671072dc5869f79161782672dab72f Mon Sep 17 00:00:00 2001 From: Brock Date: Wed, 7 Oct 2020 13:48:34 -0700 Subject: [PATCH 3/5] TYP: internals.ops --- setup.cfg | 3 --- 1 file changed, 3 deletions(-) diff --git a/setup.cfg b/setup.cfg index c028e84418e03..5b29fb4460c35 100644 --- a/setup.cfg +++ b/setup.cfg @@ -205,9 +205,6 @@ 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.resample] check_untyped_defs=False From beb5af73fce10c25ba82c276d48689f69b1617c3 Mon Sep 17 00:00:00 2001 From: Brock Date: Wed, 7 Oct 2020 13:52:38 -0700 Subject: [PATCH 4/5] TYP: io.html --- pandas/io/html.py | 5 +++-- setup.cfg | 3 --- 2 files changed, 3 insertions(+), 5 deletions(-) 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 5b29fb4460c35..c36e6482a96c2 100644 --- a/setup.cfg +++ b/setup.cfg @@ -244,9 +244,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 From 397d0d9015e765de42ea00d83b7b408588ba6601 Mon Sep 17 00:00:00 2001 From: Brock Date: Wed, 7 Oct 2020 13:54:56 -0700 Subject: [PATCH 5/5] TYP: internals.managers --- pandas/core/internals/managers.py | 2 +- setup.cfg | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) 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/setup.cfg b/setup.cfg index c36e6482a96c2..6c65695f6bc4a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -202,9 +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.resample] check_untyped_defs=False