-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
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) | ||||||||||||
|
|
||||||||||||
|
||||||||||||
| # Intentionally use strict=False here: in some cases, indexer may be shorter or longer | |
| # than self.obj.axes, and we want to ignore any extra elements rather than raise an error. | |
| # This is the only exception to the strict zip pattern in this codebase. |
| 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"] | ||
|
Contributor
Author
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=Falseis intentionally used here, as it deviates from the strict zip pattern being implemented throughout the codebase.