Skip to content

Commit

Permalink
Fix pyflakes support
Browse files Browse the repository at this point in the history
  • Loading branch information
yakky committed Apr 7, 2020
1 parent 7c1c021 commit 25d9e41
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 13 deletions.
6 changes: 3 additions & 3 deletions cms/app_base.py
Expand Up @@ -37,20 +37,20 @@ def get_configs(self):
"""
Returns all the apphook configuration instances.
"""
raise NotImplemented('Configurable AppHooks must implement this method')
raise NotImplementedError('Configurable AppHooks must implement this method')

def get_config(self, namespace):
"""
Returns the apphook configuration instance linked to the given namespace
"""
raise NotImplemented('Configurable AppHooks must implement this method')
raise NotImplementedError('Configurable AppHooks must implement this method')

def get_config_add_url(self):
"""
Returns the url to add a new apphook configuration instance
(usually the model admin add view)
"""
raise NotImplemented('Configurable AppHooks must implement this method')
raise NotImplementedError('Configurable AppHooks must implement this method')

def get_menus(self, page=None, language=None, **kwargs):
"""
Expand Down
4 changes: 2 additions & 2 deletions cms/test_utils/util/static_analysis.py
Expand Up @@ -14,11 +14,11 @@ def _pyflakes_report_with_nopyflakes(self, messageClass, node, *args, **kwargs):
self.messages.append(messageClass(self.filename, node, *args, **kwargs))


def _pyflakes_no_migrations(self, tree, filename='(none)', builtins=None):
def _pyflakes_no_migrations(self, tree, filename='(none)', builtins=None, file_tokens=()):
if os.path.basename(os.path.dirname(filename)) == 'migrations':
self.messages = []
else:
Checker.___init___(self, tree, filename, builtins)
Checker.___init___(self, tree, filename, builtins, file_tokens)


def _check_recursive(paths, reporter):
Expand Down
2 changes: 1 addition & 1 deletion cms/tests/test_i18n.py
Expand Up @@ -2,7 +2,7 @@

from django.conf import settings
from django.test.utils import override_settings
from django.utils.translation import LANGUAGE_SESSION_KEY, activate
from django.utils.translation import LANGUAGE_SESSION_KEY

from cms import api
from cms.test_utils.testcases import CMSTestCase
Expand Down
1 change: 0 additions & 1 deletion cms/tests/test_page_admin.py
Expand Up @@ -1043,7 +1043,6 @@ def test_get_admin_tree_title(self):
{
'code': 'en',
'name': 'English',
'fallbacks': ['fr', 'de'],
'public': True,
'fallbacks': ['fr']
},
Expand Down
6 changes: 2 additions & 4 deletions cms/tests/test_static_analysis.py
@@ -1,7 +1,6 @@
from unittest import TestCase

from cms.test_utils.util.static_analysis import pyflakes
from cms.utils.compat import DJANGO_3_0


class AboveStaticAnalysisCodeTest(TestCase):
Expand All @@ -11,6 +10,5 @@ class AboveStaticAnalysisCodeTest(TestCase):
def test_pyflakes(self):
import cms
import menus
if not DJANGO_3_0:
errors, message = pyflakes((cms, menus))
self.assertEqual(errors, 0, message)
errors, message = pyflakes((cms, menus))
self.assertEqual(errors, 0, message)
2 changes: 1 addition & 1 deletion cms/utils/placeholder.py
Expand Up @@ -254,7 +254,7 @@ def get_placeholders(template):
if slot in clean_placeholders:
warnings.warn("Duplicate {{% placeholder \"{0}\" %}} "
"in template {1}."
.format(slot, template, slot),
.format(slot, template),
DuplicatePlaceholderWarning)
else:
validate_placeholder_name(slot)
Expand Down
2 changes: 1 addition & 1 deletion test_requirements/django-2.2.txt
@@ -1,3 +1,3 @@
-r requirements_base.txt
pyflakes==1.1.0
pyflakes>=2.1
Django>=2.2,<3.0

0 comments on commit 25d9e41

Please sign in to comment.