Skip to content

Commit 2988ad8

Browse files
committed
Update return type formatting in docstrings
1 parent 95124ee commit 2988ad8

25 files changed

+150
-76
lines changed

shiny/_validation.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ def req(*args: T, cancel_output: bool = False) -> T | None:
3636
3737
Returns
3838
-------
39+
:
3940
The first argument. If no arguments are provided, returns ``None``.
4041
"""
4142
if len(args) == 0:

shiny/plotutils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ def brushed_points(
7575
7676
Returns
7777
-------
78+
:
7879
A pandas DataFrame containing the rows selected by the brush. If `all_rows` is
7980
`True`, then all rows from the original data will be returned, along with an
8081
additional column named `selected_`, which indicates whether or not each row was
@@ -210,6 +211,7 @@ def near_points(
210211
211212
Returns
212213
-------
214+
:
213215
A pandas DataFrame containing the rows selected by the brush. If `all_rows` is
214216
`True`, then all rows from the original data will be returned, along with an
215217
additional column named `selected_`, which indicates whether or not each row was

shiny/reactive/_core.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -201,18 +201,19 @@ def isolate():
201201
Ordinarily, the simple act of reading a reactive value causes a relationship to be
202202
established between the caller and the reactive value, where a change to the
203203
reactive value will cause the caller to re-execute. (The same applies for the act of
204-
getting a reactive expression's value.) `with isolate()` lets you read a
205-
reactive value or expression without establishing this relationship.
204+
getting a reactive expression's value.) `with isolate()` lets you read a reactive
205+
value or expression without establishing this relationship.
206206
207-
``with isolate()`` can also be useful for calling reactive expression at the console,
208-
which can be useful for debugging. To do so, wrap the calls to the reactive
207+
``with isolate()`` can also be useful for calling reactive expression at the
208+
console, which can be useful for debugging. To do so, wrap the calls to the reactive
209209
expression with ``with isolate()``.
210210
211211
Returns
212212
-------
213-
A context manager that executes the given expression in a scope where reactive
214-
values can be read, but do not cause the reactive scope of the caller to be
215-
re-evaluated when they change.
213+
:
214+
A context manager that executes the given expression in a scope where reactive
215+
values can be read, but do not cause the reactive scope of the caller to be
216+
re-evaluated when they change.
216217
217218
See Also
218219
--------
@@ -228,7 +229,8 @@ def get_current_context() -> Context:
228229
229230
Returns
230231
-------
231-
A :class:`~Context`.
232+
:
233+
A :class:`~Context`.
232234
233235
Raises
234236
------
@@ -265,7 +267,8 @@ def on_flushed(
265267
266268
Returns
267269
-------
268-
A function that can be used to unregister the callback.
270+
:
271+
A function that can be used to unregister the callback.
269272
270273
See Also
271274
--------

shiny/reactive/_poll.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ def poll(
8383
8484
Returns
8585
-------
86-
A decorator that should be applied to a no-argument function that (expensively)
86+
:
87+
A decorator that should be applied to a no-argument function that (expensively)
8788
reads whatever data is desired. (This function may be a regular function or a
8889
coroutine function.) The result of the decorator is a reactive ~shiny.reactive.Calc
8990
that always returns up-to-date data, and invalidates callers when changes are
@@ -256,7 +257,8 @@ def file_reader(
256257
257258
Returns
258259
-------
259-
A decorator that should be applied to a no-argument function that (expensively)
260+
:
261+
A decorator that should be applied to a no-argument function that (expensively)
260262
reads whatever data is desired. (This function may be a regular function or a
261263
coroutine function.) The result of the decorator is a reactive ~shiny.reactive.Calc
262264
that always returns up-to-date data, and invalidates callers when changes are

shiny/reactive/_reactives.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ class Value(Generic[T]):
5959
6060
Returns
6161
-------
62-
An instance of a reactive value.
62+
:
63+
An instance of a reactive value.
6364
6465
Raises
6566
------
@@ -114,7 +115,8 @@ def get(self) -> T:
114115
115116
Returns
116117
-------
117-
A value.
118+
:
119+
A value.
118120
119121
Raises
120122
------
@@ -142,7 +144,8 @@ def set(self, value: T) -> bool:
142144
143145
Returns
144146
-------
145-
``True`` if the value was set to a different value and ``False`` otherwise.
147+
:
148+
``True`` if the value was set to a different value and ``False`` otherwise.
146149
147150
Raises
148151
------
@@ -174,7 +177,8 @@ def unset(self) -> None:
174177
175178
Returns
176179
-------
177-
``True`` if the value was set prior to this unsetting.
180+
:
181+
``True`` if the value was set prior to this unsetting.
178182
"""
179183
self.set(MISSING) # type: ignore
180184

