From 86f5ce26aa5511381a6de93de04884cff44c800b Mon Sep 17 00:00:00 2001 From: jbrockmendel Date: Tue, 21 Jan 2020 09:43:51 -0800 Subject: [PATCH 1/2] CLN: use more-correct isinstance check --- pandas/core/indexes/numeric.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/core/indexes/numeric.py b/pandas/core/indexes/numeric.py index 465f21da1278a..dcc23aee0025a 100644 --- a/pandas/core/indexes/numeric.py +++ b/pandas/core/indexes/numeric.py @@ -347,7 +347,7 @@ def _assert_safe_casting(cls, data, subarr): def _is_compatible_with_other(self, other): return super()._is_compatible_with_other(other) or all( - isinstance(type(obj), (ABCUInt64Index, ABCFloat64Index)) + isinstance(obj, (ABCUInt64Index, ABCFloat64Index)) for obj in [self, other] ) @@ -497,7 +497,7 @@ def isin(self, values, level=None): def _is_compatible_with_other(self, other): return super()._is_compatible_with_other(other) or all( isinstance( - type(obj), + obj, (ABCInt64Index, ABCFloat64Index, ABCUInt64Index, ABCRangeIndex), ) for obj in [self, other] From fdb904e48283cd58d42796411fa7c29f46a639f3 Mon Sep 17 00:00:00 2001 From: jbrockmendel Date: Tue, 21 Jan 2020 11:47:37 -0800 Subject: [PATCH 2/2] blackify --- pandas/core/indexes/numeric.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pandas/core/indexes/numeric.py b/pandas/core/indexes/numeric.py index dcc23aee0025a..fa79c1f1a528f 100644 --- a/pandas/core/indexes/numeric.py +++ b/pandas/core/indexes/numeric.py @@ -347,8 +347,7 @@ def _assert_safe_casting(cls, data, subarr): def _is_compatible_with_other(self, other): return super()._is_compatible_with_other(other) or all( - isinstance(obj, (ABCUInt64Index, ABCFloat64Index)) - for obj in [self, other] + isinstance(obj, (ABCUInt64Index, ABCFloat64Index)) for obj in [self, other] ) @@ -497,8 +496,7 @@ def isin(self, values, level=None): def _is_compatible_with_other(self, other): return super()._is_compatible_with_other(other) or all( isinstance( - obj, - (ABCInt64Index, ABCFloat64Index, ABCUInt64Index, ABCRangeIndex), + obj, (ABCInt64Index, ABCFloat64Index, ABCUInt64Index, ABCRangeIndex), ) for obj in [self, other] )