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

Method singleton

Lib/concurrent/interpreters/_crossinterp.py:42–59  ·  view source on GitHub ↗
(cls, kind, module, name='UNBOUND')

Source from the content-addressed store, hash-verified

40
41 @classonly
42 def singleton(cls, kind, module, name='UNBOUND'):
43 doc = cls.__doc__
44 if doc:
45 doc = doc.replace(
46 'cross-interpreter container', kind,
47 ).replace(
48 'cross-interpreter', kind,
49 )
50 subclass = type(
51 f'Unbound{kind.capitalize()}Item',
52 (cls,),
53 {
54 "_MODULE": module,
55 "_NAME": name,
56 "__doc__": doc,
57 },
58 )
59 return object.__new__(subclass)
60
61 _MODULE = __name__
62 _NAME = 'UNBOUND'

Callers 2

channels.pyFile · 0.80
_queues.pyFile · 0.80

Calls 3

replaceMethod · 0.45
capitalizeMethod · 0.45
__new__Method · 0.45

Tested by

no test coverage detected