Skip to content

Commit

Permalink
Merge pull request #1170 from atombrella/literals
Browse files Browse the repository at this point in the history
Fix warnings from flake8-comprehensions.
  • Loading branch information
benjaoming committed Feb 9, 2022
2 parents 574570a + a9574e8 commit 40a4220
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/wiki/core/markdown/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def convert(self, text, *args, **kwargs):
settings.MARKDOWN_HTML_WHITELIST + plugin_registry.get_html_whitelist()
)

attrs = dict()
attrs = {}
attrs.update(settings.MARKDOWN_HTML_ATTRIBUTES)
attrs.update(plugin_registry.get_html_attributes().items())

Expand Down
2 changes: 1 addition & 1 deletion src/wiki/core/plugins/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def register(PluginClass):

_html_whitelist.extend(getattr(PluginClass, "html_whitelist", []))

_html_attributes.update(getattr(PluginClass, "html_attributes", dict()))
_html_attributes.update(getattr(PluginClass, "html_attributes", {}))


def get_plugins():
Expand Down
2 changes: 1 addition & 1 deletion src/wiki/models/article.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def get_cached_content(self, user=None):
cache_key = self.get_cache_key()
cache_content_key = self.get_cache_content_key(user)

cached_items = cache.get(cache_key, list())
cached_items = cache.get(cache_key, [])

if cache_content_key in cached_items:
cached_content = cache.get(cache_content_key)
Expand Down
36 changes: 18 additions & 18 deletions src/wiki/plugins/macros/mdx/macro.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,32 +69,32 @@ def article_list(self, depth="2"):
)
return self.markdown.htmlStash.store(html)

article_list.meta = dict(
short_description=_("Article list"),
help_text=_("Insert a list of articles in this level."),
example_code="[article_list depth:2]",
args={"depth": _("Maximum depth to show levels for.")},
)
article_list.meta = {
"short_description": _("Article list"),
"help_text": _("Insert a list of articles in this level."),
"example_code": "[article_list depth:2]",
"args": {"depth": _("Maximum depth to show levels for.")},
}

def toc(self):
return "[TOC]"

toc.meta = dict(
short_description=_("Table of contents"),
help_text=_("Insert a table of contents matching the headings."),
example_code="[TOC]",
args={},
)
toc.meta = {
"short_description": _("Table of contents"),
"help_text": _("Insert a table of contents matching the headings."),
"example_code": "[TOC]",
"args": {},
}

def wikilink(self):
return ""

wikilink.meta = dict(
short_description=_("WikiLinks"),
help_text=_("Insert a link to another wiki page with a short notation."),
example_code="[[WikiLink]]",
args={},
)
wikilink.meta = {
"short_description": _("WikiLinks"),
"help_text": _("Insert a link to another wiki page with a short notation."),
"example_code": "[[WikiLink]]",
"args": {},
}


def makeExtension(*args, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion src/wiki/views/article.py
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ def get_form_classes(self):
settings_forms = []
if permissions.can_change_permissions(self.article, self.request.user):
settings_forms.append(self.permission_form_class)
plugin_forms = [F for F in plugin_registry.get_settings_forms()]
plugin_forms = plugin_registry.get_settings_forms()
plugin_forms.sort(key=lambda form: form.settings_order)
settings_forms += plugin_forms
for i in range(len(settings_forms)):
Expand Down
4 changes: 2 additions & 2 deletions tests/core/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ def test_change_group(self):
self.root_article.refresh_from_db()
self.assertEqual(self.root_article.group, group)
self.assertEqual(self.root_article.owner, self.superuser1)
messages = [m for m in get_messages(response.wsgi_request)]
messages = list(get_messages(response.wsgi_request))
self.assertEqual(len(messages), 1)
message = messages[0]
self.assertEqual(message.level, constants.SUCCESS)
Expand Down Expand Up @@ -769,7 +769,7 @@ def test_unchanged_message(self):
form_values,
follow=True,
)
messages = [m for m in get_messages(response.wsgi_request)]
messages = list(get_messages(response.wsgi_request))
self.assertEqual(len(messages), 1)
message = messages[0]
self.assertEqual(message.level, constants.SUCCESS)
Expand Down

0 comments on commit 40a4220

Please sign in to comment.