Skip to content

[pre-commit.ci] pre-commit autoupdate #55004

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ repos:
hooks:
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.285
rev: v0.0.287
hooks:
- id: ruff
args: [--exit-non-zero-on-fix]
Expand All @@ -34,7 +34,7 @@ repos:
alias: ruff-selected-autofixes
args: [--select, "ANN001,ANN204", --fix-only, --exit-non-zero-on-fix]
- repo: https://github.com/jendrikseipp/vulture
rev: 'v2.7'
rev: 'v2.9.1'
hooks:
- id: vulture
entry: python scripts/run_vulture.py
Expand Down Expand Up @@ -84,7 +84,7 @@ repos:
'--filter=-readability/casting,-runtime/int,-build/include_subdir,-readability/fn_size'
]
- repo: https://github.com/pylint-dev/pylint
rev: v3.0.0a6
rev: v3.0.0a7
hooks:
- id: pylint
stages: [manual]
Expand Down Expand Up @@ -124,7 +124,7 @@ repos:
types: [text] # overwrite types: [rst]
types_or: [python, rst]
- repo: https://github.com/sphinx-contrib/sphinx-lint
rev: v0.6.7
rev: v0.6.8
hooks:
- id: sphinx-lint
- repo: local
Expand Down
2 changes: 1 addition & 1 deletion asv_bench/benchmarks/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def time_setitem(self, multiple_chunks):
self.array[i] = "foo"

def time_setitem_list(self, multiple_chunks):
indexer = list(range(0, 50)) + list(range(-1000, 0, 50))
indexer = list(range(50)) + list(range(-1000, 0, 50))
self.array[indexer] = ["foo"] * len(indexer)

def time_setitem_slice(self, multiple_chunks):
Expand Down
4 changes: 2 additions & 2 deletions asv_bench/benchmarks/join_merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,14 +360,14 @@ class MergeCategoricals:
def setup(self):
self.left_object = DataFrame(
{
"X": np.random.choice(range(0, 10), size=(10000,)),
"X": np.random.choice(range(10), size=(10000,)),
"Y": np.random.choice(["one", "two", "three"], size=(10000,)),
}
)

self.right_object = DataFrame(
{
"X": np.random.choice(range(0, 10), size=(10000,)),
"X": np.random.choice(range(10), size=(10000,)),
"Z": np.random.choice(["jjj", "kkk", "sss"], size=(10000,)),
}
)
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/dtypes/dtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
from collections.abc import MutableMapping
from datetime import tzinfo

import pyarrow as pa # noqa: F811, TCH004
import pyarrow as pa # noqa: TCH004

from pandas._typing import (
Dtype,
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/indexes/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,5 +377,5 @@ def all_indexes_same(indexes) -> bool:


def default_index(n: int) -> RangeIndex:
rng = range(0, n)
rng = range(n)
return RangeIndex._simple_new(rng, name=None)
2 changes: 1 addition & 1 deletion pandas/tests/frame/methods/test_copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def test_copy_consolidates(self):
}
)

for i in range(0, 10):
for i in range(10):
df.loc[:, f"n_{i}"] = np.random.default_rng(2).integers(0, 100, size=55)

assert len(df._mgr.blocks) == 11
Expand Down
8 changes: 4 additions & 4 deletions pandas/tests/frame/methods/test_reset_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -788,15 +788,15 @@ def test_errorreset_index_rename(float_frame):


def test_reset_index_false_index_name():
result_series = Series(data=range(5, 10), index=range(0, 5))
result_series = Series(data=range(5, 10), index=range(5))
result_series.index.name = False
result_series.reset_index()
expected_series = Series(range(5, 10), RangeIndex(range(0, 5), name=False))
expected_series = Series(range(5, 10), RangeIndex(range(5), name=False))
tm.assert_series_equal(result_series, expected_series)

