Skip to content

Commit 3e03019

Browse files
committed
Reformat with black and isort
1 parent 7f67af6 commit 3e03019

40 files changed

+701
-502
lines changed

docs/conf.py

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919

2020
# -- Project information -----------------------------------------------------
2121

22-
project = 'django-fluent-comments'
23-
copyright = '2018, Diederik van der Boor'
24-
author = 'Diederik van der Boor'
22+
project = "django-fluent-comments"
23+
copyright = "2018, Diederik van der Boor"
24+
author = "Diederik van der Boor"
2525

2626
# The short X.Y version
27-
version = '2.1'
27+
version = "2.1"
2828
# The full version, including alpha/beta/rc tags
29-
release = '2.1'
29+
release = "2.1"
3030

3131

3232
# -- General configuration ---------------------------------------------------
@@ -39,21 +39,21 @@
3939
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
4040
# ones.
4141
extensions = [
42-
'sphinx.ext.autodoc',
43-
'sphinx.ext.intersphinx',
42+
"sphinx.ext.autodoc",
43+
"sphinx.ext.intersphinx",
4444
]
4545

4646
# Add any paths that contain templates here, relative to this directory.
47-
templates_path = ['_templates']
47+
templates_path = ["_templates"]
4848

4949
# The suffix(es) of source filenames.
5050
# You can specify multiple suffix as a list of string:
5151
#
5252
# source_suffix = ['.rst', '.md']
53-
source_suffix = '.rst'
53+
source_suffix = ".rst"
5454

5555
# The master toctree document.
56-
master_doc = 'index'
56+
master_doc = "index"
5757

5858
# The language for content autogenerated by Sphinx. Refer to documentation
5959
# for a list of supported languages.
@@ -65,18 +65,18 @@
6565
# List of patterns, relative to source directory, that match files and
6666
# directories to ignore when looking for source files.
6767
# This pattern also affects html_static_path and html_extra_path .
68-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
68+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
6969

7070
# The name of the Pygments (syntax highlighting) style to use.
71-
pygments_style = 'sphinx'
71+
pygments_style = "sphinx"
7272

7373

7474
# -- Options for HTML output -------------------------------------------------
7575

7676
# The theme to use for HTML and HTML Help pages. See the documentation for
7777
# a list of builtin themes.
7878
#
79-
#html_theme = 'alabaster'
79+
# html_theme = 'alabaster'
8080

8181
# Theme options are theme-specific and customize the look and feel of a theme
8282
# further. For a list of options available for each theme, see the
@@ -87,7 +87,7 @@
8787
# Add any paths that contain custom static files (such as style sheets) here,
8888
# relative to this directory. They are copied after the builtin static files,
8989
# so a file named "default.css" will overwrite the builtin "default.css".
90-
html_static_path = ['_static']
90+
html_static_path = ["_static"]
9191

9292
# Custom sidebar templates, must be a dictionary that maps document names
9393
# to template names.
@@ -103,7 +103,7 @@
103103
# -- Options for HTMLHelp output ---------------------------------------------
104104

105105
# Output file base name for HTML help builder.
106-
htmlhelp_basename = 'django-fluent-commentsdoc'
106+
htmlhelp_basename = "django-fluent-commentsdoc"
107107

108108

109109
# -- Options for LaTeX output ------------------------------------------------
@@ -112,15 +112,12 @@
112112
# The paper size ('letterpaper' or 'a4paper').
113113
#
114114
# 'papersize': 'letterpaper',
115-
116115
# The font size ('10pt', '11pt' or '12pt').
117116
#
118117
# 'pointsize': '10pt',
119-
120118
# Additional stuff for the LaTeX preamble.
121119
#
122120
# 'preamble': '',
123-
124121
# Latex figure (float) alignment
125122
#
126123
# 'figure_align': 'htbp',
@@ -130,8 +127,13 @@
130127
# (source start file, target name, title,
131128
# author, documentclass [howto, manual, or own class]).
132129
latex_documents = [
133-
(master_doc, 'django-fluent-comments.tex', 'django-fluent-comments Documentation',
134-
'Diederik van der Boor', 'manual'),
130+
(
131+
master_doc,
132+
"django-fluent-comments.tex",
133+
"django-fluent-comments Documentation",
134+
"Diederik van der Boor",
135+
"manual",
136+
),
135137
]
136138

137139

@@ -140,8 +142,7 @@
140142
# One entry per manual page. List of tuples
141143
# (source start file, name, description, authors, manual section).
142144
man_pages = [
143-
(master_doc, 'django-fluent-comments', 'django-fluent-comments Documentation',
144-
[author], 1)
145+
(master_doc, "django-fluent-comments", "django-fluent-comments Documentation", [author], 1)
145146
]
146147

147148

@@ -151,9 +152,15 @@
151152
# (source start file, target name, title, author,
152153
# dir menu entry, description, category)
153154
texinfo_documents = [
154-
(master_doc, 'django-fluent-comments', 'django-fluent-comments Documentation',
155-
author, 'django-fluent-comments', 'One line description of project.',
156-
'Miscellaneous'),
155+
(
156+
master_doc,
157+
"django-fluent-comments",
158+
"django-fluent-comments Documentation",
159+
author,
160+
"django-fluent-comments",
161+
"One line description of project.",
162+
"Miscellaneous",
163+
),
157164
]
158165

159166

@@ -162,4 +169,4 @@
162169
# -- Options for intersphinx extension ---------------------------------------
163170

164171
# Example configuration for intersphinx: refer to the Python standard library.
165-
intersphinx_mapping = {'https://docs.python.org/': None}
172+
intersphinx_mapping = {"https://docs.python.org/": None}

example/article/admin.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,30 @@
55

66

77
class ArticleAdminForm(ModelForm):
8-
98
def __init__(self, *args, **kwargs):
109
super(ArticleAdminForm, self).__init__(*args, **kwargs)
11-
self.fields['publication_date'].required = False # The admin's .save() method fills in a default.
10+
self.fields[
11+
"publication_date"
12+
].required = False # The admin's .save() method fills in a default.
1213

1314

1415
class ArticleAdmin(admin.ModelAdmin):
15-
prepopulated_fields = {'slug': ('title',)}
16+
prepopulated_fields = {"slug": ("title",)}
1617
form = ArticleAdminForm
1718

1819
fieldsets = (
19-
(None, {
20-
'fields': ('title', 'slug',),
21-
}),
22-
("Contents", {
23-
'fields': ('content',),
24-
}),
25-
("Publication settings", {
26-
'fields': ('publication_date', 'enable_comments',),
27-
}),
20+
(
21+
None,
22+
{"fields": ("title", "slug")},
23+
),
24+
(
25+
"Contents",
26+
{"fields": ("content",)},
27+
),
28+
(
29+
"Publication settings",
30+
{"fields": ("publication_date", "enable_comments")},
31+
),
2832
)
2933

3034
def save_model(self, request, obj, form, change):

example/article/migrations/0001_initial.py

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,30 @@ class Migration(migrations.Migration):
77

88
initial = True
99

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

1312
operations = [
1413
migrations.CreateModel(
15-
name='Article',
14+
name="Article",
1615
fields=[
17-
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
18-
('title', models.CharField(max_length=200, verbose_name='Title')),
19-
('slug', models.SlugField(unique=True, verbose_name='Slug')),
20-
('content', models.TextField(verbose_name='Content')),
21-
('publication_date', models.DateTimeField(verbose_name='Publication date')),
22-
('enable_comments', models.BooleanField(default=True, verbose_name='Enable comments')),
16+
(
17+
"id",
18+
models.AutoField(
19+
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
20+
),
21+
),
22+
("title", models.CharField(max_length=200, verbose_name="Title")),
23+
("slug", models.SlugField(unique=True, verbose_name="Slug")),
24+
("content", models.TextField(verbose_name="Content")),
25+
("publication_date", models.DateTimeField(verbose_name="Publication date")),
26+
(
27+
"enable_comments",
28+
models.BooleanField(default=True, verbose_name="Enable comments"),
29+
),
2330
],
2431
options={
25-
'verbose_name': 'Article',
26-
'verbose_name_plural': 'Articles',
32+
"verbose_name": "Article",
33+
"verbose_name_plural": "Articles",
2734
},
2835
),
2936
]

example/article/models.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def __str__(self):
2424
return self.title
2525

2626
def get_absolute_url(self):
27-
return reverse('article-details', kwargs={'slug': self.slug})
27+
return reverse("article-details", kwargs={"slug": self.slug})
2828

2929
# Optional, give direct access to moderation info via the model:
3030
comments = property(get_comments_for_model)
@@ -34,7 +34,5 @@ def get_absolute_url(self):
3434

3535
# Give the generic app support for moderation by django-fluent-comments:
3636
moderate_model(
37-
Article,
38-
publication_date_field='publication_date',
39-
enable_comments_field='enable_comments'
37+
Article, publication_date_field="publication_date", enable_comments_field="enable_comments",
4038
)

example/article/tests/factories.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,11 @@ def create_comment(comment_model=None, article=None, user=None, **kwargs):
3838
comment="Test-Comment",
3939
submit_date=now(),
4040
site=Site.objects.get_current(),
41-
ip_address='127.0.0.1',
41+
ip_address="127.0.0.1",
4242
is_public=True,
4343
is_removed=False,
4444
)
4545
defaults.update(kwargs)
4646

4747
Comment = comment_model or get_comment_model()
48-
return Comment.objects.create(
49-
content_type=article_ctype,
50-
object_pk=article.pk,
51-
**defaults
52-
)
48+
return Comment.objects.create(content_type=article_ctype, object_pk=article.pk, **defaults,)

example/article/tests/test_admin.py

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

77

88
class AdminCommentsTests(TestCase):
9-
109
def test_admin_comments_access(self):
1110
"""
1211
See that the admin renders
1312
"""
14-
admin = User.objects.create_superuser('admin2', '[email protected]', 'secret')
15-
comment = factories.create_comment(user_name='Test-Name')
13+
admin = User.objects.create_superuser("admin2", "[email protected]", "secret")
14+
comment = factories.create_comment(user_name="Test-Name")
1615

17-
self.client.login(username=admin.username, password='secret')
18-
response = self.client.get(reverse('admin:fluent_comments_fluentcomment_changelist'))
16+
self.client.login(username=admin.username, password="secret")
17+
response = self.client.get(reverse("admin:fluent_comments_fluentcomment_changelist"))
1918
self.assertContains(response, ">Test-Name<", status_code=200)

0 commit comments

Comments
 (0)