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

Class _Sentinel

Lib/unittest/mock.py:326–338  ·  view source on GitHub ↗

Access attributes to return a named object, usable as a sentinel.

Source from the content-addressed store, hash-verified

324
325
326class _Sentinel(object):
327 """Access attributes to return a named object, usable as a sentinel."""
328 def __init__(self):
329 self._sentinels = {}
330
331 def __getattr__(self, name):
332 if name == '__bases__':
333 # Without this help(unittest.mock) raises an exception
334 raise AttributeError
335 return self._sentinels.setdefault(name, _SentinelObject(name))
336
337 def __reduce__(self):
338 return 'sentinel'
339
340
341sentinel = _Sentinel()

Callers 1

mock.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…