Skip to content

Commit

Permalink
CI: Address linting errors in flake8 >= 3.8.1 (#34152)
Browse files Browse the repository at this point in the history
  • Loading branch information
mgmarino authored and pull[bot] committed Jan 4, 2021
1 parent fb3a140 commit b606c24
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 13 deletions.
1 change: 1 addition & 0 deletions pandas/core/arrays/interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/internals/concat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 1 addition & 4 deletions pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/groupby/aggregate/test_numba.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")


Expand Down
6 changes: 3 additions & 3 deletions pandas/tests/groupby/test_categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/groupby/transform/test_numba.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")


Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/io/test_stata.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit b606c24

Please sign in to comment.