diff --git a/cms/djangoapps/models/settings/course_details.py b/cms/djangoapps/models/settings/course_details.py
index 3f0c87917a..884a4e4fef 100644
--- a/cms/djangoapps/models/settings/course_details.py
+++ b/cms/djangoapps/models/settings/course_details.py
@@ -153,9 +153,9 @@ class CourseDetails(object):
if not raw_video:
return None
- keystring_matcher = re.search('(?<=embed/)[a-zA-Z0-9_-]+', raw_video)
+ keystring_matcher = re.search(r'(?<=embed/)[a-zA-Z0-9_-]+', raw_video)
if keystring_matcher is None:
- keystring_matcher = re.search('=\d+:[a-zA-Z0-9_-]+', raw_video)
+ keystring_matcher = re.search(r'=\d+:[a-zA-Z0-9_-]+', raw_video)
if keystring_matcher:
return keystring_matcher.group(0)
diff --git a/common/djangoapps/student/management/commands/set_staff.py b/common/djangoapps/student/management/commands/set_staff.py
index 30d0483f50..869e37f13b 100644
--- a/common/djangoapps/student/management/commands/set_staff.py
+++ b/common/djangoapps/student/management/commands/set_staff.py
@@ -26,7 +26,7 @@ class Command(BaseCommand):
raise CommandError('Usage is set_staff {0}'.format(self.args))
for user in args:
- if re.match('[^@]+@[^@]+\.[^@]+', user):
+ if re.match(r'[^@]+@[^@]+\.[^@]+', user):
try:
v = User.objects.get(email=user)
except:
diff --git a/common/djangoapps/student/views.py b/common/djangoapps/student/views.py
index de3e52b080..4da7b9d789 100644
--- a/common/djangoapps/student/views.py
+++ b/common/djangoapps/student/views.py
@@ -3,6 +3,7 @@ import feedparser
import json
import logging
import random
+import re
import string
import urllib
import uuid
@@ -95,9 +96,8 @@ def course_from_id(course_id):
course_loc = CourseDescriptor.id_to_location(course_id)
return modulestore().get_instance(course_id, course_loc)
-import re
-day_pattern = re.compile('\s\d+,\s')
-multimonth_pattern = re.compile('\s?\-\s?\S+\s')
+day_pattern = re.compile(r'\s\d+,\s')
+multimonth_pattern = re.compile(r'\s?\-\s?\S+\s')
def get_date_for_press(publish_date):
diff --git a/common/djangoapps/terrain/steps.py b/common/djangoapps/terrain/steps.py
index f31be894f9..e69476a5b7 100644
--- a/common/djangoapps/terrain/steps.py
+++ b/common/djangoapps/terrain/steps.py
@@ -21,7 +21,7 @@ from logging import getLogger
logger = getLogger(__name__)
-@step(u'I wait (?:for )?"(\d+)" seconds?$')
+@step(r'I wait (?:for )?"(\d+)" seconds?$')
def wait(step, seconds):
world.wait(seconds)
diff --git a/common/lib/capa/capa/capa_problem.py b/common/lib/capa/capa/capa_problem.py
index 2a9f3d82a3..d620bac60a 100644
--- a/common/lib/capa/capa/capa_problem.py
+++ b/common/lib/capa/capa/capa_problem.py
@@ -103,8 +103,8 @@ class LoncapaProblem(object):
self.input_state = state.get('input_state', {})
# Convert startouttext and endouttext to proper
\(V=V_C\)
diff --git a/lms/djangoapps/course_wiki/views.py b/lms/djangoapps/course_wiki/views.py
index 6ab106ed70..74ef7d4a74 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) is None:
+ if re.match(r'^[-\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/foldit/views.py b/lms/djangoapps/foldit/views.py
index da361a2a82..76d9bfff98 100644
--- a/lms/djangoapps/foldit/views.py
+++ b/lms/djangoapps/foldit/views.py
@@ -46,7 +46,7 @@ def foldit_ops(request):
# To allow for fixes without breaking this, the regex should only
# match unquoted strings,
a = re.compile(r':([a-zA-Z]*),')
- puzzle_scores_json = re.sub(a, ':"\g<1>",', puzzle_scores_json)
+ puzzle_scores_json = re.sub(a, r':"\g<1>",', puzzle_scores_json)
puzzle_scores = json.loads(puzzle_scores_json)
responses.append(save_scores(request.user, puzzle_scores))