summaryrefslogtreecommitdiff
path: root/django/utils/html.py
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2023-01-18 19:11:18 +0100
committerGitHub <noreply@github.com>2023-01-18 19:11:18 +0100
commit23e886886249ebe8f80a48b0d25fbb5308eeb06f (patch)
treeddd2eb220750704fa4fbfd8447654fc3d382bd10 /django/utils/html.py
parentfd21f82aa82b0d75a161f618ef944ebe0923e0ab (diff)
Refs #34233 -- Used str.removeprefix()/removesuffix().
Diffstat (limited to 'django/utils/html.py')
-rw-r--r--django/utils/html.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/django/utils/html.py b/django/utils/html.py
index fdb88d6709..c32a36fa93 100644
--- a/django/utils/html.py
+++ b/django/utils/html.py
@@ -343,7 +343,7 @@ class Urlizer:
# Trim wrapping punctuation.
for opening, closing in self.wrapping_punctuation:
if middle.startswith(opening):
- middle = middle[len(opening) :]
+ middle = middle.removeprefix(opening)
lead += opening
trimmed_something = True
# Keep parentheses at the end only if they're balanced.
@@ -351,7 +351,7 @@ class Urlizer:
middle.endswith(closing)
and middle.count(closing) == middle.count(opening) + 1
):
- middle = middle[: -len(closing)]
+ middle = middle.removesuffix(closing)
trail = closing + trail
trimmed_something = True
# Trim trailing punctuation (after trimming wrapping punctuation,