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

Method add

Lib/test/pythoninfo.py:23–39  ·  view source on GitHub ↗
(self, key, value)

Source from the content-addressed store, hash-verified

21 self.info = {}
22
23 def add(self, key, value):
24 if key in self.info:
25 raise ValueError("duplicate key: %r" % key)
26
27 if value is None:
28 return
29
30 if not isinstance(value, int):
31 if not isinstance(value, str):
32 # convert other objects like sys.flags to string
33 value = str(value)
34
35 value = value.strip()
36 if not value:
37 return
38
39 self.info[key] = value
40
41 def get_infos(self):
42 """

Callers 15

__eq__Method · 0.45
setUpMethod · 0.45
test_close_fdsMethod · 0.45
test__all__Method · 0.45
test_addMethod · 0.45

Calls 2

strFunction · 0.85
stripMethod · 0.45

Tested by 15

__eq__Method · 0.36
setUpMethod · 0.36
test_close_fdsMethod · 0.36
test__all__Method · 0.36
test_addMethod · 0.36