Skip to content

Commit 976d840

Browse files
authored
Enable pytype (slackapi#39)
* Enable pytype
1 parent df0a3c9 commit 976d840

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+140
-111
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,5 @@ logs/
3737

3838
.env*
3939
*.db
40+
41+
.pytype/

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@ python:
44
- "3.6"
55
- "3.7"
66
- "3.8"
7-
- "3.8-dev" # 3.8 development branch
8-
- "nightly" # nightly build
97
install:
108
- python setup.py install
119
- pip install -U pip
1210
- pip install "pytest>=5,<6"
11+
- pip install "pytype"
1312
script:
1413
# testing without aiohttp
1514
- travis_retry pytest tests/scenario_tests/
@@ -18,3 +17,5 @@ script:
1817
- travis_retry pytest tests/async_scenario_tests/
1918
# run all tests just in case
2019
- travis_retry python setup.py test
20+
# Run pytype only for Python 3.8
21+
- if [ ${TRAVIS_PYTHON_VERSION:0:3} == "3.8" ]; then pip install -e ".[adapter]"; pytype slack_bolt/; fi

samples/fastapi/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
fastapi>=0.54,<0.55
1+
fastapi<1
22
uvicorn<1

scripts/run_tests.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ cd ${script_dir}/..
88

99
pip install -e ".[testing]" && \
1010
black slack_bolt/ tests/ && \
11-
pytest $1
11+
pytest $1 && \
12+
pytype slack_bolt/

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"pytest-asyncio<1", # for async
1717
"aiohttp>=3,<4", # for async
1818
"black==19.10b0",
19+
"pytype",
1920
]
2021

2122
setuptools.setup(
@@ -58,7 +59,7 @@
5859
"click>=7,<8", # for chalice
5960
"Django>=3,<4",
6061
"falcon>=2,<3",
61-
"fastapi>=0.54,<0.55",
62+
"fastapi<1",
6263
"Flask>=1,<2",
6364
"pyramid>=1,<2",
6465
"sanic>=20,<21",

slack_bolt/adapter/aws_lambda/chalice_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212

1313
class ChaliceSlackRequestHandler:
14-
def __init__(self, app: App, chalice: Chalice):
14+
def __init__(self, app: App, chalice: Chalice): # type: ignore
1515
self.app = app
1616
self.chalice = chalice
1717
self.logger = get_bolt_app_logger(app.name, ChaliceSlackRequestHandler)

slack_bolt/adapter/aws_lambda/handler.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import base64
22
import logging
3-
from typing import List, Dict
3+
from typing import List, Dict, Any
44

55
from slack_bolt.adapter.aws_lambda.internals import _first_value
66
from slack_bolt.app import App
@@ -11,7 +11,7 @@
1111

1212

1313
class SlackRequestHandler:
14-
def __init__(self, app: App):
14+
def __init__(self, app: App): # type: ignore
1515
self.app = app
1616
self.logger = get_bolt_app_logger(app.name, SlackRequestHandler)
1717

@@ -68,15 +68,15 @@ def to_bolt_request(event) -> BoltRequest:
6868
)
6969

7070

71-
def to_aws_response(resp: BoltResponse) -> Dict[str, any]:
71+
def to_aws_response(resp: BoltResponse) -> Dict[str, Any]:
7272
return {
7373
"statusCode": resp.status,
7474
"body": resp.body,
7575
"headers": resp.first_headers(),
7676
}
7777

7878

79-
def not_found() -> Dict[str, any]:
79+
def not_found() -> Dict[str, Any]:
8080
return {
8181
"statusCode": 404,
8282
"body": "Not Found",

slack_bolt/adapter/bottle/handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def set_response(bolt_resp: BoltResponse, resp: Response) -> None:
2020

2121

2222
class SlackRequestHandler:
23-
def __init__(self, app: App):
23+
def __init__(self, app: App): # type: ignore
2424
self.app = app
2525

2626
def handle(self, req: Request, resp: Response) -> str:

slack_bolt/adapter/django/handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def to_django_response(bolt_resp: BoltResponse) -> HttpResponse:
3939

4040

4141
class SlackRequestHandler:
42-
def __init__(self, app: App):
42+
def __init__(self, app: App): # type: ignore
4343
self.app = app
4444

4545
def handle(self, req: HttpRequest) -> HttpResponse:

slack_bolt/adapter/falcon/resource.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class SlackAppResource:
1818
api.add_route("/slack/events", SlackAppResource(app))
1919
"""
2020

21-
def __init__(self, app: App):
21+
def __init__(self, app: App): # type: ignore
2222
self.app = app
2323

2424
def on_get(self, req: Request, resp: Response):

0 commit comments

Comments
 (0)