diff --git a/pandas/core/arrays/interval.py b/pandas/core/arrays/interval.py index 32c170ba29ef1..cf15f36cb03a3 100644 --- a/pandas/core/arrays/interval.py +++ b/pandas/core/arrays/interval.py @@ -1049,6 +1049,7 @@ def mid(self): points) and is either monotonic increasing or monotonic decreasing, else False. """ + # https://github.com/python/mypy/issues/1362 # Mypy does not support decorated properties @property # type: ignore diff --git a/pandas/core/internals/concat.py b/pandas/core/internals/concat.py index f02ad2102c15b..e25c4c2341217 100644 --- a/pandas/core/internals/concat.py +++ b/pandas/core/internals/concat.py @@ -443,7 +443,7 @@ def _is_uniform_join_units(join_units: List[JoinUnit]) -> bool: # cannot necessarily join return ( # all blocks need to have the same type - all(type(ju.block) is type(join_units[0].block) for ju in join_units) + all(isinstance(ju.block, type(join_units[0].block)) for ju in join_units) and # noqa # no blocks that would get missing values (can lead to type upcasts) # unless we're an extension dtype. diff --git a/pandas/core/series.py b/pandas/core/series.py index 74dcdaee327da..4ba9a0c925a5d 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -2584,10 +2584,7 @@ def append(self, to_append, ignore_index=False, verify_integrity=False): else: to_concat = [self, to_append] if any(isinstance(x, (ABCDataFrame,)) for x in to_concat[1:]): - msg = ( - f"to_append should be a Series or list/tuple of Series, " - f"got DataFrame" - ) + msg = "to_append should be a Series or list/tuple of Series, got DataFrame" raise TypeError(msg) return concat( to_concat, ignore_index=ignore_index, verify_integrity=verify_integrity diff --git a/pandas/tests/groupby/aggregate/test_numba.py b/pandas/tests/groupby/aggregate/test_numba.py index f23d7765eb508..726d79535184a 100644 --- a/pandas/tests/groupby/aggregate/test_numba.py +++ b/pandas/tests/groupby/aggregate/test_numba.py @@ -18,10 +18,10 @@ def incorrect_function(x): {"key": ["a", "a", "b", "b", "a"], "data": [1.0, 2.0, 3.0, 4.0, 5.0]}, columns=["key", "data"], ) - with pytest.raises(NumbaUtilError, match=f"The first 2"): + with pytest.raises(NumbaUtilError, match="The first 2"): data.groupby("key").agg(incorrect_function, engine="numba") - with pytest.raises(NumbaUtilError, match=f"The first 2"): + with pytest.raises(NumbaUtilError, match="The first 2"): data.groupby("key")["data"].agg(incorrect_function, engine="numba") diff --git a/pandas/tests/groupby/test_categorical.py b/pandas/tests/groupby/test_categorical.py index 4560c7385655d..f9e89d36084c6 100644 --- a/pandas/tests/groupby/test_categorical.py +++ b/pandas/tests/groupby/test_categorical.py @@ -502,9 +502,9 @@ def test_dataframe_categorical_ordered_observed_sort(ordered, observed, sort): aggr[aggr.isna()] = "missing" if not all(label == aggr): msg = ( - f"Labels and aggregation results not consistently sorted\n" - + "for (ordered={ordered}, observed={observed}, sort={sort})\n" - + "Result:\n{result}" + "Labels and aggregation results not consistently sorted\n" + f"for (ordered={ordered}, observed={observed}, sort={sort})\n" + f"Result:\n{result}" ) assert False, msg diff --git a/pandas/tests/groupby/transform/test_numba.py b/pandas/tests/groupby/transform/test_numba.py index e2b957f1a7ae7..9a4015ac983c5 100644 --- a/pandas/tests/groupby/transform/test_numba.py +++ b/pandas/tests/groupby/transform/test_numba.py @@ -17,10 +17,10 @@ def incorrect_function(x): {"key": ["a", "a", "b", "b", "a"], "data": [1.0, 2.0, 3.0, 4.0, 5.0]}, columns=["key", "data"], ) - with pytest.raises(NumbaUtilError, match=f"The first 2"): + with pytest.raises(NumbaUtilError, match="The first 2"): data.groupby("key").transform(incorrect_function, engine="numba") - with pytest.raises(NumbaUtilError, match=f"The first 2"): + with pytest.raises(NumbaUtilError, match="The first 2"): data.groupby("key")["data"].transform(incorrect_function, engine="numba") diff --git a/pandas/tests/io/test_stata.py b/pandas/tests/io/test_stata.py index e670e0cdf2ade..698b5417b471b 100644 --- a/pandas/tests/io/test_stata.py +++ b/pandas/tests/io/test_stata.py @@ -1861,7 +1861,7 @@ def test_writer_118_exceptions(self): @pytest.mark.parametrize("version", [105, 108, 111, 113, 114]) def test_backward_compat(version, datapath): data_base = datapath("io", "data", "stata") - ref = os.path.join(data_base, f"stata-compat-118.dta") + ref = os.path.join(data_base, "stata-compat-118.dta") old = os.path.join(data_base, f"stata-compat-{version}.dta") expected = pd.read_stata(ref) old_dta = pd.read_stata(old) diff --git a/setup.cfg b/setup.cfg index d0216a05a2268..ea3d4c67d9358 100644 --- a/setup.cfg +++ b/setup.cfg @@ -19,6 +19,7 @@ ignore = W504, # line break after binary operator E402, # module level import not at top of file E731, # do not assign a lambda expression, use a def + E741, # ambiguous variable name 'l' (GH#34150) C406, # Unnecessary list literal - rewrite as a dict literal. C408, # Unnecessary dict call - rewrite as a literal. C409, # Unnecessary list passed to tuple() - rewrite as a tuple literal.