From 948adf19f612049fd116eac295f650296b78012c Mon Sep 17 00:00:00 2001 From: nathan Date: Mon, 8 Sep 2025 23:18:09 +0000 Subject: [PATCH 1/2] Fix optional typing issues --- stream_chat/async_chat/channel.py | 2 +- stream_chat/async_chat/client.py | 2 +- stream_chat/base/channel.py | 2 +- stream_chat/base/client.py | 2 +- stream_chat/channel.py | 2 +- stream_chat/client.py | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/stream_chat/async_chat/channel.py b/stream_chat/async_chat/channel.py index a66fb7f..f201113 100644 --- a/stream_chat/async_chat/channel.py +++ b/stream_chat/async_chat/channel.py @@ -195,7 +195,7 @@ async def hide(self, user_id: str) -> StreamResponse: async def show(self, user_id: str) -> StreamResponse: return await self.client.post(f"{self.url}/show", data={"user_id": user_id}) - async def mute(self, user_id: str, expiration: int = None) -> StreamResponse: + async def mute(self, user_id: str, expiration: Optional[int] = None) -> StreamResponse: params: Dict[str, Union[str, int]] = { "user_id": user_id, "channel_cid": self.cid, diff --git a/stream_chat/async_chat/client.py b/stream_chat/async_chat/client.py index ce07f6d..1f315b0 100644 --- a/stream_chat/async_chat/client.py +++ b/stream_chat/async_chat/client.py @@ -325,7 +325,7 @@ async def translate_message(self, message_id: str, language: str) -> StreamRespo ) async def pin_message( - self, message_id: str, user_id: str, expiration: int = None + self, message_id: str, user_id: str, expiration: Optional[int] = None ) -> StreamResponse: updates = { "set": { diff --git a/stream_chat/base/channel.py b/stream_chat/base/channel.py index 8e300a5..feb8ac3 100644 --- a/stream_chat/base/channel.py +++ b/stream_chat/base/channel.py @@ -420,7 +420,7 @@ def show(self, user_id: str) -> Union[StreamResponse, Awaitable[StreamResponse]] @abc.abstractmethod def mute( - self, user_id: str, expiration: int = None + self, user_id: str, expiration: Optional[int] = None ) -> Union[StreamResponse, Awaitable[StreamResponse]]: """ Mutes a channel. diff --git a/stream_chat/base/client.py b/stream_chat/base/client.py index c6f2d94..ed3628a 100644 --- a/stream_chat/base/client.py +++ b/stream_chat/base/client.py @@ -513,7 +513,7 @@ def translate_message( @abc.abstractmethod def pin_message( - self, message_id: str, user_id: str, expiration: int = None + self, message_id: str, user_id: str, expiration: Optional[int] = None ) -> Union[StreamResponse, Awaitable[StreamResponse]]: """ Pins a message. diff --git a/stream_chat/channel.py b/stream_chat/channel.py index 2373811..0c1c813 100644 --- a/stream_chat/channel.py +++ b/stream_chat/channel.py @@ -196,7 +196,7 @@ def hide(self, user_id: str) -> StreamResponse: def show(self, user_id: str) -> StreamResponse: return self.client.post(f"{self.url}/show", data={"user_id": user_id}) - def mute(self, user_id: str, expiration: int = None) -> StreamResponse: + def mute(self, user_id: str, expiration: Optional[int] = None) -> StreamResponse: params: Dict[str, Union[str, int]] = { "user_id": user_id, "channel_cid": self.cid, diff --git a/stream_chat/client.py b/stream_chat/client.py index b9572b1..2d5c98f 100644 --- a/stream_chat/client.py +++ b/stream_chat/client.py @@ -318,7 +318,7 @@ def commit_message(self, message_id: str) -> StreamResponse: return self.post(f"messages/{message_id}/commit") def pin_message( - self, message_id: str, user_id: str, expiration: int = None + self, message_id: str, user_id: str, expiration: Optional[int] = None ) -> StreamResponse: updates = { "set": { From 39181d941f21e5e5796e66c8a902284d1d545e1f Mon Sep 17 00:00:00 2001 From: Nathan Date: Mon, 8 Sep 2025 19:22:27 -0400 Subject: [PATCH 2/2] Update channel.py fix formatting? --- stream_chat/async_chat/channel.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stream_chat/async_chat/channel.py b/stream_chat/async_chat/channel.py index f201113..458417d 100644 --- a/stream_chat/async_chat/channel.py +++ b/stream_chat/async_chat/channel.py @@ -195,7 +195,9 @@ async def hide(self, user_id: str) -> StreamResponse: async def show(self, user_id: str) -> StreamResponse: return await self.client.post(f"{self.url}/show", data={"user_id": user_id}) - async def mute(self, user_id: str, expiration: Optional[int] = None) -> StreamResponse: + async def mute( + self, user_id: str, expiration: Optional[int] = None + ) -> StreamResponse: params: Dict[str, Union[str, int]] = { "user_id": user_id, "channel_cid": self.cid,