Skip to content

Commit

Permalink
Add missing docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
Jackenmen committed Aug 30, 2021
1 parent ff10f14 commit ee92590
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 2 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@
for module_name, module in modules.items()
for name in module.__all__
}
# this fixes very long overload signature for this internal type
autodoc_type_aliases["EventListener"] = "EventListener"


def fixup_base_reprs(
Expand Down
27 changes: 26 additions & 1 deletion src/mutiny/_internal/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,25 @@ async def wait_for(
check: Optional[Callable[[EventT], bool]] = None,
timeout: Optional[int] = None,
) -> EventT:
"""
Waits for a matching event to be dispatched.
Parameters:
event_cls: The event to wait for.
check:
A predicate to check what to wait for. It will be called with
an event of a type ``event_cls`` and should return `True`
if the event should match.
timeout:
The numbers of seconds to wait for, or `None` to block until
a valid event is received.
Raises:
asyncio.TimeoutError: If a timeout occurs.
Returns:
An event of a type ``event_cls``.
"""
future = self._event_handler.add_waiter(event_cls, check=check)
# wait_for() automatically cancels the future on timeout so
# we don't need any additional handling here
Expand All @@ -151,8 +170,14 @@ async def start(self) -> None:
Creates a websocket connection and lets the websocket listen to messages
from the Revolt's gateway.
This is a loop that runs the entire event systems. Control is not resumed until
This is a loop that runs the entire event system. Control is not resumed until
the WebSocket connection is terminated.
Raises:
InvalidCredentials: If the authentication fails due to invalid credentials.
OnboardingNotFinished:
If the authentication fails due to unfinished onboarding.
AuthenticationError: If the authentication fails for a different reason.
"""
# gateway prepares the REST client so no need to do it from here
await self._gateway.start()
Expand Down

0 comments on commit ee92590

Please sign in to comment.