From c21292e06aed8147ef68f91df9ecb38dd64e249d Mon Sep 17 00:00:00 2001 From: Simon Hawkins Date: Thu, 10 Oct 2019 22:46:01 +0100 Subject: [PATCH 1/2] TYPING: errors reported by mypy 0.730 --- pandas/compat/pickle_compat.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pandas/compat/pickle_compat.py b/pandas/compat/pickle_compat.py index b3c7b8a7c8b9f..fdb26663a6b97 100644 --- a/pandas/compat/pickle_compat.py +++ b/pandas/compat/pickle_compat.py @@ -68,7 +68,11 @@ def load_reduce(self): class _LoadSparseSeries: # To load a SparseSeries as a Series[Sparse] - def __new__(cls) -> "Series": + + # https://github.com/python/mypy/issues/1020 + # error: Incompatible return type for "__new__" (returns "Series", but must return + # a subtype of "_LoadSparseSeries") def __new__(cls) -> "Series": + def __new__(cls) -> "Series": # type: ignore from pandas import Series warnings.warn( @@ -82,7 +86,11 @@ def __new__(cls) -> "Series": class _LoadSparseFrame: # To load a SparseDataFrame as a DataFrame[Sparse] - def __new__(cls) -> "DataFrame": + + # https://github.com/python/mypy/issues/1020 + # error: Incompatible return type for "__new__" (returns "DataFrame", but must + # return a subtype of "_LoadSparseFrame") + def __new__(cls) -> "DataFrame": # type: ignore from pandas import DataFrame warnings.warn( From 240dee5574993448e06855e25c65d69e32d3f7ce Mon Sep 17 00:00:00 2001 From: Simon Hawkins Date: Thu, 10 Oct 2019 22:49:55 +0100 Subject: [PATCH 2/2] fix comment --- pandas/compat/pickle_compat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/compat/pickle_compat.py b/pandas/compat/pickle_compat.py index fdb26663a6b97..3a36713ccdbda 100644 --- a/pandas/compat/pickle_compat.py +++ b/pandas/compat/pickle_compat.py @@ -71,7 +71,7 @@ class _LoadSparseSeries: # https://github.com/python/mypy/issues/1020 # error: Incompatible return type for "__new__" (returns "Series", but must return - # a subtype of "_LoadSparseSeries") def __new__(cls) -> "Series": + # a subtype of "_LoadSparseSeries") def __new__(cls) -> "Series": # type: ignore from pandas import Series