Skip to content

Commit b415d22

Browse files
committed
Add docstring to custom_data hook.
1 parent 707399b commit b415d22

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

dash/_callback_context.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,9 @@ def origin(self):
307307
@property
308308
@has_context
309309
def custom_data(self):
310+
"""
311+
Custom data set by hooks.custom_data.
312+
"""
310313
return _get_from_context("custom_data", {})
311314

312315

dash/_hooks.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,17 @@ def wrap(func):
192192

193193
return wrap
194194

195-
def custom_data(self, namespace, priority: _t.Optional[int] = None, final=False):
196-
def wrap(func):
195+
def custom_data(
196+
self, namespace: str, priority: _t.Optional[int] = None, final=False
197+
):
198+
"""
199+
Add data to the callback_context.custom_data property under the namespace.
200+
201+
The hook function takes the current context_value and before the ctx is set
202+
and has access to the flask request context.
203+
"""
204+
205+
def wrap(func: _t.Callable[[_t.Dict], _t.Any]):
197206
self.add_hook(
198207
"custom_data",
199208
func,

0 commit comments

Comments
 (0)