MCPcopy Index your code
hub / github.com/python/cpython / CounterWithDisable

Class CounterWithDisable

Lib/test/test_monitoring.py:372–381  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

370
371
372class CounterWithDisable:
373
374 def __init__(self):
375 self.disable = False
376 self.count = 0
377
378 def __call__(self, *args):
379 self.count += 1
380 if self.disable:
381 return sys.monitoring.DISABLE
382
383
384class RecorderWithDisable:

Callers 10

test_disableMethod · 0.85
test_restartMethod · 0.85
test_two_sameMethod · 0.85
test_three_sameMethod · 0.85
test_two_differentMethod · 0.85
test_two_with_disableMethod · 0.85
check_disableMethod · 0.85

Calls

no outgoing calls

Tested by 10

test_disableMethod · 0.68
test_restartMethod · 0.68
test_two_sameMethod · 0.68
test_three_sameMethod · 0.68
test_two_differentMethod · 0.68
test_two_with_disableMethod · 0.68
check_disableMethod · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…