Skip to content

Commit 0396b3b

Browse files
authored
Run mypy with falcon 4.x (#1199)
1 parent f6fc477 commit 0396b3b

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

requirements/adapter.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ chalice>=1.28,<2; python_version>"3.6"
88
CherryPy>=18,<19
99
Django>=3,<6
1010
falcon>=2,<4; python_version<"3.11"
11-
falcon>=3.1.1,<4; python_version>="3.11"
11+
falcon>=3.1.1,<5; python_version>="3.11"
1212
fastapi>=0.70.0,<1
1313
Flask>=1,<4
1414
Werkzeug>=2,<4

slack_bolt/adapter/falcon/async_resource.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from datetime import datetime
22
from http import HTTPStatus
33

4-
from falcon import version as falcon_version # type: ignore[import-untyped]
5-
from falcon.asgi import Request, Response # type: ignore[import-untyped]
4+
from falcon import version as falcon_version
5+
from falcon.asgi import Request, Response
66
from slack_bolt import BoltResponse
77
from slack_bolt.async_app import AsyncApp
88
from slack_bolt.error import BoltError
@@ -41,7 +41,8 @@ async def on_get(self, req: Request, resp: Response):
4141
return
4242

4343
resp.status = "404"
44-
resp.body = "The page is not found..."
44+
# Falcon 4.x w/ mypy fails to correctly infer the str type here
45+
resp.body = "The page is not found..." # type: ignore[assignment]
4546

4647
async def on_post(self, req: Request, resp: Response):
4748
bolt_req = await self._to_bolt_request(req)

slack_bolt/adapter/falcon/resource.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from datetime import datetime
22
from http import HTTPStatus
33

4-
from falcon import Request, Response, version as falcon_version # type: ignore[import-untyped]
4+
from falcon import Request, Response, version as falcon_version
55

66
from slack_bolt import BoltResponse
77
from slack_bolt.app import App
@@ -35,7 +35,8 @@ def on_get(self, req: Request, resp: Response):
3535
return
3636

3737
resp.status = "404"
38-
resp.body = "The page is not found..."
38+
# Falcon 4.x w/ mypy fails to correctly infer the str type here
39+
resp.body = "The page is not found..." # type: ignore[assignment]
3940

4041
def on_post(self, req: Request, resp: Response):
4142
bolt_req = self._to_bolt_request(req)
@@ -51,7 +52,8 @@ def _to_bolt_request(self, req: Request) -> BoltRequest:
5152

5253
def _write_response(self, bolt_resp: BoltResponse, resp: Response):
5354
if falcon_version.__version__.startswith("2."):
54-
resp.body = bolt_resp.body
55+
# Falcon 4.x w/ mypy fails to correctly infer the str type here
56+
resp.body = bolt_resp.body # type: ignore[assignment]
5557
else:
5658
resp.text = bolt_resp.body
5759

0 commit comments

Comments
 (0)