Skip to content

Commit 92de2ca

Browse files
committed
make format
1 parent cab40b9 commit 92de2ca

File tree

10 files changed

+83
-65
lines changed

10 files changed

+83
-65
lines changed

intbot/core/apps.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33

44
class CoreConfig(AppConfig):
5-
default_auto_field = 'django.db.models.BigAutoField'
6-
name = 'core'
5+
default_auto_field = "django.db.models.BigAutoField"
6+
name = "core"

intbot/core/endpoints/webhooks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def verify_internal_webhook(request):
3131
if "Authorization" not in request.headers:
3232
raise ValueError("Authorization token is missing")
3333

34-
token = request.headers['Authorization']
34+
token = request.headers["Authorization"]
3535

3636
if not hmac.compare_digest(settings.WEBHOOK_INTERNAL_TOKEN, token):
3737
raise ValueError("Token doesn't match")

intbot/core/migrations/0001_initial_migration.py

Lines changed: 37 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,53 @@
55

66

77
class Migration(migrations.Migration):
8-
98
initial = True
109

11-
dependencies = [
12-
]
10+
dependencies = []
1311

1412
operations = [
1513
migrations.CreateModel(
16-
name='DiscordMessage',
14+
name="DiscordMessage",
1715
fields=[
18-
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
19-
('uuid', models.UUIDField(default=uuid.uuid4)),
20-
('channel_id', models.CharField(max_length=255)),
21-
('channel_name', models.CharField(max_length=255)),
22-
('content', models.TextField()),
23-
('created_at', models.DateTimeField(auto_now_add=True)),
24-
('modified_at', models.DateTimeField(auto_now=True)),
25-
('sent_at', models.DateTimeField(blank=True, null=True)),
16+
(
17+
"id",
18+
models.BigAutoField(
19+
auto_created=True,
20+
primary_key=True,
21+
serialize=False,
22+
verbose_name="ID",
23+
),
24+
),
25+
("uuid", models.UUIDField(default=uuid.uuid4)),
26+
("channel_id", models.CharField(max_length=255)),
27+
("channel_name", models.CharField(max_length=255)),
28+
("content", models.TextField()),
29+
("created_at", models.DateTimeField(auto_now_add=True)),
30+
("modified_at", models.DateTimeField(auto_now=True)),
31+
("sent_at", models.DateTimeField(blank=True, null=True)),
2632
],
2733
),
2834
migrations.CreateModel(
29-
name='Webhook',
35+
name="Webhook",
3036
fields=[
31-
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
32-
('uuid', models.UUIDField(default=uuid.uuid4)),
33-
('source', models.CharField(max_length=255)),
34-
('event', models.CharField(max_length=255)),
35-
('signature', models.CharField(max_length=255)),
36-
('meta', models.JSONField()),
37-
('content', models.JSONField()),
38-
('created_at', models.DateTimeField(auto_now_add=True)),
39-
('modified_at', models.DateTimeField(auto_now=True)),
40-
('processed_at', models.DateTimeField(blank=True, null=True)),
37+
(
38+
"id",
39+
models.BigAutoField(
40+
auto_created=True,
41+
primary_key=True,
42+
serialize=False,
43+
verbose_name="ID",
44+
),
45+
),
46+
("uuid", models.UUIDField(default=uuid.uuid4)),
47+
("source", models.CharField(max_length=255)),
48+
("event", models.CharField(max_length=255)),
49+
("signature", models.CharField(max_length=255)),
50+
("meta", models.JSONField()),
51+
("content", models.JSONField()),
52+
("created_at", models.DateTimeField(auto_now_add=True)),
53+
("modified_at", models.DateTimeField(auto_now=True)),
54+
("processed_at", models.DateTimeField(blank=True, null=True)),
4155
],
4256
),
4357
]

intbot/intbot/asgi.py

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

1212
from django.core.asgi import get_asgi_application
1313

14-
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'intbot.settings')
14+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "intbot.settings")
1515

1616
application = get_asgi_application()

intbot/intbot/settings.py

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -20,76 +20,76 @@
2020

2121

2222
INSTALLED_APPS = [
23-
'django.contrib.admin',
24-
'django.contrib.auth',
25-
'django.contrib.contenttypes',
26-
'django.contrib.sessions',
27-
'django.contrib.messages',
28-
'django.contrib.staticfiles',
23+
"django.contrib.admin",
24+
"django.contrib.auth",
25+
"django.contrib.contenttypes",
26+
"django.contrib.sessions",
27+
"django.contrib.messages",
28+
"django.contrib.staticfiles",
2929
# Third party apps
3030
"django_extensions",
3131
# Project apps
3232
"core",
3333
]
3434

3535
MIDDLEWARE = [
36-
'django.middleware.security.SecurityMiddleware',
36+
"django.middleware.security.SecurityMiddleware",
3737
# Whitenoise to serve static files
3838
"whitenoise.middleware.WhiteNoiseMiddleware",
39-
'django.contrib.sessions.middleware.SessionMiddleware',
40-
'django.middleware.common.CommonMiddleware',
41-
'django.middleware.csrf.CsrfViewMiddleware',
42-
'django.contrib.auth.middleware.AuthenticationMiddleware',
43-
'django.contrib.messages.middleware.MessageMiddleware',
44-
'django.middleware.clickjacking.XFrameOptionsMiddleware',
39+
"django.contrib.sessions.middleware.SessionMiddleware",
40+
"django.middleware.common.CommonMiddleware",
41+
"django.middleware.csrf.CsrfViewMiddleware",
42+
"django.contrib.auth.middleware.AuthenticationMiddleware",
43+
"django.contrib.messages.middleware.MessageMiddleware",
44+
"django.middleware.clickjacking.XFrameOptionsMiddleware",
4545
]
4646

