summaryrefslogtreecommitdiff
path: root/django/utils
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2016-09-16 12:15:00 -0400
committerTim Graham <timograham@gmail.com>2016-09-17 15:44:06 -0400
commit8119b679eb85cdc0ae3d321e54d06dd0200a1e82 (patch)
treeb4f4e40a371569a260a39ca310e8e984d8582d74 /django/utils
parent17677d510f65012531a5af57fd056fb15cfe1067 (diff)
Refs #27025 -- Fixed "invalid escape sequence" warnings in Python 3.6.
http://bugs.python.org/issue27364
Diffstat (limited to 'django/utils')
-rw-r--r--django/utils/html.py2
-rw-r--r--django/utils/regex_helper.py4
-rw-r--r--django/utils/text.py8
-rw-r--r--django/utils/translation/__init__.py2
4 files changed, 8 insertions, 8 deletions
diff --git a/django/utils/html.py b/django/utils/html.py
index a5cb56ec9e..84379caa9c 100644
--- a/django/utils/html.py
+++ b/django/utils/html.py
@@ -36,7 +36,7 @@ simple_email_re = re.compile(r'^\S+@\S+\.\S+$')
link_target_attribute_re = re.compile(r'(<a [^>]*?)target=[^\s>]+')
html_gunk_re = re.compile(
r'(?:<br clear="all">|<i><\/i>|<b><\/b>|<em><\/em>|<strong><\/strong>|'
- '<\/?smallcaps>|<\/?uppercase>)', re.IGNORECASE)
+ r'<\/?smallcaps>|<\/?uppercase>)', re.IGNORECASE)
hard_coded_bullets_re = re.compile(
r'((?:<p>(?:%s).*?[a-zA-Z].*?</p>\s*)+)' % '|'.join(re.escape(x) for x in DOTS), re.DOTALL
)
diff --git a/django/utils/regex_helper.py b/django/utils/regex_helper.py
index 4a697b2920..622d822759 100644
--- a/django/utils/regex_helper.py
+++ b/django/utils/regex_helper.py
@@ -48,7 +48,7 @@ class NonCapture(list):
def normalize(pattern):
- """
+ r"""
Given a reg-exp pattern, normalizes it to an iterable of forms that
suffice for reverse matching. This does the following:
@@ -203,7 +203,7 @@ def normalize(pattern):
def next_char(input_iter):
- """
+ r"""
An iterator that yields the next character from "pattern_iter", respecting
escape sequences. An escaped character is replaced by a representative of
its class (e.g. \w -> "x"). If the escaped character is one that is
diff --git a/django/utils/text.py b/django/utils/text.py
index 3b8fc581bf..a77f27eed7 100644
--- a/django/utils/text.py
+++ b/django/utils/text.py
@@ -423,11 +423,11 @@ def slugify(value, allow_unicode=False):
value = force_text(value)
if allow_unicode:
value = unicodedata.normalize('NFKC', value)
- value = re.sub('[^\w\s-]', '', value, flags=re.U).strip().lower()
- return mark_safe(re.sub('[-\s]+', '-', value, flags=re.U))
+ value = re.sub(r'[^\w\s-]', '', value, flags=re.U).strip().lower()
+ return mark_safe(re.sub(r'[-\s]+', '-', value, flags=re.U))
value = unicodedata.normalize('NFKD', value).encode('ascii', 'ignore').decode('ascii')
- value = re.sub('[^\w\s-]', '', value).strip().lower()
- return mark_safe(re.sub('[-\s]+', '-', value))
+ value = re.sub(r'[^\w\s-]', '', value).strip().lower()
+ return mark_safe(re.sub(r'[-\s]+', '-', value))
def camel_case_to_spaces(value):
diff --git a/django/utils/translation/__init__.py b/django/utils/translation/__init__.py
index 9154ceeb7b..a5975b005c 100644
--- a/django/utils/translation/__init__.py
+++ b/django/utils/translation/__init__.py
@@ -255,7 +255,7 @@ def get_language_info(lang_code):
info['name_translated'] = ugettext_lazy(info['name'])
return info
-trim_whitespace_re = re.compile('\s*\n\s*')
+trim_whitespace_re = re.compile(r'\s*\n\s*')
def trim_whitespace(s):