diff --git a/cms/djangoapps/contentstore/management/commands/prompt.py b/cms/djangoapps/contentstore/management/commands/prompt.py index 211c48406c..40a39d0a11 100644 --- a/cms/djangoapps/contentstore/management/commands/prompt.py +++ b/cms/djangoapps/contentstore/management/commands/prompt.py @@ -13,7 +13,7 @@ def query_yes_no(question, default="yes"): """ valid = {"yes":True, "y":True, "ye":True, "no":False, "n":False} - if default == None: + if default is None: prompt = " [y/n] " elif default == "yes": prompt = " [Y/n] " diff --git a/common/djangoapps/student/views.py b/common/djangoapps/student/views.py index 13ae83ea2f..57b1ddbfd0 100644 --- a/common/djangoapps/student/views.py +++ b/common/djangoapps/student/views.py @@ -115,7 +115,7 @@ def get_date_for_press(publish_date): def press(request): json_articles = cache.get("student_press_json_articles") - if json_articles == None: + if json_articles is None: if hasattr(settings, 'RSS_URL'): content = urllib.urlopen(settings.PRESS_URL).read() json_articles = json.loads(content) @@ -301,7 +301,7 @@ def change_enrollment(request): action = request.POST.get("enrollment_action", "") course_id = request.POST.get("course_id", None) - if course_id == None: + if course_id is None: return HttpResponse(json.dumps({'success': False, 'error': 'There was an error receiving the course id.'})) @@ -1203,7 +1203,7 @@ def _get_news(top=None): "Return the n top news items on settings.RSS_URL" feed_data = cache.get("students_index_rss_feed_data") - if feed_data == None: + if feed_data is None: if hasattr(settings, 'RSS_URL'): feed_data = urllib.urlopen(settings.RSS_URL).read() else: diff --git a/common/lib/xmodule/xmodule/peer_grading_module.py b/common/lib/xmodule/xmodule/peer_grading_module.py index 16c118a434..97abfdbfba 100644 --- a/common/lib/xmodule/xmodule/peer_grading_module.py +++ b/common/lib/xmodule/xmodule/peer_grading_module.py @@ -524,7 +524,7 @@ class PeerGradingModule(XModule): ''' Show individual problem interface ''' - if get == None or get.get('location') == None: + if get is None or get.get('location') is None: if not self.use_for_single_location: #This is an error case, because it must be set to use a single location to be called without get parameters #This is a dev_facing_error diff --git a/lms/djangoapps/course_wiki/views.py b/lms/djangoapps/course_wiki/views.py index a088f8fc14..6e9f2e38de 100644 --- a/lms/djangoapps/course_wiki/views.py +++ b/lms/djangoapps/course_wiki/views.py @@ -49,7 +49,7 @@ def course_wiki_redirect(request, course_id): if not course_slug: log.exception("This course is improperly configured. The slug cannot be empty.") valid_slug = False - if re.match('^[-\w\.]+$', course_slug) == None: + if re.match('^[-\w\.]+$', course_slug) is None: log.exception("This course is improperly configured. The slug can only contain letters, numbers, periods or hyphens.") valid_slug = False diff --git a/lms/djangoapps/courseware/grades.py b/lms/djangoapps/courseware/grades.py index 89e7371efa..aef576c702 100644 --- a/lms/djangoapps/courseware/grades.py +++ b/lms/djangoapps/courseware/grades.py @@ -140,7 +140,7 @@ def grade(student, request, course, student_module_cache=None, keep_raw_scores=F grading_context = course.grading_context raw_scores = [] - if student_module_cache == None: + if student_module_cache is None: student_module_cache = StudentModuleCache(course.id, student, grading_context['all_descriptors']) totaled_scores = {} diff --git a/lms/djangoapps/multicourse/multicourse_settings.py b/lms/djangoapps/multicourse/multicourse_settings.py index 894bfa588c..c3df167ad8 100644 --- a/lms/djangoapps/multicourse/multicourse_settings.py +++ b/lms/djangoapps/multicourse/multicourse_settings.py @@ -68,7 +68,7 @@ def get_course_settings(coursename): def is_valid_course(coursename): - return get_course_settings(coursename) != None + return get_course_settings(coursename) is not None def get_course_property(coursename, property): diff --git a/lms/djangoapps/simplewiki/views.py b/lms/djangoapps/simplewiki/views.py index 38c367dec9..445b0418fc 100644 --- a/lms/djangoapps/simplewiki/views.py +++ b/lms/djangoapps/simplewiki/views.py @@ -236,7 +236,7 @@ def history(request, article_path, page=1, course_id=None): page_size = 10 - if page == None: + if page is None: page = 1 try: p = int(page) @@ -310,7 +310,7 @@ def revision_feed(request, page=1, namespace=None, course_id=None): page_size = 10 - if page == None: + if page is None: page = 1 try: p = int(page) diff --git a/lms/lib/comment_client/models.py b/lms/lib/comment_client/models.py index 8676d3af33..2a8992554d 100644 --- a/lms/lib/comment_client/models.py +++ b/lms/lib/comment_client/models.py @@ -23,7 +23,7 @@ class Model(object): try: return self.attributes[name] except KeyError: - if self.retrieved or self.id == None: + if self.retrieved or self.id is None: raise AttributeError("Field {0} does not exist".format(name)) self.retrieve() return self.__getattr__(name) diff --git a/lms/lib/symmath/formula.py b/lms/lib/symmath/formula.py index c34156da52..f3f26699f2 100644 --- a/lms/lib/symmath/formula.py +++ b/lms/lib/symmath/formula.py @@ -70,7 +70,7 @@ StrPrinter._print_hat = _print_hat def to_latex(x): - if x == None: return '' + if x is None: return '' # LatexPrinter._print_dot = _print_dot xs = latex(x) xs = xs.replace(r'\XI', 'XI') # workaround for strange greek @@ -278,7 +278,7 @@ class formula(object): if self.the_sympy: return self.the_sympy - if xml == None: # root + if xml is None: # root if not self.is_mathml(): return my_sympify(self.expr) if self.is_presentation_mathml(): diff --git a/lms/templates/courseware/course_navigation.html b/lms/templates/courseware/course_navigation.html index ec9004c0e8..b41aaedc70 100644 --- a/lms/templates/courseware/course_navigation.html +++ b/lms/templates/courseware/course_navigation.html @@ -2,7 +2,7 @@ <%page args="active_page=None" /> <% -if active_page == None and active_page_context is not UNDEFINED: +if active_page is None and active_page_context is not UNDEFINED: # If active_page is not passed in as an argument, it may be in the context as active_page_context active_page = active_page_context diff --git a/lms/templates/problem.html b/lms/templates/problem.html index 83fc18c0f6..b91b324645 100644 --- a/lms/templates/problem.html +++ b/lms/templates/problem.html @@ -1,7 +1,7 @@ <%namespace name='static' file='static_content.html'/>