Skip to content

Commit 7b50a89

Browse files
committed
pre-commit issues
1 parent ed73262 commit 7b50a89

File tree

4 files changed

+12
-28
lines changed

4 files changed

+12
-28
lines changed

.pre-commit-config.yaml

-21
Original file line numberDiff line numberDiff line change
@@ -77,27 +77,6 @@ repos:
7777
--linelength=88,
7878
'--filter=-readability/casting,-runtime/int,-build/include_subdir,-readability/fn_size'
7979
]
80-
- repo: https://github.com/pycqa/pylint
81-
rev: v2.16.2
82-
hooks:
83-
- id: pylint
84-
stages: [manual]
85-
- repo: https://github.com/pycqa/pylint
86-
rev: v2.16.2
87-
hooks:
88-
- id: pylint
89-
alias: redefined-outer-name
90-
name: Redefining name from outer scope
91-
files: ^pandas/
92-
exclude: |
93-
(?x)
94-
^pandas/tests # keep excluded
95-
|/_testing/ # keep excluded
96-
|^pandas/util/_test_decorators\.py # keep excluded
97-
|^pandas/_version\.py # keep excluded
98-
|^pandas/conftest\.py # keep excluded
99-
args: [--disable=all, --enable=redefined-outer-name]
100-
stages: [manual]
10180
- repo: https://github.com/PyCQA/isort
10281
rev: 5.12.0
10382
hooks:

pandas/_libs/index.pyx

+10
Original file line numberDiff line numberDiff line change
@@ -902,6 +902,16 @@ cdef class SharedEngine:
902902
# for compat with IndexEngine
903903
pass
904904

905+
cpdef _update_from_sliced(self, ExtensionEngine other, reverse: bool):
906+
self.unique = other.unique
907+
self.need_unique_check = other.need_unique_check
908+
if not other.need_monotonic_check and (
909+
other.is_monotonic_increasing or other.is_monotonic_decreasing):
910+
self.need_monotonic_check = other.need_monotonic_check
911+
# reverse=True means the index has been reversed
912+
self.monotonic_inc = other.monotonic_dec if reverse else other.monotonic_inc
913+
self.monotonic_dec = other.monotonic_inc if reverse else other.monotonic_dec
914+
905915
@property
906916
def is_unique(self) -> bool:
907917
if self.need_unique_check:

pandas/core/indexes/base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5182,7 +5182,7 @@ def _getitem_slice(self: _IndexT, slobj: slice) -> _IndexT:
51825182
result = type(self)._simple_new(res, name=self._name)
51835183
if "_engine" in self._cache:
51845184
reverse = slobj.step is not None and slobj.step < 0
5185-
result._engine._update_from_sliced(self._engine, reverse=reverse)
5185+
result._engine._update_from_sliced(self._engine, reverse=reverse) # type: ignore[union-attr] # noqa: E501
51865186

51875187
return result
51885188

pandas/core/indexes/range.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -926,12 +926,7 @@ def _getitem_slice(self: RangeIndex, slobj: slice) -> RangeIndex:
926926
Fastpath for __getitem__ when we know we have a slice.
927927
"""
928928
res = self._range[slobj]
929-
result = type(self)._simple_new(res, name=self._name)
930-
if "_engine" in self._cache:
931-
reverse = slobj.step is not None and slobj.step < 0
932-
result._engine._update_from_sliced(self._engine, reverse=reverse)
933-
934-
return result
929+
return type(self)._simple_new(res, name=self._name)
935930

936931
@unpack_zerodim_and_defer("__floordiv__")
937932
def __floordiv__(self, other):

0 commit comments

Comments
 (0)