-
-
Notifications
You must be signed in to change notification settings - Fork 19.1k
Zip Strict for pandas/core level files #62469 #62577
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -1091,7 +1091,7 @@ def _getitem_lowerdim(self, tup: tuple): | |||||||||||
|
||||||||||||
# Reverse tuple so that we are indexing along columns before rows | ||||||||||||
# and avoid unintended dtype inference. # GH60600 | ||||||||||||
for i, key in zip(range(len(tup) - 1, -1, -1), reversed(tup)): | ||||||||||||
for i, key in zip(range(len(tup) - 1, -1, -1), reversed(tup), strict=True): | ||||||||||||
if is_label_like(key) or is_list_like(key): | ||||||||||||
# We don't need to check for tuples here because those are | ||||||||||||
# caught by the _is_nested_tuple_indexer check above. | ||||||||||||
|
@@ -1357,7 +1357,7 @@ def _multi_take(self, tup: tuple): | |||||||||||
# GH 836 | ||||||||||||
d = { | ||||||||||||
axis: self._get_listlike_indexer(key, axis) | ||||||||||||
for (key, axis) in zip(tup, self.obj._AXIS_ORDERS) | ||||||||||||
for (key, axis) in zip(tup, self.obj._AXIS_ORDERS, strict=True) | ||||||||||||
} | ||||||||||||
return self.obj._reindex_with_indexers(d, allow_dups=True) | ||||||||||||
|
||||||||||||
|
@@ -1669,7 +1669,7 @@ def _has_valid_setitem_indexer(self, indexer) -> bool: | |||||||||||
if not isinstance(indexer, tuple): | ||||||||||||
indexer = _tuplify(self.ndim, indexer) | ||||||||||||
|
||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [nitpick] Consider adding a comment explaining why
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||||||||
for ax, i in zip(self.obj.axes, indexer): | ||||||||||||
for ax, i in zip(self.obj.axes, indexer, strict=False): | ||||||||||||
if isinstance(i, slice): | ||||||||||||
# should check the stop slice? | ||||||||||||
pass | ||||||||||||
|
@@ -1841,7 +1841,7 @@ def _decide_split_path(self, indexer, value) -> bool: | |||||||||||
# (not null slices) then we must take the split path, xref | ||||||||||||
# GH 10360, GH 27841 | ||||||||||||
if isinstance(indexer, tuple) and len(indexer) == len(self.obj.axes): | ||||||||||||
for i, ax in zip(indexer, self.obj.axes): | ||||||||||||
for i, ax in zip(indexer, self.obj.axes, strict=True): | ||||||||||||
if isinstance(ax, MultiIndex) and not ( | ||||||||||||
is_integer(i) or com.is_null_slice(i) | ||||||||||||
): | ||||||||||||
|
@@ -2036,7 +2036,7 @@ def _setitem_with_indexer_split_path(self, indexer, value, name: str): | |||||||||||
|
||||||||||||
elif len(ilocs) == len(value): | ||||||||||||
# We are setting multiple columns in a single row. | ||||||||||||
for loc, v in zip(ilocs, value): | ||||||||||||
for loc, v in zip(ilocs, value, strict=True): | ||||||||||||
self._setitem_single_column(loc, v, pi) | ||||||||||||
|
||||||||||||
elif len(ilocs) == 1 and com.is_null_slice(pi) and len(self.obj) == 0: | ||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -440,9 +440,7 @@ exclude = [ | |
"asv_bench/benchmarks/series_methods.py" = ["B905"] | ||
"pandas/_config/config.py" = ["B905"] | ||
"pandas/conftest.py" = ["B905"] | ||
"pandas/core/apply.py" = ["B905"] | ||
"pandas/core/array_algos/quantile.py" = ["B905"] | ||
"pandas/core/arraylike.py" = ["B905"] | ||
"pandas/core/arrays/arrow/array.py" = ["B905"] | ||
"pandas/core/arrays/base.py" = ["B905"] | ||
"pandas/core/arrays/categorical.py" = ["B905"] | ||
|
@@ -456,24 +454,19 @@ exclude = [ | |
"pandas/core/computation/expr.py" = ["B905"] | ||
"pandas/core/computation/ops.py" = ["B905"] | ||
"pandas/core/dtypes/missing.py" = ["B905"] | ||
"pandas/core/frame.py" = ["B905"] | ||
"pandas/core/generic.py" = ["B905"] | ||
"pandas/core/groupby/generic.py" = ["B905"] | ||
"pandas/core/groupby/groupby.py" = ["B905"] | ||
"pandas/core/groupby/grouper.py" = ["B905"] | ||
"pandas/core/groupby/ops.py" = ["B905"] | ||
"pandas/core/indexes/interval.py" = ["B905"] | ||
"pandas/core/indexes/multi.py" = ["B905"] | ||
"pandas/core/indexing.py" = ["B905"] | ||
"pandas/core/methods/to_dict.py" = ["B905"] | ||
"pandas/core/reshape/concat.py" = ["B905"] | ||
"pandas/core/reshape/encoding.py" = ["B905"] | ||
"pandas/core/reshape/melt.py" = ["B905"] | ||
"pandas/core/reshape/merge.py" = ["B905"] | ||
"pandas/core/reshape/pivot.py" = ["B905"] | ||
"pandas/core/reshape/reshape.py" = ["B905"] | ||
"pandas/core/series.py" = ["B905"] | ||
"pandas/core/sorting.py" = ["B905"] | ||
"pandas/core/strings/accessor.py" = ["B905"] | ||
"pandas/core/window/rolling.py" = ["B905"] | ||
"pandas/io/excel/_xlrd.py" = ["B905"] | ||
|
@@ -632,8 +625,6 @@ exclude = [ | |
"pandas/tests/window/test_cython_aggregations.py" = ["B905"] | ||
"pandas/tests/window/test_expanding.py" = ["B905"] | ||
"pandas/tests/window/test_rolling.py" = ["B905"] | ||
"pandas/util/_doctools.py" = ["B905"] | ||
"pandas/util/_validators.py" = ["B905"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. missed clean up in previous PR: #62540 |
||
"scripts/validate_unwanted_patterns.py" = ["B905"] | ||
|
||
[tool.ruff.lint.flake8-pytest-style] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider adding a comment explaining why
strict=False
is intentionally used here, as it deviates from the strict zip pattern being implemented throughout the codebase.Copilot uses AI. Check for mistakes.