Skip to content

Commit 3ca7703

Browse files
author
Ross Mechanic
authored
Add black reformatting to all files (#589)
* Add black reformatting to all files * Enforce travis on ci
1 parent 80469cc commit 3ca7703

File tree

5 files changed

+67
-64
lines changed

5 files changed

+67
-64
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
.coverage
66
.idea
77
.tox/
8+
.venv/
89
/.project
910
/.pydevproject
1011
/.ve

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ install:
2525

2626
script:
2727
- flake8 simple_history
28-
- if [[ $TRAVIS_PYTHON_VERSION == '3.6' ]]; then black --check simple_history; fi
29-
- if [[ $TRAVIS_PYTHON_VERSION == '3.7' ]]; then black --check simple_history; fi
28+
- if [[ $TRAVIS_PYTHON_VERSION == '3.6' ]]; then black --check simple_history setup.py runtests.py; fi
29+
- if [[ $TRAVIS_PYTHON_VERSION == '3.7' ]]; then black --check simple_history setup.py runtests.py; fi
3030
- coverage run setup.py test
3131

3232
matrix:

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@ release: dist
4444
twine upload dist/*
4545

4646
format:
47-
black simple_history
47+
black simple_history setup.py runtests.py

runtests.py

Lines changed: 39 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,20 @@
1010

1111
sys.path.insert(0, abspath(dirname(__file__)))
1212

13-
media_root = join(abspath(dirname(__file__)), 'test_files')
13+
media_root = join(abspath(dirname(__file__)), "test_files")
1414
rmtree(media_root, ignore_errors=True)
1515

1616
installed_apps = [
17-
'simple_history.tests',
18-
'simple_history.tests.custom_user',
19-
'simple_history.tests.external',
20-
'simple_history.registry_tests.migration_test_app',
21-
22-
'simple_history',
23-
24-
'django.contrib.contenttypes',
25-
'django.contrib.auth',
26-
'django.contrib.sessions',
27-
'django.contrib.admin',
28-
'django.contrib.messages',
17+
"simple_history.tests",
18+
"simple_history.tests.custom_user",
19+
"simple_history.tests.external",
20+
"simple_history.registry_tests.migration_test_app",
21+
"simple_history",
22+
"django.contrib.contenttypes",
23+
"django.contrib.auth",
24+
"django.contrib.sessions",
25+
"django.contrib.admin",
26+
"django.contrib.messages",
2927
]
3028

3129

@@ -38,51 +36,51 @@ def __getitem__(self, item):
3836

3937

4038
DEFAULT_SETTINGS = dict(
41-
ALLOWED_HOSTS=['localhost'],
42-
AUTH_USER_MODEL='custom_user.CustomUser',
43-
ROOT_URLCONF='simple_history.tests.urls',
39+
ALLOWED_HOSTS=["localhost"],
40+
AUTH_USER_MODEL="custom_user.CustomUser",
41+
ROOT_URLCONF="simple_history.tests.urls",
4442
MEDIA_ROOT=media_root,
45-
STATIC_URL='/static/',
43+
STATIC_URL="/static/",
4644
INSTALLED_APPS=installed_apps,
4745
DATABASES={
48-
'default': {
49-
'ENGINE': 'django.db.backends.sqlite3',
50-
},
51-
'other': {
52-
'ENGINE': 'django.db.backends.sqlite3',
53-
}
46+
"default": {"ENGINE": "django.db.backends.sqlite3"},
47+
"other": {"ENGINE": "django.db.backends.sqlite3"},
5448
},
5549
MIGRATION_MODULES=DisableMigrations(),
56-
TEMPLATES=[{
57-
'BACKEND': 'django.template.backends.django.DjangoTemplates',
58-
'APP_DIRS': True,
59-
'OPTIONS': {
60-
'context_processors': [
61-
'django.contrib.auth.context_processors.auth',
62-
'django.contrib.messages.context_processors.messages',
63-
]
64-
},
65-
}],
50+
TEMPLATES=[
51+
{
52+
"BACKEND": "django.template.backends.django.DjangoTemplates",
53+
"APP_DIRS": True,
54+
"OPTIONS": {
55+
"context_processors": [
56+
"django.contrib.auth.context_processors.auth",
57+
"django.contrib.messages.context_processors.messages",
58+
]
59+
},
60+
}
61+
],
6662
)
6763
MIDDLEWARE = [
68-
'django.contrib.sessions.middleware.SessionMiddleware',
69-
'django.contrib.auth.middleware.AuthenticationMiddleware',
70-
'django.contrib.messages.middleware.MessageMiddleware',
64+
"django.contrib.sessions.middleware.SessionMiddleware",
65+
"django.contrib.auth.middleware.AuthenticationMiddleware",
66+
"django.contrib.messages.middleware.MessageMiddleware",
7167
]
7268

73-
if django.__version__ >= '2.0':
74-
DEFAULT_SETTINGS['MIDDLEWARE'] = MIDDLEWARE
69+
if django.__version__ >= "2.0":
70+
DEFAULT_SETTINGS["MIDDLEWARE"] = MIDDLEWARE
7571
else:
76-
DEFAULT_SETTINGS['MIDDLEWARE_CLASSES'] = MIDDLEWARE
72+
DEFAULT_SETTINGS["MIDDLEWARE_CLASSES"] = MIDDLEWARE
7773

7874

7975
def main():
8076

8177
if not settings.configured:
8278
settings.configure(**DEFAULT_SETTINGS)
8379
django.setup()
84-
failures = DiscoverRunner(failfast=False).run_tests(['simple_history.tests'])
85-
failures |= DiscoverRunner(failfast=False).run_tests(['simple_history.registry_tests'])
80+
failures = DiscoverRunner(failfast=False).run_tests(["simple_history.tests"])
81+
failures |= DiscoverRunner(failfast=False).run_tests(
82+
["simple_history.registry_tests"]
83+
)
8684
sys.exit(failures)
8785

8886

setup.py

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,28 @@
22
import simple_history
33

44
tests_require = [
5-
'Django>=1.11', 'WebTest==2.0.24', 'django-webtest==1.8.0', 'mock==1.0.1',
6-
'six']
5+
"Django>=1.11",
6+
"WebTest==2.0.24",
7+
"django-webtest==1.8.0",
8+
"mock==1.0.1",
9+
"six",
10+
]
711

812
setup(
9-
name='django-simple-history',
13+
name="django-simple-history",
1014
version=simple_history.__version__,
11-
description='Store model history and view/revert changes from admin site.',
12-
long_description='\n'.join((
13-
open('README.rst').read(),
14-
open('CHANGES.rst').read(),
15-
)),
16-
author='Corey Bertram',
17-
author_email='[email protected]',
18-
maintainer='Trey Hunner',
19-
url='https://github.com/treyhunner/django-simple-history',
15+
description="Store model history and view/revert changes from admin site.",
16+
long_description="\n".join((open("README.rst").read(), open("CHANGES.rst").read())),
17+
author="Corey Bertram",
18+
author_email="[email protected]",
19+
maintainer="Trey Hunner",
20+
url="https://github.com/treyhunner/django-simple-history",
2021
packages=[
21-
'simple_history', 'simple_history.management',
22-
'simple_history.management.commands', 'simple_history.templatetags'],
22+
"simple_history",
23+
"simple_history.management",
24+
"simple_history.management.commands",
25+
"simple_history.templatetags",
26+
],
2327
classifiers=[
2428
"Development Status :: 5 - Production/Stable",
2529
"Framework :: Django",
@@ -32,16 +36,16 @@
3236
"Framework :: Django :: 2.2",
3337
"Programming Language :: Python",
3438
"Programming Language :: Python :: 2.7",
35-
'Programming Language :: Python :: 3',
36-
'Programming Language :: Python :: 3.4',
37-
'Programming Language :: Python :: 3.5',
38-
'Programming Language :: Python :: 3.6',
39-
'Programming Language :: Python :: 3.7',
39+
"Programming Language :: Python :: 3",
40+
"Programming Language :: Python :: 3.4",
41+
"Programming Language :: Python :: 3.5",
42+
"Programming Language :: Python :: 3.6",
43+
"Programming Language :: Python :: 3.7",
4044
"License :: OSI Approved :: BSD License",
4145
],
4246
python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
4347
tests_require=tests_require,
4448
install_requires=["six"],
4549
include_package_data=True,
46-
test_suite='runtests.main',
50+
test_suite="runtests.main",
4751
)

0 commit comments

Comments
 (0)