47-
ROOT_URLCONF = 'intbot.urls'
47+
ROOT_URLCONF = "intbot.urls"
4848

4949
TEMPLATES = [
5050
{
51-
'BACKEND': 'django.template.backends.django.DjangoTemplates',
52-
'DIRS': [],
53-
'APP_DIRS': True,
54-
'OPTIONS': {
55-
'context_processors': [
56-
'django.template.context_processors.debug',
57-
'django.template.context_processors.request',
58-
'django.contrib.auth.context_processors.auth',
59-
'django.contrib.messages.context_processors.messages',
51+
"BACKEND": "django.template.backends.django.DjangoTemplates",
52+
"DIRS": [],
53+
"APP_DIRS": True,
54+
"OPTIONS": {
55+
"context_processors": [
56+
"django.template.context_processors.debug",
57+
"django.template.context_processors.request",
58+
"django.contrib.auth.context_processors.auth",
59+
"django.contrib.messages.context_processors.messages",
6060
],
6161
},
6262
},
6363
]
6464

65-
WSGI_APPLICATION = 'intbot.wsgi.application'
65+
WSGI_APPLICATION = "intbot.wsgi.application"
6666

6767

6868
# Password validation
6969
# https://docs.djangoproject.com/en/5.1/ref/settings/#auth-password-validators
7070

7171
AUTH_PASSWORD_VALIDATORS = [
7272
{
73-
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
73+
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
7474
},
7575
{
76-
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
76+
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
7777
},
7878
{
79-
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
79+
"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
8080
},
8181
{
82-
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
82+
"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
8383
},
8484
]
8585

8686

8787
# Internationalization
8888
# https://docs.djangoproject.com/en/5.1/topics/i18n/
8989

90-
LANGUAGE_CODE = 'en-us'
90+
LANGUAGE_CODE = "en-us"
9191

92-
TIME_ZONE = 'UTC'
92+
TIME_ZONE = "UTC"
9393

9494
USE_I18N = True
9595

@@ -105,7 +105,7 @@
105105

106106
# Default primary key field type
107107
# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field
108-
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
108+
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
109109

110110
DJANGO_ENV = os.environ["DJANGO_ENV"]
111111
APP_VERSION = os.environ.get("APP_VERSION", "latest")[:8]

intbot/intbot/urls.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
from core.endpoints.webhooks import internal_webhook_endpoint
66

77
urlpatterns = [
8-
path('admin/', admin.site.urls),
9-
path('', index),
8+
path("admin/", admin.site.urls),
9+
path("", index),
1010
# Internal Webhooks
11-
path('webhook/internal/', internal_webhook_endpoint),
11+
path("webhook/internal/", internal_webhook_endpoint),
1212
]

intbot/intbot/wsgi.py

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

1212
from django.core.wsgi import get_wsgi_application
1313

14-
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'intbot.settings')
14+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "intbot.settings")
1515

1616
application = get_wsgi_application()

intbot/manage.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
#!/usr/bin/env python
22
"""Django's command-line utility for administrative tasks."""
3+
34
import os
45
import sys
56

67

78
def main():
89
"""Run administrative tasks."""
9-
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'intbot.settings')
10+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "intbot.settings")
1011
try:
1112
from django.core.management import execute_from_command_line
1213
except ImportError as exc:
@@ -18,5 +19,5 @@ def main():
1819
execute_from_command_line(sys.argv)
1920

2021

21-
if __name__ == '__main__':
22+
if __name__ == "__main__":
2223
main()

intbot/tests/test_basic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
22
This file is currently used to test the test harness.
33
4-
It checks whether the tests
4+
It checks whether the tests
55
* are running
66
* can access databse
77
* can reach the views

intbot/tests/test_webhooks.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from django.conf import settings
33
from core.models import Webhook
44

5+
56
@pytest.mark.django_db
67
def test_internal_wh_endpoint_checks_authorization_token(client):
78
webhook_body = {
@@ -22,6 +23,7 @@ def test_internal_wh_endpoint_checks_authorization_token(client):
2223
assert response.json()["status"] == "bad"
2324
assert response.json()["message"] == "Authorization token is missing"
2425

26+
2527
@pytest.mark.django_db
2628
def test_internal_wh_endpoint_fails_with_bad_token(client):
2729
webhook_body = {
@@ -43,6 +45,7 @@ def test_internal_wh_endpoint_fails_with_bad_token(client):
4345
assert response.json()["status"] == "bad"
4446
assert response.json()["message"] == "Token doesn't match"
4547

48+
4649
@pytest.mark.django_db
4750
def test_internal_wh_endpoint_works_with_correct_token(client):
4851
webhook_body = {

0 commit comments

Comments
 (0)