diff --git a/common/lib/calc/calc/tests/test_calc.py b/common/lib/calc/calc/tests/test_calc.py index c5235c253c..befb0afc25 100644 --- a/common/lib/calc/calc/tests/test_calc.py +++ b/common/lib/calc/calc/tests/test_calc.py @@ -537,13 +537,13 @@ class EvaluatorTest(unittest.TestCase): """ variables = {'R1': 2.0, 'R3': 4.0} - with self.assertRaisesRegexp(calc.UndefinedVariable, 'QWSEKO'): + with self.assertRaisesRegexp(calc.UndefinedVariable, r'QWSEKO'): calc.evaluator({}, {}, "5+7*QWSEKO") - with self.assertRaisesRegexp(calc.UndefinedVariable, 'r2'): + with self.assertRaisesRegexp(calc.UndefinedVariable, r'r2'): calc.evaluator({'r1': 5}, {}, "r1+r2") - with self.assertRaisesRegexp(calc.UndefinedVariable, 'r1, r3'): + with self.assertRaisesRegexp(calc.UndefinedVariable, r'r1, r3'): calc.evaluator(variables, {}, "r1*r3", case_sensitive=True) - with self.assertRaisesRegexp(calc.UndefinedVariable, 'did you forget to use \*'): + with self.assertRaisesRegexp(calc.UndefinedVariable, r'did you forget to use \*'): calc.evaluator(variables, {}, "R1(R3 + 1)") def test_mismatched_parens(self): diff --git a/common/lib/capa/capa/tests/test_responsetypes.py b/common/lib/capa/capa/tests/test_responsetypes.py index 63c9b367ef..24c1b0573b 100644 --- a/common/lib/capa/capa/tests/test_responsetypes.py +++ b/common/lib/capa/capa/tests/test_responsetypes.py @@ -647,7 +647,7 @@ class StringResponseTest(ResponseTest): # pylint: disable=missing-docstring for answer in answers: self.assert_grade(problem, answer, "correct") - problem = self.build_problem(answer="^(-\|){2,5}$", case_sensitive=False, regexp=True) + problem = self.build_problem(answer=r"^(-\|){2,5}$", case_sensitive=False, regexp=True) self.assert_grade(problem, "-|-|-|", "correct") self.assert_grade(problem, "-|", "incorrect") self.assert_grade(problem, "-|-|-|-|-|-|", "incorrect") diff --git a/common/test/acceptance/tests/discussion/test_discussion.py b/common/test/acceptance/tests/discussion/test_discussion.py index 4816d37d7d..54a38403e1 100644 --- a/common/test/acceptance/tests/discussion/test_discussion.py +++ b/common/test/acceptance/tests/discussion/test_discussion.py @@ -1002,9 +1002,9 @@ class DiscussionEditorPreviewTest(UniqueCourseTest): appear in the preview box """ self.page.set_new_post_editor_value( - '\\begin{equation}' - '\\tau_g(\omega) = - \\frac{d}{d\omega}\phi(\omega) \hspace{2em} (1) ' - '\\end{equation}' + r'\begin{equation}' + r'\tau_g(\omega) = - \frac{d}{d\omega}\phi(\omega) \hspace{2em} (1) ' + r'\end{equation}' ) self.assertIsNotNone(self.page.get_new_post_preview_text()) self.page.click_element(".cancel") diff --git a/openedx/core/djangoapps/coursegraph/management/commands/tests/test_dump_to_neo4j.py b/openedx/core/djangoapps/coursegraph/management/commands/tests/test_dump_to_neo4j.py index 50a19e6501..840bfd373b 100644 --- a/openedx/core/djangoapps/coursegraph/management/commands/tests/test_dump_to_neo4j.py +++ b/openedx/core/djangoapps/coursegraph/management/commands/tests/test_dump_to_neo4j.py @@ -41,7 +41,7 @@ class TestDumpToNeo4jCommandBase(SharedModuleStoreTestCase): """ @classmethod def setUpClass(cls): - """ + r""" Creates two courses; one that's just a course module, and one that looks like: course diff --git a/openedx/core/djangoapps/user_api/accounts/utils.py b/openedx/core/djangoapps/user_api/accounts/utils.py index 2d9c16fea1..460f768fe2 100644 --- a/openedx/core/djangoapps/user_api/accounts/utils.py +++ b/openedx/core/djangoapps/user_api/accounts/utils.py @@ -82,7 +82,7 @@ def _get_username_from_social_link(platform_name, new_social_link): parse_result = urlparse(new_social_link) url_domain_and_path = parse_result[1] + parse_result[2] url_stub = re.escape(settings.SOCIAL_PLATFORMS[platform_name]['url_stub']) - username_match = re.search('(www\.)?' + url_stub + '(?P.*?)[/]?$', url_domain_and_path, re.IGNORECASE) + username_match = re.search(r'(www\.)?' + url_stub + r'(?P.*?)[/]?$', url_domain_and_path, re.IGNORECASE) if username_match: username = username_match.group('username') else: diff --git a/scripts/xsslint/xsslint/linters.py b/scripts/xsslint/xsslint/linters.py index 2e6c3059a6..953cc5d8b2 100644 --- a/scripts/xsslint/xsslint/linters.py +++ b/scripts/xsslint/xsslint/linters.py @@ -173,7 +173,7 @@ class BaseLinter(object): """ if self.LINE_COMMENT_DELIM is not None: line_start_index = StringLines(template).index_to_line_start_index(start_index) - uncommented_line_start_index_regex = re.compile("^(?!\s*{})".format(self.LINE_COMMENT_DELIM), re.MULTILINE) + uncommented_line_start_index_regex = re.compile(r"^(?!\s*{})".format(self.LINE_COMMENT_DELIM), re.MULTILINE) # Finds the line start index of the first uncommented line, including the current line. match = uncommented_line_start_index_regex.search(template, line_start_index) if match is None: @@ -1160,8 +1160,8 @@ class MakoTemplateLinter(BaseLinter): # Dedent expression internals so it is parseable. # Note that the final columns reported could be off somewhat. adjusted_python_code = textwrap.dedent(python_code) - first_letter_match = re.search('\w', python_code) - adjusted_first_letter_match = re.search('\w', adjusted_python_code) + first_letter_match = re.search(r'\w', python_code) + adjusted_first_letter_match = re.search(r'\w', adjusted_python_code) if first_letter_match is not None and adjusted_first_letter_match is not None: start_offset += (first_letter_match.start() - adjusted_first_letter_match.start()) python_code = adjusted_python_code