Skip to content

Commit bc0a644

Browse files
committed
Fixed linter errors
* Reformatted code with black * Added noqa for unused import in generated files
1 parent f88e639 commit bc0a644

File tree

12 files changed

+68
-65
lines changed

12 files changed

+68
-65
lines changed

django-migrations/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ This directory contains the Django project created in the article [Django Migrat
44

55
It is also used in the follow up article [Digging Deeper into Migrations](https://realpython.com/digging-deeper-into-migrations/).
66

7+
**Note:** The code in this directory has been reformatted with black and might therefore differ slightly in codestyle from the code originally generated by Django.
8+
79
## Installation
810

911
This Project has been tested with Python 3.6 and Django 2.1, but you should be able to run it with an Django 2.x and a compatible Python. The recommended way to install it is using `pip` and a virtualenv:

django-migrations/bitcoin_tracker/bitcoin_tracker/settings.py

Lines changed: 38 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/
2121

2222
# SECURITY WARNING: keep the secret key used in production secret!
23-
SECRET_KEY = 'dyf)n0fejvk73!&k5_uq4ce7=e6-0+7sy)rm$w=@rg_!xk!5n3'
23+
SECRET_KEY = "dyf)n0fejvk73!&k5_uq4ce7=e6-0+7sy)rm$w=@rg_!xk!5n3"
2424

2525
# SECURITY WARNING: don't run with debug turned on in production!
2626
DEBUG = True
@@ -31,53 +31,53 @@
3131
# Application definition
3232

3333
INSTALLED_APPS = [
34-
'django.contrib.admin',
35-
'django.contrib.auth',
36-
'django.contrib.contenttypes',
37-
'django.contrib.sessions',
38-
'django.contrib.messages',
39-
'django.contrib.staticfiles',
40-
'historical_data',
34+
"django.contrib.admin",
35+
"django.contrib.auth",
36+
"django.contrib.contenttypes",
37+
"django.contrib.sessions",
38+
"django.contrib.messages",
39+
"django.contrib.staticfiles",
40+
"historical_data",
4141
]
4242

4343
MIDDLEWARE = [
44-
'django.middleware.security.SecurityMiddleware',
45-
'django.contrib.sessions.middleware.SessionMiddleware',
46-
'django.middleware.common.CommonMiddleware',
47-
'django.middleware.csrf.CsrfViewMiddleware',
48-
'django.contrib.auth.middleware.AuthenticationMiddleware',
49-
'django.contrib.messages.middleware.MessageMiddleware',
50-
'django.middleware.clickjacking.XFrameOptionsMiddleware',
44+
"django.middleware.security.SecurityMiddleware",
45+
"django.contrib.sessions.middleware.SessionMiddleware",
46+
"django.middleware.common.CommonMiddleware",
47+
"django.middleware.csrf.CsrfViewMiddleware",
48+
"django.contrib.auth.middleware.AuthenticationMiddleware",
49+
"django.contrib.messages.middleware.MessageMiddleware",
50+
"django.middleware.clickjacking.XFrameOptionsMiddleware",
5151
]
5252

53-
ROOT_URLCONF = 'bitcoin_tracker.urls'
53+
ROOT_URLCONF = "bitcoin_tracker.urls"
5454

5555
TEMPLATES = [
5656
{
57-
'BACKEND': 'django.template.backends.django.DjangoTemplates',
58-
'DIRS': [],
59-
'APP_DIRS': True,
60-
'OPTIONS': {
61-
'context_processors': [
62-
'django.template.context_processors.debug',
63-
'django.template.context_processors.request',
64-
'django.contrib.auth.context_processors.auth',
65-
'django.contrib.messages.context_processors.messages',
66-
],
57+
"BACKEND": "django.template.backends.django.DjangoTemplates",
58+
"DIRS": [],
59+
"APP_DIRS": True,
60+
"OPTIONS": {
61+
"context_processors": [
62+
"django.template.context_processors.debug",
63+
"django.template.context_processors.request",
64+
"django.contrib.auth.context_processors.auth",
65+
"django.contrib.messages.context_processors.messages",
66+
]
6767
},
68-
},
68+
}
6969
]
7070

71-
WSGI_APPLICATION = 'bitcoin_tracker.wsgi.application'
71+
WSGI_APPLICATION = "bitcoin_tracker.wsgi.application"
7272

7373

7474
# Database
7575
# https://docs.djangoproject.com/en/2.1/ref/settings/#databases
7676

7777
DATABASES = {
78-
'default': {
79-
'ENGINE': 'django.db.backends.sqlite3',
80-
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
78+
"default": {
79+
"ENGINE": "django.db.backends.sqlite3",
80+
"NAME": os.path.join(BASE_DIR, "db.sqlite3"),
8181
}
8282
}
8383

@@ -87,26 +87,24 @@
8787

8888
AUTH_PASSWORD_VALIDATORS = [
8989
{
90-
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
91-
},
92-
{
93-
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
90+
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator"
9491
},
92+
{"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator"},
9593
{
96-
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
94+
"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator"
9795
},
9896
{
99-
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
97+
"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator"
10098
},
10199
]
102100

103101

104102
# Internationalization
105103
# https://docs.djangoproject.com/en/2.1/topics/i18n/
106104

107-
LANGUAGE_CODE = 'en-us'
105+
LANGUAGE_CODE = "en-us"
108106

109-
TIME_ZONE = 'UTC'
107+
TIME_ZONE = "UTC"
110108

111109
USE_I18N = True
112110

@@ -118,4 +116,4 @@
118116
# Static files (CSS, JavaScript, Images)
119117
# https://docs.djangoproject.com/en/2.1/howto/static-files/
120118

121-
STATIC_URL = '/static/'
119+
STATIC_URL = "/static/"

django-migrations/bitcoin_tracker/bitcoin_tracker/urls.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,4 @@
1616
from django.contrib import admin
1717
from django.urls import path
1818

19-
urlpatterns = [
20-
path('admin/', admin.site.urls),
21-
]
19+
urlpatterns = [path("admin/", admin.site.urls)]

django-migrations/bitcoin_tracker/bitcoin_tracker/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', 'bitcoin_tracker.settings')
14+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bitcoin_tracker.settings")
1515

1616
application = get_wsgi_application()
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
from django.contrib import admin
1+
from django.contrib import admin # noqa
22

33
# Register your models here.

django-migrations/bitcoin_tracker/historical_data/apps.py

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

33

44
class HistoricalDataConfig(AppConfig):
5-
name = 'historical_data'
5+
name = "historical_data"

django-migrations/bitcoin_tracker/historical_data/migrations/0001_initial.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,24 @@ class Migration(migrations.Migration):
77

88
initial = True
99

10-
dependencies = [
11-
]
10+
dependencies = []
1211

1312
operations = [
1413
migrations.CreateModel(
15-
name='PriceHistory',
14+
name="PriceHistory",
1615
fields=[
17-
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
18-
('date', models.DateTimeField(auto_now_add=True)),
19-
('price', models.DecimalField(decimal_places=2, max_digits=7)),
20-
('volume', models.PositiveIntegerField()),
16+
(
17+
"id",
18+
models.AutoField(
19+
auto_created=True,
20+
primary_key=True,
21+
serialize=False,
22+
verbose_name="ID",
23+
),
24+
),
25+
("date", models.DateTimeField(auto_now_add=True)),
26+
("price", models.DecimalField(decimal_places=2, max_digits=7)),
27+
("volume", models.PositiveIntegerField()),
2128
],
22-
),
29+
)
2330
]

django-migrations/bitcoin_tracker/historical_data/migrations/0002_switch_to_decimals.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,12 @@
55

66
class Migration(migrations.Migration):
77

8-
dependencies = [
9-
('historical_data', '0001_initial'),
10-
]
8+
dependencies = [("historical_data", "0001_initial")]
119

1210
operations = [
1311
migrations.AlterField(
14-
model_name='pricehistory',
15-
name='volume',
12+
model_name="pricehistory",
13+
name="volume",
1614
field=models.DecimalField(decimal_places=3, max_digits=7),
17-
),
15+
)
1816
]

django-migrations/bitcoin_tracker/historical_data/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from django.db import models
22

3-
# Create your models here.
3+
44
class PriceHistory(models.Model):
55
date = models.DateTimeField(auto_now_add=True)
66
price = models.DecimalField(max_digits=7, decimal_places=2)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
from django.test import TestCase
1+
from django.test import TestCase # noqa
22

33
# Create your tests here.

0 commit comments

Comments
 (0)