# GH 38147
result_frame = DataFrame(data=range(5, 10), index=range(0, 5))
result_frame = DataFrame(data=range(5, 10), index=range(5))
result_frame.index.name = False
result_frame.reset_index()
expected_frame = DataFrame(range(5, 10), RangeIndex(range(0, 5), name=False))
expected_frame = DataFrame(range(5, 10), RangeIndex(range(5), name=False))
tm.assert_frame_equal(result_frame, expected_frame)
2 changes: 1 addition & 1 deletion pandas/tests/frame/methods/test_sort_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -911,7 +911,7 @@ def test_sort_index_multiindex_sparse_column(self):
expected = DataFrame(
{
i: pd.array([0.0, 0.0, 0.0, 0.0], dtype=pd.SparseDtype("float64", 0.0))
for i in range(0, 4)
for i in range(4)
},
index=MultiIndex.from_product([[1, 2], [1, 2]]),
)
Expand Down
6 changes: 3 additions & 3 deletions pandas/tests/frame/test_constructors.py
Original file line number Diff line number Diff line change
Expand Up @@ -692,12 +692,12 @@ def test_constructor_error_msgs(self):
arr = np.array([[4, 5, 6]])
msg = r"Shape of passed values is \(1, 3\), indices imply \(1, 4\)"
with pytest.raises(ValueError, match=msg):
DataFrame(index=[0], columns=range(0, 4), data=arr)
DataFrame(index=[0], columns=range(4), data=arr)

arr = np.array([4, 5, 6])
msg = r"Shape of passed values is \(3, 1\), indices imply \(1, 4\)"
with pytest.raises(ValueError, match=msg):
DataFrame(index=[0], columns=range(0, 4), data=arr)
DataFrame(index=[0], columns=range(4), data=arr)

# higher dim raise exception
with pytest.raises(ValueError, match="Must pass 2-d input"):
Expand Down Expand Up @@ -2391,7 +2391,7 @@ def test_construct_with_two_categoricalindex_series(self):

def test_constructor_series_nonexact_categoricalindex(self):
# GH 42424
ser = Series(range(0, 100))
ser = Series(range(100))
ser1 = cut(ser, 10).value_counts().head(5)
ser2 = cut(ser, 10).value_counts().tail(5)
result = DataFrame({"1": ser1, "2": ser2})
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/groupby/test_groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -1928,7 +1928,7 @@ def test_pivot_table_values_key_error():
df = DataFrame(
{
"eventDate": date_range(datetime.today(), periods=20, freq="M").tolist(),
"thename": range(0, 20),
"thename": range(20),
}
)

Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/groupby/test_timegrouper.py
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,7 @@ def test_grouper_period_index(self):
result = period_series.groupby(period_series.index.month).sum()

expected = Series(
range(0, periods), index=Index(range(1, periods + 1), name=index.name)
range(periods), index=Index(range(1, periods + 1), name=index.name)
)
tm.assert_series_equal(result, expected)

Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/indexes/multi/test_partial_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def df():
dr = date_range("2016-01-01", "2016-01-03", freq="12H")
abc = ["a", "b", "c"]
mi = MultiIndex.from_product([dr, abc])
frame = DataFrame({"c1": range(0, 15)}, index=mi)
frame = DataFrame({"c1": range(15)}, index=mi)
return frame


Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/indexing/multiindex/test_getitem.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def test_frame_getitem_simple_key_error(
def test_tuple_string_column_names():
# GH#50372
mi = MultiIndex.from_tuples([("a", "aa"), ("a", "ab"), ("b", "ba"), ("b", "bb")])
df = DataFrame([range(0, 4), range(1, 5), range(2, 6)], columns=mi)
df = DataFrame([range(4), range(1, 5), range(2, 6)], columns=mi)
df["single_index"] = 0

df_flat = df.copy()
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/io/json/test_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -2044,7 +2044,7 @@ def test_read_json_dtype_backend(self, string_storage, dtype_backend, orient):
)

if orient == "values":
expected.columns = list(range(0, 8))
expected.columns = list(range(8))

tm.assert_frame_equal(result, expected)

Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/io/json/test_ujson.py
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,7 @@ def test_decode_floating_point(self, sign, float_number):
def test_encode_big_set(self):
s = set()

for x in range(0, 100000):
for x in range(100000):
s.add(x)

