From a21a63cc288ba51bcf8c227a49de6f5bb9a72cc3 Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Thu, 30 Dec 2021 13:19:25 +0100 Subject: [PATCH] Refs #27753 -- Removed unused django.utils.text._replace_entity() and _entity_re. Unused since 157ab32f3446da7fa1f9d716509c290069a2a156. --- django/utils/text.py | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/django/utils/text.py b/django/utils/text.py index fa337650af..915da50483 100644 --- a/django/utils/text.py +++ b/django/utils/text.py @@ -1,4 +1,3 @@ -import html.entities import re import unicodedata from gzip import GzipFile, compress as gzip_compress @@ -338,28 +337,6 @@ def smart_split(text): yield bit[0] -def _replace_entity(match): - text = match[1] - if text[0] == '#': - text = text[1:] - try: - if text[0] in 'xX': - c = int(text[1:], 16) - else: - c = int(text) - return chr(c) - except ValueError: - return match[0] - else: - try: - return chr(html.entities.name2codepoint[text]) - except KeyError: - return match[0] - - -_entity_re = _lazy_re_compile(r"&(#?[xX]?(?:[0-9a-fA-F]+|\w{1,8}));") - - @keep_lazy_text def unescape_string_literal(s): r"""