Skip to content

Commit 75bcdf5

Browse files
author
Rafael Marinho
committed
refact(cha-769): reformat
1 parent 563deeb commit 75bcdf5

File tree

6 files changed

+30
-13
lines changed

6 files changed

+30
-13
lines changed

stream_chat/async_chat/client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,9 @@ async def get_user_locations(self, user_id: str, **options: Any) -> StreamRespon
873873
return await self.get("users/live_locations", params=params)
874874

875875
async def update_user_location(
876-
self, message_id: str, options: Optional[SharedLocationsOptions] = None,
876+
self,
877+
message_id: str,
878+
options: Optional[SharedLocationsOptions] = None,
877879
) -> StreamResponse:
878880
data = {"message_id": message_id}
879881
if options is not None:
@@ -893,5 +895,3 @@ async def __aexit__(
893895
exc_tb: Optional[TracebackType],
894896
) -> None:
895897
await self.close()
896-
897-

stream_chat/base/client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1448,7 +1448,9 @@ def get_user_locations(self, user_id: str, **options: Any) -> StreamResponse:
14481448
pass
14491449

14501450
@abc.abstractmethod
1451-
def update_user_location(self, message_id: str, options: Optional[SharedLocationsOptions] = None) -> StreamResponse:
1451+
def update_user_location(
1452+
self, message_id: str, options: Optional[SharedLocationsOptions] = None
1453+
) -> StreamResponse:
14521454
"""
14531455
Update the location of a user.
14541456
"""

stream_chat/client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,9 @@ def get_user_locations(self, user_id: str, **options: Any) -> StreamResponse:
831831
return self.get("users/live_locations", params=params)
832832

833833
def update_user_location(
834-
self, message_id: str, options: Optional[SharedLocationsOptions] = None,
834+
self,
835+
message_id: str,
836+
options: Optional[SharedLocationsOptions] = None,
835837
) -> StreamResponse:
836838
data = {"message_id": message_id}
837839
if options is not None:

stream_chat/tests/async_chat/test_live_locations.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,26 @@ async def test_get_user_locations(self, client: StreamChatAsync, random_user: Di
1717
"longitude": -122.4194,
1818
}
1919

20-
channel.send_message({"text": "Message with location", "shared_location": shared_location}, random_user["id"])
20+
channel.send_message(
21+
{"text": "Message with location", "shared_location": shared_location},
22+
random_user["id"],
23+
)
2124

2225
# Get user locations
2326
response = await client.get_user_locations(random_user["id"])
2427

2528
assert "active_live_locations" in response
2629
assert isinstance(response["active_live_locations"], list)
2730

28-
async def test_update_user_location(self, client: StreamChatAsync, random_user: Dict):
31+
async def test_update_user_location(
32+
self, client: StreamChatAsync, random_user: Dict
33+
):
2934
# First create a message to attach location to
3035
channel = client.channel("messaging", str(random_user["id"]))
3136
await channel.create(random_user["id"])
32-
msg = await channel.send_message({"text": "Message with location"}, random_user["id"])
37+
msg = await channel.send_message(
38+
{"text": "Message with location"}, random_user["id"]
39+
)
3340
message_id = msg["message"]["id"]
3441

3542
# Update user location
@@ -55,4 +62,4 @@ async def test_update_user_location(self, client: StreamChatAsync, random_user:
5562
try:
5663
await channel.delete()
5764
except Exception:
58-
pass
65+
pass

stream_chat/tests/test_live_locations.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ def test_get_user_locations(self, client: StreamChat, random_user: Dict):
1717
"longitude": -122.4194,
1818
}
1919

20-
channel.send_message({"text": "Message with location", "shared_location": shared_location}, random_user["id"])
20+
channel.send_message(
21+
{"text": "Message with location", "shared_location": shared_location},
22+
random_user["id"],
23+
)
2124

2225
# Get user locations
2326
response = client.get_user_locations(random_user["id"])
@@ -36,7 +39,10 @@ def test_update_user_location(self, client: StreamChat, random_user: Dict):
3639
"longitude": -122.4194,
3740
}
3841

39-
msg = channel.send_message({"text": "Message with location", "shared_location": shared_location}, random_user["id"])
42+
msg = channel.send_message(
43+
{"text": "Message with location", "shared_location": shared_location},
44+
random_user["id"],
45+
)
4046
message_id = msg["message"]["id"]
4147

4248
# Update user location
@@ -62,4 +68,4 @@ def test_update_user_location(self, client: StreamChat, random_user: Dict):
6268
try:
6369
channel.delete()
6470
except Exception:
65-
pass
71+
pass

stream_chat/types/shared_locations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
class SharedLocationsOptions(TypedDict):
66
longitude: Optional[int]
77
latitude: Optional[int]
8-
end_at: Optional[datetime]
8+
end_at: Optional[datetime]

0 commit comments

Comments
 (0)