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

Method get

src/flask/ctx.py:67–76  ·  view source on GitHub ↗

Get an attribute by name, or a default value. Like :meth:`dict.get`. :param name: Name of attribute to get. :param default: Value to return if the attribute is not present. .. versionadded:: 0.10

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

Source from the content-addressed store, hash-verified

65 raise AttributeError(name) from None
66
67 def get(self, name: str, default: t.Any | None = None) -> t.Any:
68 """Get an attribute by name, or a default value. Like
69 :meth:`dict.get`.
70
71 :param name: Name of attribute to get.
72 :param default: Value to return if the attribute is not present.
73
74 .. versionadded:: 0.10
75 """
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`.

Callers 15

from_envvarMethod · 0.45
__init__Method · 0.45
_validate_keyFunction · 0.45
shell_commandFunction · 0.45
__repr__Method · 0.45
after_this_requestFunction · 0.45
has_request_contextFunction · 0.45
has_app_contextFunction · 0.45
popMethod · 0.45
pushMethod · 0.45

Calls

no outgoing calls

Tested by 2

__init__Method · 0.36