MCPcopy
hub / github.com/pallets/flask / pop

Method pop

src/flask/ctx.py:78–90  ·  view source on GitHub ↗

Get and remove an attribute by name. Like :meth:`dict.pop`. :param name: Name of attribute to pop. :param default: Value to return if the attribute is not present, instead of raising a ``KeyError``. .. versionadded:: 0.11

(self, name: str, default: t.Any = _sentinel)

Source from the content-addressed store, hash-verified

76 return self.__dict__.get(name, default)
77
78 def pop(self, name: str, default: t.Any = _sentinel) -> t.Any:
79 """Get and remove an attribute by name. Like :meth:`dict.pop`.
80
81 :param name: Name of attribute to pop.
82 :param default: Value to return if the attribute is not present,
83 instead of raising a ``KeyError``.
84
85 .. versionadded:: 0.11
86 """
87 if default is _sentinel:
88 return self.__dict__.pop(name)
89 else:
90 return self.__dict__.pop(name, default)
91
92 def setdefault(self, name: str, default: t.Any = None) -> t.Any:
93 """Get the value of an attribute if it is present, otherwise

Callers

nothing calls this directly

Calls 1

popMethod · 0.45

Tested by

no test coverage detected