From 81352144758a6d2f9d38605bfada793ac1354b25 Mon Sep 17 00:00:00 2001 From: Simon Hawkins Date: Mon, 22 Jul 2019 23:24:32 +0100 Subject: [PATCH 1/7] TYPING: type hints for core.indexing --- pandas/core/indexing.py | 42 ++++++++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/pandas/core/indexing.py b/pandas/core/indexing.py index 5aee37bc3b833..5a3543cb0a320 100755 --- a/pandas/core/indexing.py +++ b/pandas/core/indexing.py @@ -1,8 +1,9 @@ import textwrap -from typing import Tuple +from typing import TYPE_CHECKING, List, Optional, Tuple, Union, cast import warnings import numpy as np +from numpy import ndarray from pandas._libs.indexing import _NDFrameIndexerBase from pandas._libs.lib import item_from_zerodim @@ -25,10 +26,15 @@ from pandas.core.dtypes.generic import ABCDataFrame, ABCSeries from pandas.core.dtypes.missing import _infer_fill_value, isna +from pandas._typing import Axis import pandas.core.common as com from pandas.core.index import Index, InvalidIndexError, MultiIndex from pandas.core.indexers import is_list_like_indexer, length_of_indexer +if TYPE_CHECKING: + from pandas.core.generic import NDFrame + from pandas import DataFrame, Series, DatetimeArray # noqa: F401 + # the supported indexers def get_indexers_list(): @@ -104,7 +110,7 @@ class _NDFrameIndexer(_NDFrameIndexerBase): _exception = Exception axis = None - def __call__(self, axis=None): + def __call__(self, axis: Optional[Axis] = None) -> "_NDFrameIndexer": # we need to return a copy of ourselves new_self = self.__class__(self.name, self.obj) @@ -193,7 +199,7 @@ def _get_setitem_indexer(self, key): raise raise IndexingError(key) - def __setitem__(self, key, value): + def __setitem__(self, key, value) -> None: if isinstance(key, tuple): key = tuple(com.apply_if_callable(x, self.obj) for x in key) else: @@ -260,7 +266,7 @@ def _convert_tuple(self, key, is_setter: bool = False): keyidx.append(idx) return tuple(keyidx) - def _convert_range(self, key, is_setter: bool = False): + def _convert_range(self, key: range, is_setter: bool = False) -> List[int]: """ convert a range argument """ return list(key) @@ -638,7 +644,9 @@ def _setitem_with_indexer_missing(self, indexer, value): self.obj._maybe_update_cacher(clear=True) return self.obj - def _align_series(self, indexer, ser, multiindex_indexer=False): + def _align_series( + self, indexer, ser: "Series", multiindex_indexer: bool = False + ) -> Union[ndarray, "DatetimeArray"]: """ Parameters ---------- @@ -734,7 +742,7 @@ def ravel(i): raise ValueError("Incompatible indexer with Series") - def _align_frame(self, indexer, df): + def _align_frame(self, indexer, df: "DataFrame") -> ndarray: is_frame = self.obj.ndim == 2 if isinstance(indexer, tuple): @@ -1328,12 +1336,12 @@ class _IXIndexer(_NDFrameIndexer): http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#ix-indexer-is-deprecated""" # noqa: E501 ) - def __init__(self, name, obj): + def __init__(self, name: str, obj: "NDFrame"): warnings.warn(self._ix_deprecation_warning, FutureWarning, stacklevel=2) super().__init__(name, obj) @Appender(_NDFrameIndexer._validate_key.__doc__) - def _validate_key(self, key, axis: int): + def _validate_key(self, key, axis: int) -> bool: if isinstance(key, slice): return True @@ -1349,7 +1357,7 @@ def _validate_key(self, key, axis: int): return True - def _convert_for_reindex(self, key, axis: int): + def _convert_for_reindex(self, key, axis: int) -> Union[Index, ndarray]: """ Transform a list of keys into a new array ready to be used as axis of the object we return (e.g. including NaNs). @@ -1418,7 +1426,7 @@ def _getitem_scalar(self, key): def _getitem_axis(self, key, axis: int): raise NotImplementedError() - def _getbool_axis(self, key, axis: int): + def _getbool_axis(self, key, axis: int) -> "NDFrame": # caller is responsible for ensuring non-None axis labels = self.obj._get_axis(axis) key = check_bool_indexer(labels, key) @@ -1428,7 +1436,7 @@ def _getbool_axis(self, key, axis: int): except Exception as detail: raise self._exception(detail) - def _get_slice_axis(self, slice_obj: slice, axis: int): + def _get_slice_axis(self, slice_obj: slice, axis: int) -> "NDFrame": """ this is pretty simple as we just have to deal with labels """ # caller is responsible for ensuring non-None axis obj = self.obj @@ -1694,7 +1702,7 @@ class _LocIndexer(_LocationIndexer): _exception = KeyError @Appender(_NDFrameIndexer._validate_key.__doc__) - def _validate_key(self, key, axis: int): + def _validate_key(self, key, axis: int) -> None: # valid for a collection of labels (we check their presence later) # slice of labels (where start-end in labels) @@ -1710,7 +1718,7 @@ def _validate_key(self, key, axis: int): if not is_list_like_indexer(key): self._convert_scalar_indexer(key, axis) - def _is_scalar_access(self, key: Tuple): + def _is_scalar_access(self, key: Tuple) -> bool: # this is a shortcut accessor to both .loc and .iloc # that provide the equivalent access of .at and .iat # a) avoid getting things via sections and (to minimize dtype changes) @@ -1737,13 +1745,14 @@ def _getitem_scalar(self, key): values = self.obj._get_value(*key) return values - def _get_partial_string_timestamp_match_key(self, key, labels): + def _get_partial_string_timestamp_match_key(self, key, labels: Index): """Translate any partial string timestamp matches in key, returning the new key (GH 10331)""" if isinstance(labels, MultiIndex): if isinstance(key, str) and labels.levels[0].is_all_dates: # Convert key '2016-01-01' to # ('2016-01-01'[, slice(None, None, None)]+) + key = cast(tuple, key) key = tuple([key] + [slice(None)] * (len(labels.levels) - 1)) if isinstance(key, tuple): @@ -1752,7 +1761,10 @@ def _get_partial_string_timestamp_match_key(self, key, labels): new_key = [] for i, component in enumerate(key): if isinstance(component, str) and labels.levels[i].is_all_dates: - new_key.append(slice(component, component, None)) + # error: No overload variant of "slice" matches argument + new_key.append( + slice(component, component, None) # type: ignore + ) else: new_key.append(component) key = tuple(new_key) From 06824a198fa5c81e6d39544319830e4824f00862 Mon Sep 17 00:00:00 2001 From: Simon Hawkins Date: Mon, 22 Jul 2019 23:25:52 +0100 Subject: [PATCH 2/7] add Any types autogenerated by MonkeyType --- pandas/core/indexing.py | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/pandas/core/indexing.py b/pandas/core/indexing.py index 5a3543cb0a320..9dadfad9ca987 100755 --- a/pandas/core/indexing.py +++ b/pandas/core/indexing.py @@ -1,5 +1,5 @@ import textwrap -from typing import TYPE_CHECKING, List, Optional, Tuple, Union, cast +from typing import TYPE_CHECKING, Any, List, Optional, Tuple, Union, cast import warnings import numpy as np @@ -94,7 +94,7 @@ class _IndexSlice: B1 10 11 """ - def __getitem__(self, arg): + def __getitem__(self, arg: Any) -> Any: return arg @@ -116,13 +116,14 @@ def __call__(self, axis: Optional[Axis] = None) -> "_NDFrameIndexer": if axis is not None: axis = self.obj._get_axis_number(axis) + axis = cast(int, axis) new_self.axis = axis return new_self def __iter__(self): raise NotImplementedError("ix is not iterable") - def __getitem__(self, key): + def __getitem__(self, key: Any) -> Any: if type(key) is tuple: # Note: we check the type exactly instead of with isinstance # because NamedTuple is checked separately. @@ -199,7 +200,7 @@ def _get_setitem_indexer(self, key): raise raise IndexingError(key) - def __setitem__(self, key, value) -> None: + def __setitem__(self, key: Any, value: Any) -> None: if isinstance(key, tuple): key = tuple(com.apply_if_callable(x, self.obj) for x in key) else: @@ -270,7 +271,7 @@ def _convert_range(self, key: range, is_setter: bool = False) -> List[int]: """ convert a range argument """ return list(key) - def _convert_scalar_indexer(self, key, axis: int): + def _convert_scalar_indexer(self, key: Any, axis: int) -> Any: # if we are accessing via lowered dim, use the last dim ax = self.obj._get_axis(min(axis, self.ndim - 1)) # a scalar @@ -645,7 +646,7 @@ def _setitem_with_indexer_missing(self, indexer, value): return self.obj def _align_series( - self, indexer, ser: "Series", multiindex_indexer: bool = False + self, indexer: Any, ser: "Series", multiindex_indexer: bool = False ) -> Union[ndarray, "DatetimeArray"]: """ Parameters @@ -742,7 +743,7 @@ def ravel(i): raise ValueError("Incompatible indexer with Series") - def _align_frame(self, indexer, df: "DataFrame") -> ndarray: + def _align_frame(self, indexer: Any, df: "DataFrame") -> ndarray: is_frame = self.obj.ndim == 2 if isinstance(indexer, tuple): @@ -864,7 +865,7 @@ def _multi_take(self, tup): } return o._reindex_with_indexers(d, copy=True, allow_dups=True) - def _convert_for_reindex(self, key, axis: int): + def _convert_for_reindex(self, key: Any, axis: int) -> Any: return key def _handle_lowerdim_multi_index_axis0(self, tup): @@ -1341,7 +1342,7 @@ def __init__(self, name: str, obj: "NDFrame"): super().__init__(name, obj) @Appender(_NDFrameIndexer._validate_key.__doc__) - def _validate_key(self, key, axis: int) -> bool: + def _validate_key(self, key: Any, axis: int) -> bool: if isinstance(key, slice): return True @@ -1357,7 +1358,7 @@ def _validate_key(self, key, axis: int) -> bool: return True - def _convert_for_reindex(self, key, axis: int) -> Union[Index, ndarray]: + def _convert_for_reindex(self, key: Any, axis: int) -> Union[Index, ndarray]: """ Transform a list of keys into a new array ready to be used as axis of the object we return (e.g. including NaNs). @@ -1401,7 +1402,7 @@ def _convert_for_reindex(self, key, axis: int) -> Union[Index, ndarray]: class _LocationIndexer(_NDFrameIndexer): _exception = Exception - def __getitem__(self, key): + def __getitem__(self, key: Any) -> Any: if type(key) is tuple: key = tuple(com.apply_if_callable(x, self.obj) for x in key) if self._is_scalar_access(key): @@ -1426,7 +1427,9 @@ def _getitem_scalar(self, key): def _getitem_axis(self, key, axis: int): raise NotImplementedError() - def _getbool_axis(self, key, axis: int) -> "NDFrame": + def _getbool_axis( + self, key: Union[ndarray, "Series", Index, List[bool]], axis: int + ) -> "NDFrame": # caller is responsible for ensuring non-None axis labels = self.obj._get_axis(axis) key = check_bool_indexer(labels, key) @@ -1702,7 +1705,7 @@ class _LocIndexer(_LocationIndexer): _exception = KeyError @Appender(_NDFrameIndexer._validate_key.__doc__) - def _validate_key(self, key, axis: int) -> None: + def _validate_key(self, key: Any, axis: int) -> None: # valid for a collection of labels (we check their presence later) # slice of labels (where start-end in labels) @@ -1739,13 +1742,13 @@ def _is_scalar_access(self, key: Tuple) -> bool: return True - def _getitem_scalar(self, key): + def _getitem_scalar(self, key: Any) -> Any: # a fast-path to scalar access # if not, raise values = self.obj._get_value(*key) return values - def _get_partial_string_timestamp_match_key(self, key, labels: Index): + def _get_partial_string_timestamp_match_key(self, key: Any, labels: Index) -> Any: """Translate any partial string timestamp matches in key, returning the new key (GH 10331)""" if isinstance(labels, MultiIndex): @@ -1771,7 +1774,7 @@ def _get_partial_string_timestamp_match_key(self, key, labels: Index): return key - def _getitem_axis(self, key, axis: int): + def _getitem_axis(self, key: Any, axis: int) -> Any: key = item_from_zerodim(key) if is_iterator(key): key = list(key) @@ -2251,7 +2254,7 @@ class _AtIndexer(_ScalarAccessIndexer): _takeable = False - def _convert_key(self, key, is_setter: bool = False): + def _convert_key(self, key: Any, is_setter: bool = False) -> Any: """ require they keys to be the same type as the index (so we don't fallback) """ From e084af45eb0787c723deab588df319350cd85cc2 Mon Sep 17 00:00:00 2001 From: Simon Hawkins Date: Tue, 23 Jul 2019 23:56:10 +0100 Subject: [PATCH 3/7] ndarray -> np.ndarray --- pandas/core/indexing.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pandas/core/indexing.py b/pandas/core/indexing.py index 2782e5eadf1bc..fd69d3c2a562c 100755 --- a/pandas/core/indexing.py +++ b/pandas/core/indexing.py @@ -3,7 +3,6 @@ import warnings import numpy as np -from numpy import ndarray from pandas._libs.indexing import _NDFrameIndexerBase from pandas._libs.lib import item_from_zerodim @@ -647,7 +646,7 @@ def _setitem_with_indexer_missing(self, indexer, value): def _align_series( self, indexer: Any, ser: "Series", multiindex_indexer: bool = False - ) -> Union[ndarray, "DatetimeArray"]: + ) -> Union[np.ndarray, "DatetimeArray"]: """ Parameters ---------- @@ -743,7 +742,7 @@ def ravel(i): raise ValueError("Incompatible indexer with Series") - def _align_frame(self, indexer: Any, df: "DataFrame") -> ndarray: + def _align_frame(self, indexer: Any, df: "DataFrame") -> np.ndarray: is_frame = self.obj.ndim == 2 if isinstance(indexer, tuple): @@ -1358,7 +1357,7 @@ def _validate_key(self, key: Any, axis: int) -> bool: return True - def _convert_for_reindex(self, key: Any, axis: int) -> Union[Index, ndarray]: + def _convert_for_reindex(self, key: Any, axis: int) -> Union[Index, np.ndarray]: """ Transform a list of keys into a new array ready to be used as axis of the object we return (e.g. including NaNs). @@ -1428,7 +1427,7 @@ def _getitem_axis(self, key, axis: int): raise NotImplementedError() def _getbool_axis( - self, key: Union[ndarray, "Series", Index, List[bool]], axis: int + self, key: Union[np.ndarray, "Series", Index, List[bool]], axis: int ) -> "NDFrame": # caller is responsible for ensuring non-None axis labels = self.obj._get_axis(axis) From f76132c390edcd21d560a469a1589a663f10e8d6 Mon Sep 17 00:00:00 2001 From: Simon Hawkins Date: Wed, 24 Jul 2019 01:02:40 +0100 Subject: [PATCH 4/7] remove Any and cast --- pandas/core/indexing.py | 43 +++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/pandas/core/indexing.py b/pandas/core/indexing.py index fd69d3c2a562c..a4fc117ec9928 100755 --- a/pandas/core/indexing.py +++ b/pandas/core/indexing.py @@ -1,5 +1,5 @@ import textwrap -from typing import TYPE_CHECKING, Any, List, Optional, Tuple, Union, cast +from typing import TYPE_CHECKING, List, Optional, Tuple, Union import warnings import numpy as np @@ -93,7 +93,7 @@ class _IndexSlice: B1 10 11 """ - def __getitem__(self, arg: Any) -> Any: + def __getitem__(self, arg): return arg @@ -115,14 +115,13 @@ def __call__(self, axis: Optional[Axis] = None) -> "_NDFrameIndexer": if axis is not None: axis = self.obj._get_axis_number(axis) - axis = cast(int, axis) new_self.axis = axis return new_self def __iter__(self): raise NotImplementedError("ix is not iterable") - def __getitem__(self, key: Any) -> Any: + def __getitem__(self, key): if type(key) is tuple: # Note: we check the type exactly instead of with isinstance # because NamedTuple is checked separately. @@ -199,7 +198,7 @@ def _get_setitem_indexer(self, key): raise raise IndexingError(key) - def __setitem__(self, key: Any, value: Any) -> None: + def __setitem__(self, key, value) -> None: if isinstance(key, tuple): key = tuple(com.apply_if_callable(x, self.obj) for x in key) else: @@ -270,7 +269,7 @@ def _convert_range(self, key: range, is_setter: bool = False) -> List[int]: """ convert a range argument """ return list(key) - def _convert_scalar_indexer(self, key: Any, axis: int) -> Any: + def _convert_scalar_indexer(self, key, axis: int): # if we are accessing via lowered dim, use the last dim ax = self.obj._get_axis(min(axis, self.ndim - 1)) # a scalar @@ -645,7 +644,7 @@ def _setitem_with_indexer_missing(self, indexer, value): return self.obj def _align_series( - self, indexer: Any, ser: "Series", multiindex_indexer: bool = False + self, indexer, ser: "Series", multiindex_indexer: bool = False ) -> Union[np.ndarray, "DatetimeArray"]: """ Parameters @@ -742,7 +741,7 @@ def ravel(i): raise ValueError("Incompatible indexer with Series") - def _align_frame(self, indexer: Any, df: "DataFrame") -> np.ndarray: + def _align_frame(self, indexer, df: "DataFrame") -> np.ndarray: is_frame = self.obj.ndim == 2 if isinstance(indexer, tuple): @@ -864,7 +863,7 @@ def _multi_take(self, tup): } return o._reindex_with_indexers(d, copy=True, allow_dups=True) - def _convert_for_reindex(self, key: Any, axis: int) -> Any: + def _convert_for_reindex(self, key, axis: int): return key def _handle_lowerdim_multi_index_axis0(self, tup): @@ -1341,7 +1340,7 @@ def __init__(self, name: str, obj: "NDFrame"): super().__init__(name, obj) @Appender(_NDFrameIndexer._validate_key.__doc__) - def _validate_key(self, key: Any, axis: int) -> bool: + def _validate_key(self, key, axis: int) -> bool: if isinstance(key, slice): return True @@ -1357,7 +1356,7 @@ def _validate_key(self, key: Any, axis: int) -> bool: return True - def _convert_for_reindex(self, key: Any, axis: int) -> Union[Index, np.ndarray]: + def _convert_for_reindex(self, key, axis: int) -> Union[Index, np.ndarray]: """ Transform a list of keys into a new array ready to be used as axis of the object we return (e.g. including NaNs). @@ -1401,7 +1400,7 @@ def _convert_for_reindex(self, key: Any, axis: int) -> Union[Index, np.ndarray]: class _LocationIndexer(_NDFrameIndexer): _exception = Exception - def __getitem__(self, key: Any) -> Any: + def __getitem__(self, key): if type(key) is tuple: key = tuple(com.apply_if_callable(x, self.obj) for x in key) if self._is_scalar_access(key): @@ -1426,9 +1425,7 @@ def _getitem_scalar(self, key): def _getitem_axis(self, key, axis: int): raise NotImplementedError() - def _getbool_axis( - self, key: Union[np.ndarray, "Series", Index, List[bool]], axis: int - ) -> "NDFrame": + def _getbool_axis(self, key, axis: int) -> "NDFrame": # caller is responsible for ensuring non-None axis labels = self.obj._get_axis(axis) key = check_bool_indexer(labels, key) @@ -1704,7 +1701,7 @@ class _LocIndexer(_LocationIndexer): _exception = KeyError @Appender(_NDFrameIndexer._validate_key.__doc__) - def _validate_key(self, key: Any, axis: int) -> None: + def _validate_key(self, key, axis: int) -> None: # valid for a collection of labels (we check their presence later) # slice of labels (where start-end in labels) @@ -1741,21 +1738,22 @@ def _is_scalar_access(self, key: Tuple) -> bool: return True - def _getitem_scalar(self, key: Any) -> Any: + def _getitem_scalar(self, key): # a fast-path to scalar access # if not, raise values = self.obj._get_value(*key) return values - def _get_partial_string_timestamp_match_key(self, key: Any, labels: Index) -> Any: + def _get_partial_string_timestamp_match_key(self, key, labels: Index): """Translate any partial string timestamp matches in key, returning the new key (GH 10331)""" if isinstance(labels, MultiIndex): if isinstance(key, str) and labels.levels[0].is_all_dates: # Convert key '2016-01-01' to # ('2016-01-01'[, slice(None, None, None)]+) - key = cast(tuple, key) - key = tuple([key] + [slice(None)] * (len(labels.levels) - 1)) + list_items = [key] # type: List[Union[slice,str]] + list_items += [slice(None)] * (len(labels.levels) - 1) + key = tuple(list_items) if isinstance(key, tuple): # Convert (..., '2016-01-01', ...) in tuple to @@ -1763,7 +1761,6 @@ def _get_partial_string_timestamp_match_key(self, key: Any, labels: Index) -> An new_key = [] for i, component in enumerate(key): if isinstance(component, str) and labels.levels[i].is_all_dates: - # error: No overload variant of "slice" matches argument new_key.append( slice(component, component, None) # type: ignore ) @@ -1773,7 +1770,7 @@ def _get_partial_string_timestamp_match_key(self, key: Any, labels: Index) -> An return key - def _getitem_axis(self, key: Any, axis: int) -> Any: + def _getitem_axis(self, key, axis: int): key = item_from_zerodim(key) if is_iterator(key): key = list(key) @@ -2253,7 +2250,7 @@ class _AtIndexer(_ScalarAccessIndexer): _takeable = False - def _convert_key(self, key: Any, is_setter: bool = False) -> Any: + def _convert_key(self, key, is_setter: bool = False): """ require they keys to be the same type as the index (so we don't fallback) """ From 7ea090e88046610619b712202d79762d91f5f3b3 Mon Sep 17 00:00:00 2001 From: Simon Hawkins Date: Wed, 24 Jul 2019 02:48:42 +0100 Subject: [PATCH 5/7] add ignore to mypy errors from rebase --- pandas/core/indexing.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/core/indexing.py b/pandas/core/indexing.py index 4cb7870c293e6..c6df43586224b 100755 --- a/pandas/core/indexing.py +++ b/pandas/core/indexing.py @@ -867,7 +867,7 @@ def _handle_lowerdim_multi_index_axis0(self, tup: Tuple): axis = self.axis or 0 try: # fast path for series or for tup devoid of slices - return self._get_label(tup, axis=axis) + return self._get_label(tup, axis=axis) # type: ignore except TypeError: # slices are unhashable pass @@ -966,7 +966,7 @@ def _getitem_nested_tuple(self, tup: Tuple): # this is a series with a multi-index specified a tuple of # selectors axis = self.axis or 0 - return self._getitem_axis(tup, axis=axis) + return self._getitem_axis(tup, axis=axis) # type: ignore # handle the multi-axis by taking sections and reducing # this is iterative From e19292deb7a2005b5c132a3d90edd3d2d5b7be98 Mon Sep 17 00:00:00 2001 From: Simon Hawkins Date: Wed, 24 Jul 2019 03:10:08 +0100 Subject: [PATCH 6/7] add ignore for List concatenation problem --- pandas/core/indexing.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pandas/core/indexing.py b/pandas/core/indexing.py index c6df43586224b..19586d86b39dd 100755 --- a/pandas/core/indexing.py +++ b/pandas/core/indexing.py @@ -1747,9 +1747,10 @@ def _get_partial_string_timestamp_match_key(self, key, labels: Index): if isinstance(key, str) and labels.levels[0].is_all_dates: # Convert key '2016-01-01' to # ('2016-01-01'[, slice(None, None, None)]+) - list_items = [key] # type: List[Union[slice,str]] - list_items += [slice(None)] * (len(labels.levels) - 1) - key = tuple(list_items) + key = tuple( + # https://github.com/python/mypy/issues/5492 + [key] + [slice(None)] * (len(labels.levels) - 1) # type: ignore + ) if isinstance(key, tuple): # Convert (..., '2016-01-01', ...) in tuple to From 6a4c26b99c7333ae9e4d6c3a123f695d55132c3d Mon Sep 17 00:00:00 2001 From: Simon Hawkins Date: Wed, 24 Jul 2019 12:51:28 +0100 Subject: [PATCH 7/7] lint error --- pandas/core/indexing.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pandas/core/indexing.py b/pandas/core/indexing.py index 19586d86b39dd..9acafb89b856b 100755 --- a/pandas/core/indexing.py +++ b/pandas/core/indexing.py @@ -1749,7 +1749,8 @@ def _get_partial_string_timestamp_match_key(self, key, labels: Index): # ('2016-01-01'[, slice(None, None, None)]+) key = tuple( # https://github.com/python/mypy/issues/5492 - [key] + [slice(None)] * (len(labels.levels) - 1) # type: ignore + [key] + + [slice(None)] * (len(labels.levels) - 1) # type: ignore ) if isinstance(key, tuple):