Skip to content

Commit aa6ea96

Browse files
committed
chore: refactor
1 parent 8ce255a commit aa6ea96

37 files changed

+240
-168
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
from .get_me import GetMe
22

33

4-
class AuthMethods(GetMe): ...
4+
class AuthMethods(GetMe): ...

swibots/api/auth/methods/get_me.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,5 @@ async def update_user_info(self: "swibots.ApiClient", user_info: User) -> bool:
3131
bool: Whether request was successful
3232
"""
3333
data = {x: y for x, y in user_info.to_json_request().items() if y is not None}
34-
response = await self.auth_service.post(
35-
"/api/update/bot", data=data
36-
)
37-
return response.data
34+
response = await self.auth_service.post("/api/update/bot", data=data)
35+
return response.data

swibots/api/auth/models/auth_result.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def __init__(
1111
user_id: Optional[int] = None,
1212
is_bot: Optional[bool] = False,
1313
roles: Optional[List[str]] = None,
14-
active: Optional[bool] = False
14+
active: Optional[bool] = False,
1515
):
1616
self.access_token = access_token
1717
self.refresh_token = refresh_token
@@ -29,4 +29,4 @@ def from_json(self, data: Optional[JSONDict]) -> "AuthResult":
2929
self.is_bot = data.get("is_bot")
3030
self.roles = data.get("roles")
3131
self.active = data.get("active")
32-
return self
32+
return self

swibots/api/bot/methods/answer_callback_query.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ async def answer_callback_query(
1212
message_id: Optional[int] = None,
1313
show_alert: Optional[bool] = False,
1414
cache_time: Optional[int] = None,
15-
app_session_id: Optional[str] = None
15+
app_session_id: Optional[str] = None,
1616
) -> bool:
1717
"""
1818
Answer Callback query from callback button
@@ -32,12 +32,15 @@ async def answer_callback_query(
3232
show_alert=show_alert,
3333
cache_time=cache_time,
3434
message_id=message_id,
35-
app_session_id=app_session_id
35+
app_session_id=app_session_id,
3636
)
3737

3838
async def answer_ui_query(
39-
self: "swibots.ApiClient", query_id: str, message_id: int, callback: AppPage,
40-
app_session_id: str
39+
self: "swibots.ApiClient",
40+
query_id: str,
41+
message_id: int,
42+
callback: AppPage,
43+
app_session_id: str,
4144
) -> bool:
4245
"""Answer UI Query
4346
@@ -50,6 +53,5 @@ async def answer_ui_query(
5053
Bool: whether callback was sent or not
5154
"""
5255
return await self.bots_service.bots.answer_ui_query(
53-
query_id, message_id, callback=callback,
54-
app_session_id=app_session_id
56+
query_id, message_id, callback=callback, app_session_id=app_session_id
5557
)

swibots/api/bot/models/bot_info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def __init__(
5454
description: Optional[str] = None,
5555
welcome: BotWelcome = None,
5656
source_code: Optional[str] = None,
57-
preview: Optional[AppPage] = None
57+
preview: Optional[AppPage] = None,
5858
):
5959
super().__init__(
6060
id=id,

swibots/api/callback/AppPage.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def __init__(
8080
def to_json(self) -> JSONDict:
8181
components = []
8282
for component in self.components:
83-
83+
8484
if isinstance(component, ListView):
8585
if self.max_size != None:
8686
component.max_size = self.max_size
@@ -95,9 +95,7 @@ def to_json(self) -> JSONDict:
9595
componentJson["mainAxisSize"] = "max" if self.max_size else "min"
9696
components.append(componentJson)
9797
elif isinstance(component, str):
98-
components.append(
99-
Text(component)
100-
)
98+
components.append(Text(component))
10199

102100
data = {
103101
"type": self.type,
@@ -130,4 +128,4 @@ def from_json(self, data: dict) -> Any:
130128
Component.build_from_json(item) for item in data.get("components", [])
131129
]
132130

133-
return self
131+
return self

swibots/api/callback/BottomBar.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,13 @@ def __init__(
5353
self.options = options
5454
self.type = type
5555
self.theme_color = theme_color
56-
56+
5757
def from_json(self, data) -> Any:
5858
if "BottomBar" in data:
5959
self.type = BottomBarType(data.get("bottomBarStyle"))
60-
self.options = [BottomBarTile().from_json(option) for option in data.get("bottomBar")]
60+
self.options = [
61+
BottomBarTile().from_json(option) for option in data.get("bottomBar")
62+
]
6163
self.theme_color = data.get("bottomBarColour")
6264

6365
return self

swibots/api/callback/Button.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def to_json(self):
130130
"type": self.type,
131131
"buttons": [button.to_json() for button in self.buttons],
132132
"mainAxisSize": "max" if self.max_size else "min",
133-
"flexible": self.flexible
133+
"flexible": self.flexible,
134134
}
135135

136136

swibots/api/callback/Feed.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@ def to_json(self) -> Dict[str, Any]:
4747
"feeds": [feed.to_json() for feed in self.feeds],
4848
"offsetCallbackData": self.next_callback,
4949
}
50-
return data
50+
return data

swibots/api/callback/ListView.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from typing import Union, List, Literal
55
from .Progress import ListTileProgress
66

7+
78
class ListViewType(Enum):
89
DEFAULT = "default"
910
SMALL = "small"
@@ -26,7 +27,7 @@ def __init__(
2627
thumb: Union[Image, str] = "",
2728
badges: List[Badge] = None,
2829
max_size: bool = None,
29-
progress: ListTileProgress = None
30+
progress: ListTileProgress = None,
3031
):
3132
self.title = title
3233
self.subtitle = subtitle

0 commit comments

Comments
 (0)