# Make sure no Exception is raised.
Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/io/test_parquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -1012,7 +1012,7 @@ def test_timezone_aware_index(self, request, pa, timezone_aware_date_list):
def test_filter_row_groups(self, pa):
# https://github.com/pandas-dev/pandas/issues/26551
pytest.importorskip("pyarrow")
df = pd.DataFrame({"a": list(range(0, 3))})
df = pd.DataFrame({"a": list(range(3))})
with tm.ensure_clean() as path:
df.to_parquet(path, engine=pa)
result = read_parquet(
Expand Down Expand Up @@ -1219,7 +1219,7 @@ def test_categorical(self, fp):
check_round_trip(df, fp)

def test_filter_row_groups(self, fp):
d = {"a": list(range(0, 3))}
d = {"a": list(range(3))}
df = pd.DataFrame(d)
with tm.ensure_clean() as path:
df.to_parquet(path, engine=fp, compression=None, row_group_offsets=1)
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 @@ -798,7 +798,7 @@ def test_missing_value_generator(self):
expected_values.insert(0, ".")
for t in types:
offset = valid_range[t][1]
for i in range(0, 27):
for i in range(27):
val = StataMissingValue(offset + 1 + i)
assert val.string == expected_values[i]

Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/reshape/test_cut.py
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ def test_cut_with_duplicated_index_lowest_included():
def test_cut_with_nonexact_categorical_indices():
# GH 42424

ser = Series(range(0, 100))
ser = Series(range(100))
ser1 = cut(ser, 10).value_counts().head(5)
ser2 = cut(ser, 10).value_counts().tail(5)
result = DataFrame({"1": ser1, "2": ser2})
Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/reshape/test_pivot.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def dropna(request):
return request.param


@pytest.fixture(params=[([0] * 4, [1] * 4), (range(0, 3), range(1, 4))])
@pytest.fixture(params=[([0] * 4, [1] * 4), (range(3), range(1, 4))])
def interval_values(request, closed):
left, right = request.param
return Categorical(pd.IntervalIndex.from_arrays(left, right, closed))
Expand Down Expand Up @@ -215,7 +215,7 @@ def test_pivot_table_dropna_categoricals(self, dropna):
{
"A": ["a", "a", "a", "b", "b", "b", "c", "c", "c"],
"B": [1, 2, 3, 1, 2, 3, 1, 2, 3],
"C": range(0, 9),
"C": range(9),
}
)

Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/series/methods/test_reindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,9 @@ def test_reindex_inference():

def test_reindex_downcasting():
# GH4618 shifted series downcasting
s = Series(False, index=range(0, 5))
s = Series(False, index=range(5))
result = s.shift(1).bfill()
expected = Series(False, index=range(0, 5))
expected = Series(False, index=range(5))
tm.assert_series_equal(result, expected)


Expand Down
6 changes: 3 additions & 3 deletions pandas/tests/window/test_rolling_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ def test_rolling_max_resample(step):
# So that we can have 3 datapoints on last day (4, 10, and 20)
indices.append(datetime(1975, 1, 5, 1))
indices.append(datetime(1975, 1, 5, 2))
series = Series(list(range(0, 5)) + [10, 20], index=indices)
series = Series(list(range(5)) + [10, 20], index=indices)
# Use floats instead of ints as values
series = series.map(lambda x: float(x))
# Sort chronologically
Expand Down Expand Up @@ -425,7 +425,7 @@ def test_rolling_min_resample(step):
# So that we can have 3 datapoints on last day (4, 10, and 20)
indices.append(datetime(1975, 1, 5, 1))
indices.append(datetime(1975, 1, 5, 2))
series = Series(list(range(0, 5)) + [10, 20], index=indices)
series = Series(list(range(5)) + [10, 20], index=indices)
# Use floats instead of ints as values
series = series.map(lambda x: float(x))
# Sort chronologically
Expand All @@ -445,7 +445,7 @@ def test_rolling_median_resample():
# So that we can have 3 datapoints on last day (4, 10, and 20)
indices.append(datetime(1975, 1, 5, 1))
indices.append(datetime(1975, 1, 5, 2))
series = Series(list(range(0, 5)) + [10, 20], index=indices)
series = Series(list(range(5)) + [10, 20], index=indices)
# Use floats instead of ints as values
series = series.map(lambda x: float(x))
# Sort chronologically
Expand Down