Skip to content

Commit ab9d692

Browse files
committed
format files
1 parent 64d4e6d commit ab9d692

File tree

2 files changed

+13
-17
lines changed

2 files changed

+13
-17
lines changed

pybotx/bot/handler.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
Literal,
99
TypeVar,
1010
Union,
11-
cast,
1211
)
1312

1413
from pybotx.models.commands import BotCommand
@@ -78,10 +77,7 @@ async def __call__(self, message: IncomingMessage, bot: "Bot") -> None:
7877
handler_func = self.handler_func
7978

8079
for middleware in self.middlewares[::-1]:
81-
handler_func = cast(
82-
HandlerFunc,
83-
partial(middleware, call_next=handler_func),
84-
) # type: ignore[type-arg, call-arg]
80+
handler_func = partial(middleware, call_next=handler_func) # type: ignore[call-arg]
8581

8682
await handler_func(message, bot)
8783

pybotx/models/attachments.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,10 @@ def convert_api_attachment_to_domain( # noqa: WPS212
220220
attachment_type = convert_attachment_type_to_domain(api_attachment.type)
221221

222222
if attachment_type == AttachmentTypes.IMAGE:
223-
attachment_type = cast(
223+
attachment_type = cast( # type: ignore[redundant-cast]
224224
Literal[AttachmentTypes.IMAGE],
225225
attachment_type,
226-
) # type: ignore[redundant-cast]
226+
)
227227
api_attachment = cast(BotAPIAttachmentImage, api_attachment)
228228
content = decode_rfc2397(api_attachment.data.content)
229229

@@ -236,10 +236,10 @@ def convert_api_attachment_to_domain( # noqa: WPS212
236236
)
237237

238238
if attachment_type == AttachmentTypes.VIDEO:
239-
attachment_type = cast(
239+
attachment_type = cast( # type: ignore[redundant-cast]
240240
Literal[AttachmentTypes.VIDEO],
241241
attachment_type,
242-
) # type: ignore[redundant-cast]
242+
)
243243
api_attachment = cast(BotAPIAttachmentVideo, api_attachment)
244244
content = decode_rfc2397(api_attachment.data.content)
245245

@@ -253,10 +253,10 @@ def convert_api_attachment_to_domain( # noqa: WPS212
253253
)
254254

255255
if attachment_type == AttachmentTypes.DOCUMENT:
256-
attachment_type = cast(
256+
attachment_type = cast( # type: ignore[redundant-cast]
257257
Literal[AttachmentTypes.DOCUMENT],
258258
attachment_type,
259-
) # type: ignore[redundant-cast]
259+
)
260260
api_attachment = cast(BotAPIAttachmentDocument, api_attachment)
261261
content = decode_rfc2397(api_attachment.data.content)
262262

@@ -269,10 +269,10 @@ def convert_api_attachment_to_domain( # noqa: WPS212
269269
)
270270

271271
if attachment_type == AttachmentTypes.VOICE:
272-
attachment_type = cast(
272+
attachment_type = cast( # type: ignore[redundant-cast]
273273
Literal[AttachmentTypes.VOICE],
274274
attachment_type,
275-
) # type: ignore[redundant-cast]
275+
)
276276
api_attachment = cast(BotAPIAttachmentVoice, api_attachment)
277277
content = decode_rfc2397(api_attachment.data.content)
278278
attachment_extension = get_attachment_extension_from_encoded_content(
@@ -289,10 +289,10 @@ def convert_api_attachment_to_domain( # noqa: WPS212
289289
)
290290

291291
if attachment_type == AttachmentTypes.LOCATION:
292-
attachment_type = cast(
292+
attachment_type = cast( # type: ignore[redundant-cast]
293293
Literal[AttachmentTypes.LOCATION],
294294
attachment_type,
295-
) # type: ignore[redundant-cast]
295+
)
296296
api_attachment = cast(BotAPIAttachmentLocation, api_attachment)
297297

298298
return Location(
@@ -303,10 +303,10 @@ def convert_api_attachment_to_domain( # noqa: WPS212
303303
)
304304

305305
if attachment_type == AttachmentTypes.CONTACT:
306-
attachment_type = cast(
306+
attachment_type = cast( # type: ignore[redundant-cast]
307307
Literal[AttachmentTypes.CONTACT],
308308
attachment_type,
309-
) # type: ignore[redundant-cast]
309+
)
310310
api_attachment = cast(BotAPIAttachmentContact, api_attachment)
311311

312312
return Contact(

0 commit comments

Comments
 (0)