INNER CODE UNIT · Python
__getattr__
psevensas/DjangoChannelsGraphqlWs · channels_graphql_ws/dict_as_object.py:37
def __getattr__(self, name):
"""Route attributes to the scope object."""
if name.startswith("_"):
raise AttributeError()
try:
return self._scope[name]
except KeyError as ex:
raise AttributeError() from ex
def __setattr__(self, name, value):
"""Route attributes to the scope object."""
if name.startswith("_"):
super().__setattr__(name, value)
self._scope[name] = value
# ----------------------------------------------------- DICT WRAPPER
def __getitem__(self, key):
"""Wrap dict method."""