Skip to content

Commit 59d5dcc

Browse files
author
Rafael Marinho
committed
lint
1 parent 8ece3b1 commit 59d5dcc

File tree

6 files changed

+20
-30
lines changed

6 files changed

+20
-30
lines changed

stream_chat/async_chat/channel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ async def mark_read(self, user_id: str, **data: Any) -> StreamResponse:
138138
async def mark_unread(self, user_id: str, **data: Any) -> StreamResponse:
139139
payload = add_user_id(data, user_id)
140140
return await self.client.post(f"{self.url}/unread", data=payload)
141-
141+
142142
async def get_replies(self, parent_id: str, **options: Any) -> StreamResponse:
143143
return await self.client.get(f"messages/{parent_id}/replies", params=options)
144144

stream_chat/async_chat/client.py

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -989,24 +989,24 @@ async def update_user_location(
989989
async def mark_delivered(self, data: Dict[str, Any]) -> Optional[StreamResponse]:
990990
"""
991991
Send the mark delivered event for this user, only works if the `delivery_receipts` setting is enabled
992-
992+
993993
:param data: MarkDeliveredOptions containing latest_delivered_messages and other optional fields
994994
:return: The server response or None if delivery receipts are disabled
995995
"""
996996
# Validate required fields
997997
if not data.get("latest_delivered_messages"):
998998
raise ValueError("latest_delivered_messages must not be empty")
999-
999+
10001000
# Ensure either user or user_id is provided
10011001
if not data.get("user") and not data.get("user_id"):
10021002
raise ValueError("either user or user_id must be provided")
1003-
1003+
10041004
return await self.post("channels/delivered", data=data)
10051005

10061006
async def mark_delivered_simple(self, user_id: str, message_id: str, channel_cid: str) -> Optional[StreamResponse]:
10071007
"""
10081008
Convenience method to mark a message as delivered for a specific user.
1009-
1009+
10101010
:param user_id: The user ID
10111011
:param message_id: The message ID
10121012
:param channel_cid: The channel CID (channel_type:channel_id)
@@ -1018,19 +1018,14 @@ async def mark_delivered_simple(self, user_id: str, message_id: str, channel_cid
10181018
raise ValueError("message ID must not be empty")
10191019
if not channel_cid:
10201020
raise ValueError("channel CID must not be empty")
1021-
1021+
10221022
data = {
1023-
"latest_delivered_messages": [
1024-
{
1025-
"cid": channel_cid,
1026-
"id": message_id
1027-
}
1028-
],
1023+
"latest_delivered_messages": [{"cid": channel_cid,"id": message_id}],
10291024
"user_id": user_id
10301025
}
1031-
1026+
10321027
return await self.mark_delivered(data)
1033-
1028+
10341029
async def close(self) -> None:
10351030
await self.session.close()
10361031

stream_chat/base/channel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ def mark_unread(
292292
:return: The server response
293293
"""
294294
pass
295-
295+
296296
@abc.abstractmethod
297297
def get_replies(
298298
self, parent_id: str, **options: Any

stream_chat/channel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def mark_read(self, user_id: str, **data: Any) -> StreamResponse:
139139
def mark_unread(self, user_id: str, **data: Any) -> StreamResponse:
140140
payload = add_user_id(data, user_id)
141141
return self.client.post(f"{self.url}/unread", data=payload)
142-
142+
143143
def get_replies(self, parent_id: str, **options: Any) -> StreamResponse:
144144
return self.client.get(f"messages/{parent_id}/replies", params=options)
145145

stream_chat/client.py

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -943,24 +943,26 @@ def update_user_location(
943943
def mark_delivered(self, data: Dict[str, Any]) -> Optional[StreamResponse]:
944944
"""
945945
Send the mark delivered event for this user, only works if the `delivery_receipts` setting is enabled
946-
946+
947947
:param data: MarkDeliveredOptions containing latest_delivered_messages and other optional fields
948948
:return: The server response or None if delivery receipts are disabled
949949
"""
950950
# Validate required fields
951951
if not data.get("latest_delivered_messages"):
952952
raise ValueError("latest_delivered_messages must not be empty")
953-
953+
954954
# Ensure either user or user_id is provided
955955
if not data.get("user") and not data.get("user_id"):
956956
raise ValueError("either user or user_id must be provided")
957-
957+
958958
return self.post("channels/delivered", data=data)
959959

960-
def mark_delivered_simple(self, user_id: str, message_id: str, channel_cid: str) -> Optional[StreamResponse]:
960+
def mark_delivered_simple(
961+
self, user_id: str, message_id: str, channel_cid: str
962+
) -> Optional[StreamResponse]:
961963
"""
962964
Convenience method to mark a message as delivered for a specific user.
963-
965+
964966
:param user_id: The user ID
965967
:param message_id: The message ID
966968
:param channel_cid: The channel CID (channel_type:channel_id)
@@ -972,15 +974,8 @@ def mark_delivered_simple(self, user_id: str, message_id: str, channel_cid: str)
972974
raise ValueError("message ID must not be empty")
973975
if not channel_cid:
974976
raise ValueError("channel CID must not be empty")
975-
976977
data = {
977-
"latest_delivered_messages": [
978-
{
979-
"cid": channel_cid,
980-
"id": message_id
981-
}
982-
],
978+
"latest_delivered_messages": [{"cid": channel_cid,"id": message_id}],
983979
"user_id": user_id
984980
}
985-
986981
return self.mark_delivered(data)

stream_chat/tests/test_channel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ def test_mark_unread(self, channel: Channel, random_user: Dict):
202202
channel.send_message({"id": msg_id, "text": "helloworld"}, random_user["id"])
203203
response = channel.mark_unread(random_user["id"], message_id=msg_id)
204204
assert "duration" in response
205-
205+
206206
def test_get_messages(self, channel: Channel, random_user: Dict):
207207
msg_id = str(uuid.uuid4())
208208
channel.send_message({"id": msg_id, "text": "helloworld"}, random_user["id"])

0 commit comments

Comments
 (0)