From f2b9fad25cc46acef07f05ba2b4448f8b9596d4f Mon Sep 17 00:00:00 2001 From: leiyuehui Date: Tue, 13 Jun 2023 16:51:31 +0800 Subject: [PATCH] Regular expressions need to be written as // to conforms to pep8 Change-Id: I6b0826cbddee06d08f07cae65478aeda25872ed5 --- venus/api/common.py | 2 +- venus/utils.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/venus/api/common.py b/venus/api/common.py index 17253bc..c33256d 100644 --- a/venus/api/common.py +++ b/venus/api/common.py @@ -206,7 +206,7 @@ def get_request_url(request): forwarded = headers.get('X-Forwarded-Host') if forwarded: url_parts = list(parse.urlsplit(url)) - url_parts[1] = re.split(',\s?', forwarded)[-1] + url_parts[1] = re.split(',\\s?', forwarded)[-1] url = parse.urlunsplit(url_parts).rstrip('/') return url diff --git a/venus/utils.py b/venus/utils.py index 60a9e9c..67d2126 100644 --- a/venus/utils.py +++ b/venus/utils.py @@ -391,7 +391,7 @@ def sanitize_hostname(hostname): hostname = hostname.decode('latin-1') hostname = re.sub('[ _]', '-', hostname) - hostname = re.sub('[^\w.-]+', '', hostname) + hostname = re.sub('[^\\w.-]+', '', hostname) hostname = hostname.lower() hostname = hostname.strip('.-')