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

Class defaultdict

Lib/test/test_descrtut.py:16–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14
15
16class defaultdict(dict):
17 def __init__(self, default=None):
18 dict.__init__(self)
19 self.default = default
20
21 def __getitem__(self, key):
22 try:
23 return dict.__getitem__(self, key)
24 except KeyError:
25 return self.default
26
27 def get(self, key, *args):
28 if not args:
29 args = (self.default,)
30 return dict.get(self, key, *args)
31
32 def merge(self, other):
33 for key in other:
34 if key not in self:
35 self[key] = other[key]
36
37test_1 = """
38

Callers 15

_ssFunction · 0.85
typing.pyFile · 0.85
_guess_delimiterMethod · 0.85
_pylong.pyFile · 0.85
_build_treeFunction · 0.85
_task_graphFunction · 0.85
_find_cyclesFunction · 0.85
test_instantiateMethod · 0.85
test_basicMethod · 0.85
test_missingMethod · 0.85
test_reprMethod · 0.85
test_copyMethod · 0.85

Calls

no outgoing calls

Tested by 15

test_instantiateMethod · 0.68
test_basicMethod · 0.68
test_missingMethod · 0.68
test_reprMethod · 0.68
test_copyMethod · 0.68
test_shallow_copyMethod · 0.68
test_deep_copyMethod · 0.68
test_picklingMethod · 0.68
test_unionMethod · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…