Skip to content
This repository was archived by the owner on Mar 27, 2023. It is now read-only.

Commit fe08e92

Browse files
committed
formatted python code with black
1 parent 0b890dc commit fe08e92

File tree

26 files changed

+63
-153
lines changed

26 files changed

+63
-153
lines changed

backend/apps/accounts/admin.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,7 @@ class CustomUserAdmin(UserAdmin):
2828
None,
2929
{
3030
"classes": ("wide",),
31-
"fields": (
32-
"email",
33-
"password1",
34-
"password2",
35-
"is_staff",
36-
"is_active",
37-
),
31+
"fields": ("email", "password1", "password2", "is_staff", "is_active",),
3832
},
3933
),
4034
)

backend/apps/accounts/migrations/0001_initial.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,13 @@ class Migration(migrations.Migration):
7474
(
7575
"date_joined",
7676
models.DateTimeField(
77-
default=django.utils.timezone.now,
78-
verbose_name="date joined",
77+
default=django.utils.timezone.now, verbose_name="date joined",
7978
),
8079
),
8180
(
8281
"email",
8382
models.EmailField(
84-
max_length=254,
85-
unique=True,
86-
verbose_name="email address",
83+
max_length=254, unique=True, verbose_name="email address",
8784
),
8885
),
8986
(

backend/apps/accounts/migrations/0002_auto_20201117_0735.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@
66
class Migration(migrations.Migration):
77

88
dependencies = [
9-
('accounts', '0001_initial'),
9+
("accounts", "0001_initial"),
1010
]
1111

1212
operations = [
1313
migrations.AlterField(
14-
model_name='customuser',
15-
name='first_name',
16-
field=models.CharField(blank=True, max_length=150, verbose_name='first name'),
14+
model_name="customuser",
15+
name="first_name",
16+
field=models.CharField(
17+
blank=True, max_length=150, verbose_name="first name"
18+
),
1719
),
1820
]

backend/apps/accounts/tests.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@
99

1010
class UsersManagersTests(TestCase):
1111
def test_create_user(self):
12-
user = User.objects.create_user(
13-
email="normal@user.com", password="foo"
14-
)
12+
user = User.objects.create_user(email="normal@user.com", password="foo")
1513
self.assertEqual(user.email, "normal@user.com")
1614
self.assertTrue(user.is_active)
1715
self.assertFalse(user.is_staff)
@@ -58,17 +56,13 @@ def test_obtain_jwt(self):
5856
u.save()
5957

6058
resp = self.client.post(
61-
url,
62-
{"email": "user@foo.com", "password": "password"},
63-
format="json",
59+
url, {"email": "user@foo.com", "password": "password"}, format="json",
6460
)
6561
self.assertEqual(resp.status_code, status.HTTP_401_UNAUTHORIZED)
6662
u.is_active = True
6763
u.save()
6864
resp = self.client.post(
69-
url,
70-
{"email": "user@foo.com", "password": "password"},
71-
format="json",
65+
url, {"email": "user@foo.com", "password": "password"}, format="json",
7266
)
7367
self.assertEqual(resp.status_code, status.HTTP_200_OK)
7468
self.assertTrue("access" in resp.data)

backend/apps/accounts/urls.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,12 @@
44

55

66
urlpatterns = [
7-
path('login-set-cookie/', views.login_set_cookie, name="login-view"),
8-
path('login/', views.login_view, name="login-view"),
9-
path('logout/', views.logout_view, name="logout-view"),
10-
path(
11-
"users/profile/",
12-
views.Profile.as_view(),
13-
name="user-profile",
14-
),
7+
path("login-set-cookie/", views.login_set_cookie, name="login-view"),
8+
path("login/", views.login_view, name="login-view"),
9+
path("logout/", views.logout_view, name="logout-view"),
10+
path("users/profile/", views.Profile.as_view(), name="user-profile",),
1511
# Social Auth Callbacks
16-
path(
17-
"social/<backend>/",
18-
views.exchange_token,
19-
name="social-auth",
20-
),
12+
path("social/<backend>/", views.exchange_token, name="social-auth",),
2113
]
2214

2315
urlpatterns += [

backend/apps/accounts/views.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ def login_view(request):
4343
and HttpOnly cookie, the `sessionid` cookie
4444
"""
4545
data = json.loads(request.body)
46-
email = data.get('email')
47-
password = data.get('password')
46+
email = data.get("email")
47+
password = data.get("password")
4848
if email is None or password is None:
4949
return JsonResponse(
5050
{"errors": {"__all__": "Please enter both username and password"}},
@@ -71,10 +71,7 @@ class SocialSerializer(serializers.Serializer):
7171
Serializer which accepts an OAuth2 code.
7272
"""
7373

74-
code = serializers.CharField(
75-
allow_blank=False,
76-
trim_whitespace=True,
77-
)
74+
code = serializers.CharField(allow_blank=False, trim_whitespace=True,)
7875

7976

8077
@api_view(http_method_names=["POST"])

backend/apps/banking/migrations/0002_auto_20200126_1558.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ class Migration(migrations.Migration):
1515
model_name="statementfile",
1616
name="statement_file",
1717
field=models.FileField(
18-
storage=django.core.files.storage.FileSystemStorage(
19-
location="/code/"
20-
),
18+
storage=django.core.files.storage.FileSystemStorage(location="/code/"),
2119
upload_to="",
2220
),
2321
),

backend/apps/banking/migrations/0005_auto_20200606_1325.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77
class Migration(migrations.Migration):
88

99
dependencies = [
10-
('banking', '0004_transaction_source_file'),
10+
("banking", "0004_transaction_source_file"),
1111
]
1212

1313
operations = [
1414
migrations.AlterField(
15-
model_name='statementfile',
16-
name='statement_file',
15+
model_name="statementfile",
16+
name="statement_file",
1717
field=models.FileField(
1818
storage=backend.storage_backends.PrivateMediaStorage,
19-
upload_to='banking',
19+
upload_to="banking",
2020
),
2121
),
2222
]

backend/apps/banking/models.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66

77

88
class StatementFile(models.Model):
9-
statement_file = models.FileField(
10-
storage=PrivateMediaStorage, upload_to="banking"
11-
)
9+
statement_file = models.FileField(storage=PrivateMediaStorage, upload_to="banking")
1210
month = models.DateField(null=False, blank=False)
1311

1412
def __str__(self):

backend/apps/banking/tasks.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ def process_statement_file(self, statement_file_id):
2222
of the transactions with one bulk create database operation
2323
"""
2424

25-
statement_file = StatementFile.objects.get(
26-
id=statement_file_id
27-
).statement_file
25+
statement_file = StatementFile.objects.get(id=statement_file_id).statement_file
2826
file_data = statement_file.read().decode("utf-8")
2927
csv_data = csv.DictReader(StringIO(file_data), delimiter=",")
3028

0 commit comments

Comments
 (0)