MCPcopy Create free account
hub / github.com/grantjenks/python-sortedcontainers / index

Method index

tests/sortedcollection.py:133–138  ·  view source on GitHub ↗

Find the position of an item. Raise ValueError if not found.

(self, item)

Source from the content-addressed store, hash-verified

131 return item in self._items[i:j]
132
133 def index(self, item):
134 'Find the position of an item. Raise ValueError if not found.'
135 k = self._key(item)
136 i = bisect_left(self._keys, k)
137 j = bisect_right(self._keys, k)
138 return self._items[i:j].index(item) + i
139
140 def count(self, item):
141 'Return number of occurrences of item'

Callers 14

removeMethod · 0.95
runMethod · 0.45
stress_indexFunction · 0.45
stress_indexFunction · 0.45
test_indexFunction · 0.45
test_index_keyFunction · 0.45
test_keysviewFunction · 0.45
test_valuesviewFunction · 0.45
test_values_view_indexFunction · 0.45
test_itemsviewFunction · 0.45
test_items_view_indexFunction · 0.45

Calls

no outgoing calls

Tested by 11

stress_indexFunction · 0.36
stress_indexFunction · 0.36
test_indexFunction · 0.36
test_index_keyFunction · 0.36
test_keysviewFunction · 0.36
test_valuesviewFunction · 0.36
test_values_view_indexFunction · 0.36
test_itemsviewFunction · 0.36
test_items_view_indexFunction · 0.36
test_indexFunction · 0.36
stress_indexFunction · 0.36