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

Method get_value

Lib/test/test_string/test_string.py:137–145  ·  view source on GitHub ↗
(self, key, args, kwds)

Source from the content-addressed store, hash-verified

135 self.namespace = namespace
136
137 def get_value(self, key, args, kwds):
138 if isinstance(key, str):
139 try:
140 # Check explicitly passed arguments first
141 return kwds[key]
142 except KeyError:
143 return self.namespace[key]
144 else:
145 string.Formatter.get_value(key, args, kwds)
146
147 fmt = NamespaceFormatter({'greeting':'hello'})
148 self.assertEqual(fmt.format("{greeting}, world!"), 'hello, world!')

Callers 2

get_valueFunction · 0.45
check_invariantMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected