Skip to content

Commit

Permalink
Enable numpydoc and use it consistently
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Jan 23, 2025
1 parent 0866c44 commit e17132f
Show file tree
Hide file tree
Showing 36 changed files with 240 additions and 238 deletions.
1 change: 1 addition & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@


extensions = [
'numpydoc',
'bokeh.sphinxext.bokeh_plot',
'myst_parser',
'sphinx_design',
Expand Down
8 changes: 4 additions & 4 deletions panel/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ async def get_authenticated_user(self, redirect_uri, client_id, state,
"""
Fetches the authenticated user
Arguments
---------
Parameters
----------
redirect_uri: (str)
The OAuth redirect URI
client_id: (str)
Expand Down Expand Up @@ -172,8 +172,8 @@ async def _fetch_access_token(
"""
Fetches the access token.
Arguments
---------
Parameters
----------
client_id:
The client ID
redirect_uri:
Expand Down
24 changes: 12 additions & 12 deletions panel/chat/feed.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,8 +659,8 @@ def send(
If `respond` is `True`, additionally executes the callback, if provided.
Arguments
---------
Parameters
----------
value : ChatMessage | dict | Any
The message contents to send.
user : str | None
Expand Down Expand Up @@ -711,8 +711,8 @@ def stream(
This method is primarily for outputs that are not generators--
notably LangChain. For most cases, use the send method instead.
Arguments
---------
Parameters
----------
value : str | dict | ChatMessage
The new token value to stream.
user : str | None
Expand Down Expand Up @@ -781,8 +781,8 @@ def add_step(
Adds a ChatStep component either by appending it to an existing
ChatMessage or creating a new ChatMessage.
Arguments
---------
Parameters
----------
step : str | list(str) | ChatStep | None
The objects to stream to the step.
append : bool
Expand Down Expand Up @@ -889,8 +889,8 @@ def prompt_user(
"""
Prompts the user to interact with a form component.
Arguments
---------
Parameters
----------
component : Widget | ListPanel
The component to prompt the user with.
callback : Callable
Expand Down Expand Up @@ -1092,8 +1092,8 @@ def serialize(
"""
Exports the chat log.
Arguments
---------
Parameters
----------
format : str
The format to export the chat log as; currently only
supports "transformers".
Expand Down Expand Up @@ -1155,8 +1155,8 @@ def select(self, selector=None):
Iterates over the ChatInterface and any potential children in the
applying the selector.
Arguments
---------
Parameters
----------
selector: type or callable or None
The selector allows selecting a subset of Viewables by
declaring a type or callable function to filter by.
Expand Down
16 changes: 8 additions & 8 deletions panel/chat/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,8 +583,8 @@ def active(self, index: int) -> None:
"""
Set the active input widget tab index.
Arguments
---------
Parameters
----------
index : int
The active index to set.
"""
Expand All @@ -602,8 +602,8 @@ def _serialize_for_transformers(
"""
Exports the chat log for use with transformers.
Arguments
---------
Parameters
----------
messages : list(ChatMessage)
A list of ChatMessage objects to serialize.
role_names : dict(str, str | list(str)) | None
Expand Down Expand Up @@ -668,8 +668,8 @@ def send(
If `respond` is `True`, additionally executes the callback, if provided.
Arguments
---------
Parameters
----------
value : ChatMessage | dict | Any
The message contents to send.
user : str | None
Expand Down Expand Up @@ -714,8 +714,8 @@ def stream(
This method is primarily for outputs that are not generators--
notably LangChain. For most cases, use the send method instead.
Arguments
---------
Parameters
----------
value : str | dict | ChatMessage
The new token value to stream.
user : str | None
Expand Down
12 changes: 6 additions & 6 deletions panel/chat/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -684,8 +684,8 @@ def stream(self, token: str, replace: bool = False):
in a layout of `Column(Markdown(...), Image(...))` the Markdown
pane is updated.
Arguments
---------
Parameters
----------
token: str
The token to stream to the text pane.
replace: bool (default=False)
Expand All @@ -702,8 +702,8 @@ def update(
"""
Updates the message with a new value, user and avatar.
Arguments
---------
Parameters
----------
value : ChatMessage | dict | Any
The message contents to send.
user : str | None
Expand Down Expand Up @@ -747,8 +747,8 @@ def serialize(
"""
Format the object to a string.
Arguments
---------
Parameters
----------
prefix_with_viewable_label : bool
Whether to include the name of the Viewable, or type
of the viewable if no name is specified.
Expand Down
8 changes: 4 additions & 4 deletions panel/chat/step.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,8 @@ def stream(self, token: str | None, replace: bool = False):
"""
Stream a token to the last available string-like object.
Arguments
---------
Parameters
----------
token : str
The token to stream.
replace : bool
Expand Down Expand Up @@ -276,8 +276,8 @@ def serialize(
"""
Format the object to a string.
Arguments
---------
Parameters
----------
prefix_with_viewable_label : bool
Whether to include the name of the Viewable, or type
of the viewable if no name is specified.
Expand Down
20 changes: 10 additions & 10 deletions panel/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,8 +538,8 @@ def _handle_msg(self, data: Any) -> None:
Message handler for messages sent from the frontend using the
`model.send_msg` API.
Arguments
---------
Parameters
----------
data: any
Data received from the frontend.
"""
Expand All @@ -549,8 +549,8 @@ def _send_msg(self, data: Any) -> None:
Sends data to the frontend which can be observed on the frontend
with the `model.on_msg("msg:custom", callback)` API.
Arguments
---------
Parameters
----------
data: any
Data to send to the frontend.
"""
Expand All @@ -561,8 +561,8 @@ def on_msg(self, callback: Callable) -> None:
Registers a callback to be executed when a message event
containing arbitrary data is received.
Arguments
---------
Parameters
----------
event: str
Name of the DOM event to add an event listener to.
callback: callable
Expand All @@ -575,8 +575,8 @@ def on_event(self, event: str, callback: Callable) -> None:
Registers a callback to be executed when the specified DOM
event is triggered.
Arguments
---------
Parameters
----------
event: str
Name of the DOM event to add an event listener to.
callback: callable
Expand Down Expand Up @@ -780,8 +780,8 @@ def send(self, msg: dict):
"""
Sends a custom event containing the provided message to the frontend.
Arguments
---------
Parameters
----------
msg: dict
"""
self._send_msg(msg)
8 changes: 4 additions & 4 deletions panel/io/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,8 +598,8 @@ def _render_template(self, doc, path):
found in the notebook and lays them out according to the
cell metadata (if present).
Arguments
----------
Parameters
-----------
doc (Document)
A ``Document`` to render the template into
path (str):
Expand Down Expand Up @@ -676,8 +676,8 @@ def unset_reset():
def modify_document(self, doc: Document) -> None:
"""Run Bokeh application code to update a ``Document``
Arguments
----------
Parameters
-----------
doc (Document) : a ``Document`` to update
"""
path = self._runner._path
Expand Down
8 changes: 4 additions & 4 deletions panel/io/location.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,8 @@ def sync(
parameters in the URL. If no parameters are supplied all
parameters except the name are synced.
Arguments
---------
Parameters
----------
parameterized (param.Parameterized):
The Parameterized object to sync query parameters with
parameters (list or dict):
Expand Down Expand Up @@ -273,8 +273,8 @@ def unsync(self, parameterized: param.Parameterized, parameters: list[str] | Non
params in the URL. If no parameters are supplied all
parameters except the name are unsynced.
Arguments
---------
Parameters
----------
parameterized (param.Parameterized):
The Parameterized object to unsync query parameters with
parameters (list):
Expand Down
4 changes: 2 additions & 2 deletions panel/io/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,8 +538,8 @@ def resolve_resources(
"""
Resolves the resources required for this component.
Arguments
---------
Parameters
----------
cdn: bool | Literal['auto']
Whether to load resources from CDN or local server. If set
to 'auto' value will be automatically determine based on
Expand Down
Loading

0 comments on commit e17132f

Please sign in to comment.