Commit 3393f25f by Sarina Canelake

Merge pull request #6044 from stvstnfrd/pep8/syntax

Fix syntax-related PEP8 issues
parents b009e4a5 ab4de714
...@@ -67,8 +67,11 @@ class Role(models.Model): ...@@ -67,8 +67,11 @@ class Role(models.Model):
def inherit_permissions(self, role): # TODO the name of this method is a little bit confusing, def inherit_permissions(self, role): # TODO the name of this method is a little bit confusing,
# since it's one-off and doesn't handle inheritance later # since it's one-off and doesn't handle inheritance later
if role.course_id and role.course_id != self.course_id: if role.course_id and role.course_id != self.course_id:
logging.warning("%s cannot inherit permissions from %s due to course_id inconsistency", logging.warning(
self, role) "%s cannot inherit permissions from %s due to course_id inconsistency",
self,
role,
)
for per in role.permissions.all(): for per in role.permissions.all():
self.add_permission(per) self.add_permission(per)
......
...@@ -4,8 +4,9 @@ ...@@ -4,8 +4,9 @@
# pylint: disable=W0212 # pylint: disable=W0212
# pylint: disable=W0613 # pylint: disable=W0613
import sys, os import os
from path import path from path import path
import sys
on_rtd = os.environ.get('READTHEDOCS', None) == 'True' on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
......
...@@ -4,8 +4,9 @@ ...@@ -4,8 +4,9 @@
# pylint: disable=W0212 # pylint: disable=W0212
# pylint: disable=W0613 # pylint: disable=W0613
import sys, os import os
from path import path from path import path
import sys
on_rtd = os.environ.get('READTHEDOCS', None) == 'True' on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
......
...@@ -21,7 +21,8 @@ ...@@ -21,7 +21,8 @@
# #
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import sys, os import os
import sys
BASEDIR = os.path.dirname(os.path.abspath(__file__)) BASEDIR = os.path.dirname(os.path.abspath(__file__))
......
...@@ -1036,8 +1036,8 @@ class UsersEndpointTestCase(ModuleStoreTestCase, MockRequestSetupMixin): ...@@ -1036,8 +1036,8 @@ class UsersEndpointTestCase(ModuleStoreTestCase, MockRequestSetupMixin):
response = self.make_request(username="other") response = self.make_request(username="other")
self.assertEqual(response.status_code, 404) self.assertEqual(response.status_code, 404)
content = json.loads(response.content) content = json.loads(response.content)
self.assertTrue(content.has_key("errors")) self.assertIn("errors", content)
self.assertFalse(content.has_key("users")) self.assertNotIn("users", content)
@patch('lms.lib.comment_client.utils.requests.request') @patch('lms.lib.comment_client.utils.requests.request')
def test_requires_matched_user_has_forum_content(self, mock_request): def test_requires_matched_user_has_forum_content(self, mock_request):
......
...@@ -123,7 +123,7 @@ def _filter_unstarted_categories(category_map): ...@@ -123,7 +123,7 @@ def _filter_unstarted_categories(category_map):
def _sort_map_entries(category_map, sort_alpha): def _sort_map_entries(category_map, sort_alpha):
things = [] things = []
for title, entry in category_map["entries"].items(): for title, entry in category_map["entries"].items():
if entry["sort_key"] == None and sort_alpha: if entry["sort_key"] is None and sort_alpha:
entry["sort_key"] = title entry["sort_key"] = title
things.append((title, entry)) things.append((title, entry))
for title, category in category_map["subcategories"].items(): for title, category in category_map["subcategories"].items():
......
...@@ -59,7 +59,7 @@ def bulk_email_is_enabled_for_course(course_id): ...@@ -59,7 +59,7 @@ def bulk_email_is_enabled_for_course(course_id):
3. Bulk email is enabled for the course. 3. Bulk email is enabled for the course.
""" """
bulk_email_enabled_globally = (settings.FEATURES['ENABLE_INSTRUCTOR_EMAIL'] == True) bulk_email_enabled_globally = (settings.FEATURES['ENABLE_INSTRUCTOR_EMAIL'] is True)
is_studio_course = (modulestore().get_modulestore_type(course_id) != ModuleStoreEnum.Type.xml) is_studio_course = (modulestore().get_modulestore_type(course_id) != ModuleStoreEnum.Type.xml)
bulk_email_enabled_for_course = CourseAuthorization.instructor_email_enabled(course_id) bulk_email_enabled_for_course = CourseAuthorization.instructor_email_enabled(course_id)
......
...@@ -57,7 +57,7 @@ set -e ...@@ -57,7 +57,7 @@ set -e
# Violations thresholds for failing the build # Violations thresholds for failing the build
PYLINT_THRESHOLD=4600 PYLINT_THRESHOLD=4600
PEP8_THRESHOLD=15 PEP8_THRESHOLD=10
source $HOME/jenkins_env source $HOME/jenkins_env
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment