Skip to content

Commit

Permalink
fix: Types to use Option[T] (#223)
Browse files Browse the repository at this point in the history
  • Loading branch information
juancarlospaco authored Oct 10, 2024
1 parent f9eb04c commit b5041c3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions realtime/_async/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import logging
import re
from functools import wraps
from typing import Any, Callable, Dict, List, Optional, Union
from typing import Any, Callable, Dict, List, Optional

import websockets

Expand Down Expand Up @@ -243,15 +243,15 @@ def summary(self) -> None:
for topic, channel in self.channels.items():
print(f"Topic: {topic} | Events: {[e for e, _ in channel.listeners]}]")

async def set_auth(self, token: Union[str, None]) -> None:
async def set_auth(self, token: Optional[str]) -> None:
"""
Set the authentication token for the connection and update all joined channels.
This method updates the access token for the current connection and sends the new token
to all joined channels. This is useful for refreshing authentication or changing users.
Args:
token (Union[str, None]): The new authentication token. Can be None to remove authentication.
token (Optional[str]): The new authentication token. Can be None to remove authentication.
Returns:
None
Expand Down
6 changes: 3 additions & 3 deletions realtime/_sync/client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, Dict, List, Union
from typing import Any, Dict, List, Optional

from .channel import RealtimeChannelOptions, SyncRealtimeChannel

Expand Down Expand Up @@ -56,15 +56,15 @@ def remove_all_channels(self) -> None:
"""
raise NotImplementedError(NOT_IMPLEMENTED_MESSAGE)

def set_auth(self, token: Union[str, None]) -> None:
def set_auth(self, token: Optional[str]) -> None:
"""
Set the authentication token for the connection and update all joined channels.
This method updates the access token for the current connection and sends the new token
to all joined channels. This is useful for refreshing authentication or changing users.
Args:
token (Union[str, None]): The new authentication token. Can be None to remove authentication.
token (Optional[str]): The new authentication token. Can be None to remove authentication.
Returns:
None
Expand Down

0 comments on commit b5041c3

Please sign in to comment.