Skip to content

Commit 72ee030

Browse files
scheelsigmavirus24
scheel
authored andcommitted
Change regex string to a raw string.
1 parent 04d7e27 commit 72ee030

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

twine/commands/upload.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,9 @@ def _split_inputs(
149149
return Inputs(dists, signatures, attestations_by_dist)
150150

151151

152-
def _sanitize_url(url) -> str:
153-
"""
152+
def _sanitize_url(url: str) -> str:
153+
"""Sanitize a URL.
154+
154155
Sanitize URLs, removing any user:password combinations and replacing them with
155156
asterisks. Returns the original URL if the string is a non-matching pattern.
156157
@@ -160,7 +161,7 @@ def _sanitize_url(url) -> str:
160161
return:
161162
str either sanitized or as entered depending on pattern match.
162163
"""
163-
pattern = "(.*https?://)(\w+:\w+)@(\w+\..*)"
164+
pattern = r"(.*https?://)(\w+:\w+)@(\w+\..*)"
164165
m = re.match(pattern, url)
165166
if m:
166167
newurl = f"{m.group(1)}*****:*****@{m.group(3)}"

0 commit comments

Comments
 (0)