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

Method append_nest_to_list

Lib/tomllib/_parser.py:288–297  ·  view source on GitHub ↗
(self, key: Key)

Source from the content-addressed store, hash-verified

286 return cont # type: ignore[no-any-return]
287
288 def append_nest_to_list(self, key: Key) -> None:
289 cont = self.get_or_create_nest(key[:-1])
290 last_key = key[-1]
291 if last_key in cont:
292 list_ = cont[last_key]
293 if not isinstance(list_, list):
294 raise KeyError("An object other than list found behind this key")
295 list_.append({})
296 else:
297 cont[last_key] = [{}]
298
299
300class Output:

Callers 1

create_list_ruleFunction · 0.80

Calls 2

get_or_create_nestMethod · 0.95
appendMethod · 0.45

Tested by

no test coverage detected