MCPcopy
hub / github.com/pallets/werkzeug / popitem

Method popitem

src/werkzeug/datastructures/structures.py:508–520  ·  view source on GitHub ↗

Pop an item from the dict.

(self)

Source from the content-addressed store, hash-verified

506 raise exceptions.BadRequestKeyError(key) from None
507
508 def popitem(self) -> tuple[K, V]:
509 """Pop an item from the dict."""
510 item: tuple[K, list[V]]
511
512 try:
513 item = super().popitem() # type: ignore[assignment]
514
515 if len(item[1]) == 0:
516 raise exceptions.BadRequestKeyError(item[0])
517
518 return item[0], item[1][0]
519 except KeyError as e:
520 raise exceptions.BadRequestKeyError(e.args[0]) from None
521
522 def poplist(self, key: K) -> list[V]:
523 """Pop the list for a key from the dict. If the key is not in the dict

Callers 3

popitemlistMethod · 0.45
popitemMethod · 0.45
popitemlistMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected