Permalink
Browse files

Fix E226, E302, E303 and E41 flake8 errors.

  • Loading branch information...
atombrella authored and benjaoming committed Nov 21, 2017
1 parent ce88873 commit bc56e97bf57d159fd1c5b60ceaffc5c1765a4874
View
@@ -2,7 +2,7 @@
universal = 1
[flake8]
ignore = E226,E302,E303,E41,E501
ignore = E501
max-line-length = 160
max-complexity = 10
exclude = */*migrations
@@ -1,5 +1,6 @@
from django.core.paginator import Paginator
class WikiPaginator(Paginator):
def __init__(self, *args, **kwargs):
@@ -17,7 +18,7 @@ def page(self, number):
@property
def page_range(self):
left = max(self.last_accessed_page_number - self.side_pages, 2)
right = min(self.last_accessed_page_number + self.side_pages+1, self.num_pages)
right = min(self.last_accessed_page_number + self.side_pages + 1, self.num_pages)
pages = []
if self.num_pages > 0:
pages = [1]
@@ -20,7 +20,6 @@
from wiki.decorators import disable_signal_for_loaddata
@python_2_unicode_compatible
class Article(models.Model):
@@ -383,6 +382,7 @@ def _clear_ancestor_cache(article):
for ancestor in article.ancestor_objects():
ancestor.article.clear_cache()
@disable_signal_for_loaddata
def on_article_save_clear_cache(instance, **kwargs):
on_article_delete_clear_cache(instance, **kwargs)
@@ -280,6 +280,7 @@ def on_revision_plugin_revision_post_save(**kwargs):
# Invalidate plugin's article cache
instance.plugin.article.clear_cache()
@disable_signal_for_loaddata
def on_revision_plugin_revision_pre_save(**kwargs):
instance = kwargs['instance']
@@ -159,6 +159,7 @@ def __str__(self):
self.attachment.original_filename,
self.revision_number)
@disable_signal_for_loaddata
def on_revision_delete(instance, *args, **kwargs):
if not instance.file:
@@ -11,6 +11,7 @@
r'.*(\[image\:(?P<id>[0-9]+)(\s+align\:(?P<align>right|left))?(\s+size\:(?P<size>default|small|medium|large|orig))?\s*\]).*',
re.IGNORECASE)
class ImageExtension(markdown.Extension):
""" Images plugin markdown extension for django-wiki. """
@@ -22,7 +22,6 @@
re.IGNORECASE)
class MacroExtension(markdown.Extension):
""" Macro plugin markdown extension for django-wiki. """
@@ -206,10 +206,12 @@ def plugin_enabled(plugin_name):
"""
return plugin_name in django_settings.INSTALLED_APPS
@register.filter
def wiki_settings(name):
return getattr(settings, name, "")
@register.filter
def starts_with(value, arg):
return value.startswith(arg)
View
@@ -39,13 +39,7 @@ class ArticleView(ArticleMixin, TemplateView):
@method_decorator(get_article(can_read=True))
def dispatch(self, request, article, *args, **kwargs):
return super(
ArticleView,
self).dispatch(
request,
article,
*args,
**kwargs)
return super(ArticleView, self).dispatch(request, article, *args, **kwargs)
def get_context_data(self, **kwargs):
kwargs['selected_tab'] = 'view'
@@ -487,8 +481,8 @@ def form_valid(self, form):
dst_path = descendant.path
src_path = urljoin(old_path, dst_path[root_len:])
src_len = len(src_path)
pos = src_path.rfind("/", 0, src_len-1)
slug = src_path[pos+1:src_len-1]
pos = src_path.rfind("/", 0, src_len - 1)
slug = src_path[pos + 1:src_len - 1]
parent_urlpath = models.URLPath.get_by_path(src_path[0:max(pos, 0)])
link = "[wiki:/{path}](wiki:/{path})".format(path=dst_path)
@@ -18,7 +18,6 @@
pygments = False
class ArticleMarkdownTests(ArticleTestBase):
@patch('wiki.core.markdown.settings')
@@ -10,7 +10,6 @@
User = get_user_model()
class GetContentSnippet(TemplateTestCase):
template = """

0 comments on commit bc56e97

Please sign in to comment.