From bb31716c97d058c70fc28f2603e95fc2fa5d2977 Mon Sep 17 00:00:00 2001 From: cclauss Date: Tue, 19 Mar 2019 21:40:06 +0100 Subject: [PATCH] Use ==/!= to compare str, bytes, and int literals --- cms/djangoapps/contentstore/views/tests/test_assets.py | 2 +- .../django_comment_common/migrations/0003_enable_forums.py | 2 +- common/djangoapps/terrain/ui_helpers.py | 4 ++-- common/lib/xmodule/xmodule/fields.py | 2 +- lms/djangoapps/grades/course_grade_factory.py | 2 +- scripts/xsslint/xsslint/visitors.py | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cms/djangoapps/contentstore/views/tests/test_assets.py b/cms/djangoapps/contentstore/views/tests/test_assets.py index 98ffa0b83b..be9ca2000f 100644 --- a/cms/djangoapps/contentstore/views/tests/test_assets.py +++ b/cms/djangoapps/contentstore/views/tests/test_assets.py @@ -294,7 +294,7 @@ class PaginationTestCase(AssetsTestCase): assets_response = json_response['assets'] self.assertEquals(filter_value_split, json_response['assetTypes']) - if filter_value is not '': + if filter_value != '': content_types = [asset['content_type'].lower() for asset in assets_response] if 'OTHER' in filter_value_split: diff --git a/common/djangoapps/django_comment_common/migrations/0003_enable_forums.py b/common/djangoapps/django_comment_common/migrations/0003_enable_forums.py index 50f3cad4c6..065468dc98 100644 --- a/common/djangoapps/django_comment_common/migrations/0003_enable_forums.py +++ b/common/djangoapps/django_comment_common/migrations/0003_enable_forums.py @@ -7,7 +7,7 @@ from django.db import migrations, models def add_default_enable(apps, schema_editor): ForumsConfig = apps.get_model("django_comment_common", "ForumsConfig") settings_count = ForumsConfig.objects.count() - if settings_count is 0: + if settings_count == 0: # By default we want the comment client enabled, but this is *not* enabling # discussions themselves by default, as in showing the Disucussions tab, or # inline discussions, etc. It just allows the underlying service client to work. diff --git a/common/djangoapps/terrain/ui_helpers.py b/common/djangoapps/terrain/ui_helpers.py index 753c60f4ae..57f1a98741 100644 --- a/common/djangoapps/terrain/ui_helpers.py +++ b/common/djangoapps/terrain/ui_helpers.py @@ -634,12 +634,12 @@ def click_tools(): @world.absorb def is_mac(): - return platform.mac_ver()[0] is not '' + return platform.mac_ver()[0] != '' @world.absorb def is_firefox(): - return world.browser.driver_name is 'Firefox' + return world.browser.driver_name == 'Firefox' @world.absorb diff --git a/common/lib/xmodule/xmodule/fields.py b/common/lib/xmodule/xmodule/fields.py index ffe707833d..634cf325d6 100644 --- a/common/lib/xmodule/xmodule/fields.py +++ b/common/lib/xmodule/xmodule/fields.py @@ -48,7 +48,7 @@ class Date(JSONField): """ if field is None: return field - elif field is "": + elif field == "": return None elif isinstance(field, basestring): return self._parse_date_wo_default_month_day(field) diff --git a/lms/djangoapps/grades/course_grade_factory.py b/lms/djangoapps/grades/course_grade_factory.py index d2f21a5540..c891c83164 100644 --- a/lms/djangoapps/grades/course_grade_factory.py +++ b/lms/djangoapps/grades/course_grade_factory.py @@ -156,7 +156,7 @@ class CourseGradeFactory(object): course_data, persistent_grade.percent_grade, persistent_grade.letter_grade, - persistent_grade.letter_grade is not u'' + persistent_grade.letter_grade != u'' ) @staticmethod diff --git a/scripts/xsslint/xsslint/visitors.py b/scripts/xsslint/xsslint/visitors.py index c1de930bf7..d5b9549be3 100644 --- a/scripts/xsslint/xsslint/visitors.py +++ b/scripts/xsslint/xsslint/visitors.py @@ -198,7 +198,7 @@ class FormatInterpolateVisitor(BaseVisitor): node: The AST root node. """ - if isinstance(node.func, ast.Attribute) and node.func.attr is 'format': + if isinstance(node.func, ast.Attribute) and node.func.attr == 'format': if self.format_caller_node is None: # Store the caller, or left-hand-side node of the initial # format() call.