Skip to content

Commit

Permalink
Apply code formatter's changes
Browse files Browse the repository at this point in the history
  • Loading branch information
seratch committed Dec 19, 2020
1 parent 7d35ae3 commit 809e255
Show file tree
Hide file tree
Showing 155 changed files with 2,058 additions and 650 deletions.
9 changes: 5 additions & 4 deletions examples/app_authorize.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@
# ------------------------------------------------

import logging

logging.basicConfig(level=logging.DEBUG)

import os
from slack_bolt import App
from slack_bolt.authorization import AuthorizeResult
from slack_sdk import WebClient


def authorize(enterprise_id, team_id, user_id, client: WebClient, logger):
logger.info(f"{enterprise_id},{team_id},{user_id}")
# You can implement your own logic here
Expand All @@ -23,10 +25,9 @@ def authorize(enterprise_id, team_id, user_id, client: WebClient, logger):
bot_token=token,
)

app = App(
signing_secret=os.environ["SLACK_SIGNING_SECRET"],
authorize=authorize
)

app = App(signing_secret=os.environ["SLACK_SIGNING_SECRET"], authorize=authorize)


@app.command("/hello-bolt-python")
def hello_command(ack, body):
Expand Down
7 changes: 3 additions & 4 deletions examples/async_app_authorize.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from slack_bolt.authorization import AuthorizeResult
from slack_bolt.async_app import AsyncApp


async def authorize(enterprise_id, team_id, user_id, client: AsyncWebClient, logger):
logger.info(f"{enterprise_id},{team_id},{user_id}")
# You can implement your own logic here
Expand All @@ -24,10 +25,8 @@ async def authorize(enterprise_id, team_id, user_id, client: AsyncWebClient, log
)


app = AsyncApp(
signing_secret=os.environ["SLACK_SIGNING_SECRET"],
authorize=authorize
)
app = AsyncApp(signing_secret=os.environ["SLACK_SIGNING_SECRET"], authorize=authorize)


@app.event("app_mention")
async def event_test(body, say, logger):
Expand Down
23 changes: 16 additions & 7 deletions examples/async_steps_from_apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@

from slack_sdk.web.async_client import AsyncSlackResponse, AsyncWebClient
from slack_bolt.async_app import AsyncApp, AsyncAck
from slack_bolt.workflows.step.async_step import AsyncConfigure, AsyncUpdate, AsyncComplete, AsyncFail
from slack_bolt.workflows.step.async_step import (
AsyncConfigure,
AsyncUpdate,
AsyncComplete,
AsyncFail,
)

logging.basicConfig(level=logging.DEBUG)

Expand Down Expand Up @@ -93,7 +98,11 @@ async def save(ack: AsyncAck, view: dict, update: AsyncUpdate):
},
},
outputs=[
{"name": "taskName", "type": "text", "label": "Task Name", },
{
"name": "taskName",
"type": "text",
"label": "Task Name",
},
{
"name": "taskDescription",
"type": "text",
Expand All @@ -104,15 +113,17 @@ async def save(ack: AsyncAck, view: dict, update: AsyncUpdate):
"type": "text",
"label": "Task Author Email",
},
]
],
)
await ack()


pseudo_database = {}


async def execute(step: dict, client: AsyncWebClient, complete: AsyncComplete, fail: AsyncFail):
async def execute(
step: dict, client: AsyncWebClient, complete: AsyncComplete, fail: AsyncFail
):
try:
await complete(
outputs={
Expand Down Expand Up @@ -152,9 +163,7 @@ async def execute(step: dict, client: AsyncWebClient, complete: AsyncComplete, f
},
)
except:
await fail(error={
"message": "Something wrong!"
})
await fail(error={"message": "Something wrong!"})


app.step(
Expand Down
6 changes: 5 additions & 1 deletion examples/async_steps_from_apps_primitive.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ async def save(ack: AsyncAck, client: AsyncWebClient, body: dict):
},
},
"outputs": [
{"name": "taskName", "type": "text", "label": "Task Name",},
{
"name": "taskName",
"type": "text",
"label": "Task Name",
},
{
"name": "taskDescription",
"type": "text",
Expand Down
5 changes: 3 additions & 2 deletions examples/aws_chalice/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ def handle_app_mentions(body, say, logger):
def respond_to_slack_within_3_seconds(ack):
ack("Accepted!")


def say_it(say):
time.sleep(5)
say("Done!")


bolt_app.command("/hello-bolt-python-chalice")(
ack=respond_to_slack_within_3_seconds,
lazy=[say_it]
ack=respond_to_slack_within_3_seconds, lazy=[say_it]
)

ChaliceSlackRequestHandler.clear_all_log_handlers()
Expand Down
5 changes: 4 additions & 1 deletion examples/aws_lambda/aws_lambda_oauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
from slack_bolt.adapter.aws_lambda.lambda_s3_oauth_flow import LambdaS3OAuthFlow

# process_before_response must be True when running on FaaS
app = App(process_before_response=True, oauth_flow=LambdaS3OAuthFlow(),)
app = App(
process_before_response=True,
oauth_flow=LambdaS3OAuthFlow(),
)


@app.event("app_mention")
Expand Down
3 changes: 1 addition & 2 deletions examples/dialogs_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def dialog_submission_or_cancellation(ack: Ack, body: dict):
errors = [
{
"name": "loc_origin",
"error": "Pickup Location must be longer than 3 characters"
"error": "Pickup Location must be longer than 3 characters",
}
]
if len(errors) > 0:
Expand Down Expand Up @@ -116,7 +116,6 @@ def dialog_suggestion(ack):
)



if __name__ == "__main__":
app.start(3000)

Expand Down
129 changes: 82 additions & 47 deletions examples/django/slackapp/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,69 +7,104 @@ class Migration(migrations.Migration):

initial = True

dependencies = [
]
dependencies = []

operations = [
migrations.CreateModel(
name='SlackBot',
name="SlackBot",
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('client_id', models.TextField()),
('app_id', models.TextField()),
('enterprise_id', models.TextField(null=True)),
('enterprise_name', models.TextField(null=True)),
('team_id', models.TextField(null=True)),
('team_name', models.TextField(null=True)),
('bot_token', models.TextField(null=True)),
('bot_id', models.TextField(null=True)),
('bot_user_id', models.TextField(null=True)),
('bot_scopes', models.TextField(null=True)),
('is_enterprise_install', models.BooleanField(null=True)),
('installed_at', models.DateTimeField()),
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("client_id", models.TextField()),
("app_id", models.TextField()),
("enterprise_id", models.TextField(null=True)),
("enterprise_name", models.TextField(null=True)),
("team_id", models.TextField(null=True)),
("team_name", models.TextField(null=True)),
("bot_token", models.TextField(null=True)),
("bot_id", models.TextField(null=True)),
("bot_user_id", models.TextField(null=True)),
("bot_scopes", models.TextField(null=True)),
("is_enterprise_install", models.BooleanField(null=True)),
("installed_at", models.DateTimeField()),
],
),
migrations.CreateModel(
name='SlackInstallation',
name="SlackInstallation",
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('client_id', models.TextField()),
('app_id', models.TextField()),
('enterprise_id', models.TextField(null=True)),
('enterprise_name', models.TextField(null=True)),
('enterprise_url', models.TextField(null=True)),
('team_id', models.TextField(null=True)),
('team_name', models.TextField(null=True)),
('bot_token', models.TextField(null=True)),
('bot_id', models.TextField(null=True)),
('bot_user_id', models.TextField(null=True)),
('bot_scopes', models.TextField(null=True)),
('user_id', models.TextField()),
('user_token', models.TextField(null=True)),
('user_scopes', models.TextField(null=True)),
('incoming_webhook_url', models.TextField(null=True)),
('incoming_webhook_channel', models.TextField(null=True)),
('incoming_webhook_channel_id', models.TextField(null=True)),
('incoming_webhook_configuration_url', models.TextField(null=True)),
('is_enterprise_install', models.BooleanField(null=True)),
('token_type', models.TextField(null=True)),
('installed_at', models.DateTimeField()),
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("client_id", models.TextField()),
("app_id", models.TextField()),
("enterprise_id", models.TextField(null=True)),
("enterprise_name", models.TextField(null=True)),
("enterprise_url", models.TextField(null=True)),
("team_id", models.TextField(null=True)),
("team_name", models.TextField(null=True)),
("bot_token", models.TextField(null=True)),
("bot_id", models.TextField(null=True)),
("bot_user_id", models.TextField(null=True)),
("bot_scopes", models.TextField(null=True)),
("user_id", models.TextField()),
("user_token", models.TextField(null=True)),
("user_scopes", models.TextField(null=True)),
("incoming_webhook_url", models.TextField(null=True)),
("incoming_webhook_channel", models.TextField(null=True)),
("incoming_webhook_channel_id", models.TextField(null=True)),
("incoming_webhook_configuration_url", models.TextField(null=True)),
("is_enterprise_install", models.BooleanField(null=True)),
("token_type", models.TextField(null=True)),
("installed_at", models.DateTimeField()),
],
),
migrations.CreateModel(
name='SlackOAuthState',
name="SlackOAuthState",
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('state', models.TextField()),
('expire_at', models.DateTimeField()),
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("state", models.TextField()),
("expire_at", models.DateTimeField()),
],
),
migrations.AddIndex(
model_name='slackinstallation',
index=models.Index(fields=['client_id', 'enterprise_id', 'team_id', 'user_id', 'installed_at'], name='bolt_slacki_client__62c411_idx'),
model_name="slackinstallation",
index=models.Index(
fields=[
"client_id",
"enterprise_id",
"team_id",
"user_id",
"installed_at",
],
name="bolt_slacki_client__62c411_idx",
),
),
migrations.AddIndex(
model_name='slackbot',
index=models.Index(fields=['client_id', 'enterprise_id', 'team_id', 'installed_at'], name='bolt_slackb_client__be066b_idx'),
model_name="slackbot",
index=models.Index(
fields=["client_id", "enterprise_id", "team_id", "installed_at"],
name="bolt_slackb_client__be066b_idx",
),
),
]
Loading

0 comments on commit 809e255

Please sign in to comment.