MCPcopy Index your code
hub / github.com/grantjenks/python-sortedcontainers / count

Method count

sortedcontainers/sortedset.py:387–400  ·  view source on GitHub ↗

Return number of occurrences of `value` in the sorted set. Runtime complexity: `O(1)` >>> ss = SortedSet([1, 2, 3, 4, 5]) >>> ss.count(3) 1 :param value: value to count in sorted set :return: count

(self, value)

Source from the content-addressed store, hash-verified

385
386
387 def count(self, value):
388 """Return number of occurrences of `value` in the sorted set.
389
390 Runtime complexity: `O(1)`
391
392 >>> ss = SortedSet([1, 2, 3, 4, 5])
393 >>> ss.count(3)
394 1
395
396 :param value: value to count in sorted set
397 :return: count
398
399 """
400 return 1 if value in self._set else 0
401
402
403 def discard(self, value):

Callers 1

test_countFunction · 0.95

Calls

no outgoing calls

Tested by 1

test_countFunction · 0.76