From 7ce79a84098e2bda61b48d5857a8c7af954ac9b6 Mon Sep 17 00:00:00 2001 From: Juan Carlos Date: Tue, 8 Oct 2024 16:14:58 -0300 Subject: [PATCH 1/3] fix: Types to use Option[T] --- realtime/_async/client.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/realtime/_async/client.py b/realtime/_async/client.py index ae99b6e..fda8487 100644 --- a/realtime/_async/client.py +++ b/realtime/_async/client.py @@ -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 @@ -243,7 +243,7 @@ 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. @@ -251,7 +251,7 @@ async def set_auth(self, token: Union[str, None]) -> None: 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 From b09cf2316749fe386e491d4ee0210669f90c9fee Mon Sep 17 00:00:00 2001 From: Juan Carlos Date: Tue, 8 Oct 2024 16:15:06 -0300 Subject: [PATCH 2/3] fix: Types to use Option[T] --- realtime/_sync/client.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/realtime/_sync/client.py b/realtime/_sync/client.py index 79995af..a70c85f 100644 --- a/realtime/_sync/client.py +++ b/realtime/_sync/client.py @@ -1,4 +1,4 @@ -from typing import Any, Dict, List, Union +from typing import Any, Dict, List, Optional from .channel import RealtimeChannelOptions, SyncRealtimeChannel @@ -56,7 +56,7 @@ 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. @@ -64,7 +64,7 @@ def set_auth(self, token: Union[str, None]) -> None: 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 From fbfa3bf538501dfe9fd70fe3190a1ded2ad196bf Mon Sep 17 00:00:00 2001 From: Juan Carlos Date: Tue, 8 Oct 2024 16:23:43 -0300 Subject: [PATCH 3/3] fix: Types to use Option[T]