@@ -184,7 +188,8 @@ def is_set(self) -> bool:
184188
185189
Returns
186190
-------
187-
``True`` if the value is set, ``False`` otherwise.
191+
:
192+
``True`` if the value is set, ``False`` otherwise.
188193
"""
189194

190195
self._is_set_dependents.register()
@@ -400,7 +405,8 @@ def Calc(
400405
401406
Returns
402407
-------
403-
A decorator that marks a function as a reactive calculation.
408+
:
409+
A decorator that marks a function as a reactive calculation.
404410
405411
Tip
406412
---
@@ -679,7 +685,8 @@ def Effect(
679685
680686
Returns
681687
-------
682-
A decorator that marks a function as a reactive effect (:class:`Effect_`).
688+
:
689+
A decorator that marks a function as a reactive effect (:class:`Effect_`).
683690
684691
See Also
685692
--------
@@ -740,7 +747,8 @@ def event(
740747
741748
Returns
742749
-------
743-
A decorator that marks a function as an event handler.
750+
:
751+
A decorator that marks a function as an event handler.
744752
745753
Tip
746754
----

shiny/render/_render.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,8 @@ def text(
148148
149149
Returns
150150
-------
151-
A decorator for a function that returns a string.
151+
:
152+
A decorator for a function that returns a string.
152153
153154
Tip
154155
----
@@ -329,7 +330,8 @@ def plot(
329330
330331
Returns
331332
-------
332-
A decorator for a function that returns any of the following:
333+
:
334+
A decorator for a function that returns any of the following:
333335
334336
1. A :class:`matplotlib.figure.Figure` instance.
335337
2. An :class:`matplotlib.artist.Artist` instance.
@@ -453,7 +455,8 @@ def image(
453455
454456
Returns
455457
-------
456-
A decorator for a function that returns an `~shiny.types.ImgData` object.
458+
:
459+
A decorator for a function that returns an `~shiny.types.ImgData` object.
457460
458461
Tip
459462
----
@@ -628,7 +631,8 @@ def table(
628631
629632
Returns
630633
-------
631-
A decorator for a function that returns any of the following:
634+
:
635+
A decorator for a function that returns any of the following:
632636
633637
1. A pandas :class:`DataFrame` object.
634638
2. A pandas :class:`Styler` object.
@@ -719,7 +723,8 @@ def ui(
719723
720724
Returns
721725
-------
722-
A decorator for a function that returns an object of type `~shiny.ui.TagChild`.
726+
:
727+
A decorator for a function that returns an object of type `~shiny.ui.TagChild`.
723728
724729
Tip
725730
----

shiny/session/_session.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,8 @@ def on_flush(self, fn: Callable[[], None], once: bool = True) -> Callable[[], No
646646
647647
Returns
648648
-------
649-
A function that can be used to cancel the registration.
649+
:
650+
A function that can be used to cancel the registration.
650651
"""
651652
return self._flush_callbacks.register(fn, once)
652653

@@ -666,7 +667,8 @@ def on_flushed(
666667
667668
Returns
668669
-------
669-
A function that can be used to cancel the registration.
670+
:
671+
A function that can be used to cancel the registration.
670672
"""
671673
return self._flushed_callbacks.register(fn, once)
672674

@@ -717,7 +719,8 @@ def on_ended(self, fn: Callable[[], None]) -> Callable[[], None]:
717719
718720
Returns
719721
-------
720-
A function that can be used to cancel the registration.
722+
:
723+
A function that can be used to cancel the registration.
721724
"""
722725
return self._on_ended_callbacks.register(fn)
723726

@@ -752,7 +755,8 @@ def download(
752755
753756
Returns
754757
-------
755-
The decorated function.
758+
:
759+
The decorated function.
756760
"""
757761

758762
def wrapper(fn: DownloadHandler):
@@ -795,6 +799,7 @@ def dynamic_route(self, name: str, handler: DynamicRouteHandler) -> str:
795799
796800
Returns
797801
-------
802+
:
798803
The URL path for the route.
799804
"""
800805

shiny/session/_utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ def get_current_session() -> Optional[Session]:
3434
3535
Returns
3636
-------
37-
The current session if one is active, otherwise ``None``.
37+
:
38+
The current session if one is active, otherwise ``None``.
3839
3940
Note
4041
----
@@ -80,7 +81,8 @@ def require_active_session(session: Optional[Session]) -> Session:
8081
8182
Returns
8283
-------
83-
The session.
84+
:
85+
The session.
8486
8587
Note
8688
----

0 commit comments

Comments
 (0)