Skip to content

Commit 71a0675

Browse files
toobazjreback
authored andcommitted
CLN: Initialization coincides with mapping, hence with uniqueness check
- [x] tests added / passed - [x] passes ``git diff upstream/master | flake8 --diff`` Rebased version of pandas-dev#10229 which was [actually not](h ttps://github.com/pandas-dev/pull/10229#issuecomment-131470116) fixed by pandas-dev#10199. Nothing particular relevant, just wanted to delete this branch locally and noticed it still applies: you'll judge what to do of it. Author: Pietro Battiston <[email protected]> Closes pandas-dev#13594 from toobaz/fix_checkunique and squashes the following commits: a63bd12 [Pietro Battiston] CLN: Initialization coincides with mapping, hence with uniqueness check
1 parent 05b976c commit 71a0675

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

pandas/index.pyx

+3-8
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ cdef class IndexEngine:
8080

8181
cdef:
8282
bint unique, monotonic_inc, monotonic_dec
83-
bint initialized, monotonic_check, unique_check
83+
bint initialized, monotonic_check
8484

8585
def __init__(self, vgetter, n):
8686
self.vgetter = vgetter
@@ -91,7 +91,6 @@ cdef class IndexEngine:
9191
self.monotonic_check = 0
9292

9393
self.unique = 0
94-
self.unique_check = 0
9594
self.monotonic_inc = 0
9695
self.monotonic_dec = 0
9796

@@ -211,8 +210,8 @@ cdef class IndexEngine:
211210
property is_unique:
212211

213212
def __get__(self):
214-
if not self.unique_check:
215-
self._do_unique_check()
213+
if not self.initialized:
214+
self.initialize()
216215

217216
return self.unique == 1
218217

@@ -246,9 +245,6 @@ cdef class IndexEngine:
246245
cdef _get_index_values(self):
247246
return self.vgetter()
248247

249-
cdef inline _do_unique_check(self):
250-
self._ensure_mapping_populated()
251-
252248
def _call_monotonic(self, values):
253249
raise NotImplementedError
254250

@@ -270,7 +266,6 @@ cdef class IndexEngine:
270266

271267
if len(self.mapping) == len(values):
272268
self.unique = 1
273-
self.unique_check = 1
274269

275270
self.initialized = 1
276271

0 commit comments

Comments
 (0)