88from .. import ui
99from .._typing_extensions import ParamSpec
1010from ..render .renderer import RendererBase , RendererBaseT
11- from ..render .transformer import OutputRenderer
12- from ..render .transformer ._transformer import OT
1311
14- __all__ = (
15- "ui_kwargs" ,
16- "suspend_display" ,
17- )
12+ __all__ = ("suspend_display" ,)
1813
1914P = ParamSpec ("P" )
2015R = TypeVar ("R" )
2116CallableT = TypeVar ("CallableT" , bound = Callable [..., object ])
2217
2318
2419# TODO-barret-future; quartodoc entry?
25- def ui_kwargs (
20+ def output_args (
2621 ** kwargs : object ,
2722) -> Callable [[RendererBaseT ], RendererBaseT ]:
2823 """
@@ -31,9 +26,9 @@ def ui_kwargs(
3126 Each Shiny render function (like :func:`~shiny.render.plot`) can display itself when
3227 declared within a Shiny inline-style application. In the case of
3328 :func:`~shiny.render.plot`, the :func:`~shiny.ui.output_plot` function is called
34- implicitly to display the plot. Use the `@ui_kwargs` decorator to specify
35- arguments to be passed to `output_plot` (or whatever the corresponding UI function
36- is) when the render function displays itself.
29+ implicitly to display the plot. Use the `@ui_kwargs` decorator to specify arguments
30+ to be passed to `output_plot` (or whatever the corresponding UI function is) when
31+ the render function displays itself.
3732
3833 Parameters
3934 ----------
@@ -47,51 +42,7 @@ def ui_kwargs(
4742 """
4843
4944 def wrapper (renderer : RendererBaseT ) -> RendererBaseT :
50- # renderer._default_ui_args = args
51- renderer ._default_ui_kwargs = kwargs
52- return renderer
53-
54- return wrapper
55-
56-
57- def output_args (
58- * args : object ,
59- ** kwargs : object ,
60- ) -> Callable [[OutputRenderer [OT ]], OutputRenderer [OT ]]:
61- """
62- Sets default UI arguments for a Shiny rendering function.
63-
64- Each Shiny render function (like :func:`~shiny.render.plot`) can display itself when
65- declared within a Shiny inline-style application. In the case of
66- :func:`~shiny.render.plot`, the :func:`~shiny.ui.output_plot` function is called
67- implicitly to display the plot. Use the `@output_args` decorator to specify
68- arguments to be passed to `output_plot` (or whatever the corresponding UI function
69- is) when the render function displays itself.
70-
71-
72- Parameters
73- ----------
74- *args
75- Positional arguments to be passed to the UI function.
76- **kwargs
77- Keyword arguments to be passed to the UI function.
78-
79- Returns
80- -------
81- :
82- A decorator that sets the default UI arguments for a Shiny rendering function.
83- """
84-
85- def wrapper (renderer : OutputRenderer [OT ]) -> OutputRenderer [OT ]:
86- if not isinstance (renderer , OutputRenderer ):
87- raise TypeError (
88- f"Expected an OutputRenderer, but got { type (renderer ).__name__ } ."
89- "\n If you are trying to set default UI arguments for a `Renderer`, use"
90- " `@ui_kwargs` instead."
91- )
92- renderer ._default_ui_args = args
93- renderer ._default_ui_kwargs = kwargs
94-
45+ renderer ._auto_output_ui_kwargs = kwargs
9546 return renderer
9647
9748 return wrapper
@@ -152,7 +103,7 @@ def suspend_display(
152103 # display yourself"
153104 if isinstance (fn , RendererBase ):
154105 # By setting the class value, the `self` arg will be auto added.
155- fn .default_ui = null_ui
106+ fn .auto_output_ui = null_ui
156107 return fn
157108
158109 return suspend_display_ctxmgr ()(fn )
0 commit comments