Skip to content

Commit 3457fb1

Browse files
authored
Merge pull request #662 from seratch/black-flake8-consistency
Make the flake8 and black settings consistent
2 parents cfc9daa + 844b38d commit 3457fb1

File tree

159 files changed

+682
-2136
lines changed

Some content is hidden

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

159 files changed

+682
-2136
lines changed

.git-blame-ignore-revs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# change black settings
2+
0e4cd56b69e8f83166cd262f762802b7f18c3d21

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# black project prefers pyproject.toml
2+
# that's why we have this file in addition to other setting files
3+
[tool.black]
4+
line-length = 125

scripts/build_pypi_package.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ cd ${script_dir}/..
55
rm -rf ./slack_bolt.egg-info
66

77
pip install -U pip && \
8-
python setup.py test && \
98
pip install twine wheel && \
109
rm -rf dist/ build/ slack_bolt.egg-info/ && \
1110
python setup.py sdist bdist_wheel && \

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
universal = 1
33

44
[aliases]
5-
test=pytest
5+
test=pytest

slack_bolt/adapter/aws_lambda/chalice_handler.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ class ChaliceSlackRequestHandler:
2121
def __init__(self, app: App, chalice: Chalice, lambda_client: Optional[BaseClient] = None): # type: ignore
2222
self.app = app
2323
self.chalice = chalice
24-
self.logger = get_bolt_app_logger(
25-
app.name, ChaliceSlackRequestHandler, app.logger
26-
)
24+
self.logger = get_bolt_app_logger(app.name, ChaliceSlackRequestHandler, app.logger)
2725

2826
if getenv("AWS_CHALICE_CLI_MODE") == "true" and lambda_client is None:
2927
try:
@@ -64,10 +62,7 @@ def handle(self, request: Request):
6462
bolt_req: BoltRequest = to_bolt_request(request, body)
6563
query = bolt_req.query
6664
is_callback = query is not None and (
67-
(
68-
_first_value(query, "code") is not None
69-
and _first_value(query, "state") is not None
70-
)
65+
(_first_value(query, "code") is not None and _first_value(query, "state") is not None)
7166
or _first_value(query, "error") is not None
7267
)
7368
if is_callback:

slack_bolt/adapter/aws_lambda/chalice_lazy_listener_runner.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ def start(self, function: Callable[..., None], request: BoltRequest) -> None:
2020

2121
chalice_request: dict = request.context["chalice_request"]
2222
request.headers["x-slack-bolt-lazy-only"] = ["1"]
23-
request.headers["x-slack-bolt-lazy-function-name"] = [
24-
request.lazy_function_name
25-
]
23+
request.headers["x-slack-bolt-lazy-function-name"] = [request.lazy_function_name]
2624
payload = {
2725
"method": "NONE",
2826
"headers": {k: v[0] for k, v in request.headers.items()},

slack_bolt/adapter/aws_lambda/handler.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ class SlackRequestHandler:
1515
def __init__(self, app: App): # type: ignore
1616
self.app = app
1717
self.logger = get_bolt_app_logger(app.name, SlackRequestHandler, app.logger)
18-
self.app.listener_runner.lazy_listener_runner = LambdaLazyListenerRunner(
19-
self.logger
20-
)
18+
self.app.listener_runner.lazy_listener_runner = LambdaLazyListenerRunner(self.logger)
2119
if self.app.oauth_flow is not None:
2220
self.app.oauth_flow.settings.redirect_uri_page_renderer.install_path = "?"
2321

@@ -44,10 +42,7 @@ def handle(self, event, context):
4442
bolt_req: BoltRequest = to_bolt_request(event)
4543
query = bolt_req.query
4644
is_callback = query is not None and (
47-
(
48-
_first_value(query, "code") is not None
49-
and _first_value(query, "state") is not None
50-
)
45+
(_first_value(query, "code") is not None and _first_value(query, "state") is not None)
5146
or _first_value(query, "error") is not None
5247
)
5348
if is_callback:

slack_bolt/adapter/aws_lambda/lambda_s3_oauth_flow.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,26 +30,18 @@ def __init__(
3030
client_id=os.environ["SLACK_CLIENT_ID"],
3131
client_secret=os.environ["SLACK_CLIENT_SECRET"],
3232
)
33-
oauth_state_bucket_name = (
34-
oauth_state_bucket_name or os.environ["SLACK_STATE_S3_BUCKET_NAME"]
35-
)
36-
installation_bucket_name = (
37-
installation_bucket_name or os.environ["SLACK_INSTALLATION_S3_BUCKET_NAME"]
38-
)
33+
oauth_state_bucket_name = oauth_state_bucket_name or os.environ["SLACK_STATE_S3_BUCKET_NAME"]
34+
installation_bucket_name = installation_bucket_name or os.environ["SLACK_INSTALLATION_S3_BUCKET_NAME"]
3935
self.s3_client = boto3.client("s3")
40-
if settings.state_store is None or not isinstance(
41-
settings.state_store, AmazonS3OAuthStateStore
42-
):
36+
if settings.state_store is None or not isinstance(settings.state_store, AmazonS3OAuthStateStore):
4337
settings.state_store = AmazonS3OAuthStateStore(
4438
logger=logger,
4539
s3_client=self.s3_client,
4640
bucket_name=oauth_state_bucket_name,
4741
expiration_seconds=settings.state_expiration_seconds,
4842
)
4943

50-
if settings.installation_store is None or not isinstance(
51-
settings.installation_store, AmazonS3InstallationStore
52-
):
44+
if settings.installation_store is None or not isinstance(settings.installation_store, AmazonS3InstallationStore):
5345
settings.installation_store = AmazonS3InstallationStore(
5446
logger=logger,
5547
s3_client=self.s3_client,

slack_bolt/adapter/aws_lambda/lazy_listener_runner.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ def start(self, function: Callable[..., None], request: BoltRequest) -> None:
2020
event: dict = request.context["lambda_request"]
2121
headers = event["headers"]
2222
headers["x-slack-bolt-lazy-only"] = "1" # not an array
23-
headers[
24-
"x-slack-bolt-lazy-function-name"
25-
] = request.lazy_function_name # not an array
23+
headers["x-slack-bolt-lazy-function-name"] = request.lazy_function_name # not an array
2624
event["method"] = "NONE"
2725
invocation = self.lambda_client.invoke(
2826
FunctionName=request.context["aws_lambda_function_name"],

slack_bolt/adapter/aws_lambda/local_lambda_client.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ def invoke(
1919
Payload: str = "{}",
2020
) -> InvokeResponse:
2121
scoped = self._config.scope(self._config.chalice_stage, FunctionName)
22-
lambda_context = LambdaContext(
23-
FunctionName, memory_size=scoped.lambda_memory_size
24-
)
22+
lambda_context = LambdaContext(FunctionName, memory_size=scoped.lambda_memory_size)
2523

2624
with self._patched_env_vars(scoped.environment_variables):
2725
response = self._app(json.loads(Payload), lambda_context)

0 commit comments

Comments
 (0)