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

Method setdefault

Lib/importlib/_bootstrap.py:124–135  ·  view source on GitHub ↗
(self, key, default=None)

Source from the content-addressed store, hash-verified

122 return o
123
124 def setdefault(self, key, default=None):
125 try:
126 o = self.data[key]()
127 except KeyError:
128 o = None
129 if o is None:
130 if self._pending_removals:
131 self._commit_removals()
132 self.data[key] = self._KeyedRef(default, key)
133 return default
134 else:
135 return o
136
137
138# A dict mapping module names to weakrefs of _ModuleLock instances.

Callers 2

_assert_highlightingMethod · 0.45
__enter__Method · 0.45

Calls 1

_commit_removalsMethod · 0.95

Tested by 1

_assert_highlightingMethod · 0.36