Skip to content

Commit

Permalink
cleanup: fixes regex escape warnings in S3Uri.py, FileLists.py
Browse files Browse the repository at this point in the history
Mark two strings in S3Uri.py and one string in FileLists.py as
literal regex strings to address "invalid escape sequence" syntax
warnings.
  • Loading branch information
jessie-murray committed Apr 6, 2024
1 parent dbdee8f commit dd8908d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion S3/FileLists.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ def _get_filelist_remote(remote_uri, recursive = True):
uri_str = uri.uri()
## Wildcards used in remote URI?
## If yes we'll need a bucket listing...
wildcard_split_result = re.split("\*|\?", uri_str, maxsplit=1)
wildcard_split_result = re.split(r"\*|\?", uri_str, maxsplit=1)

if len(wildcard_split_result) == 2:
## If wildcards found
Expand Down
4 changes: 2 additions & 2 deletions S3/S3Uri.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def httpurl_to_s3uri(http_url):

# Worst case scenario, we would like to be able to match something like
# my.website.com.s3-fips.dualstack.us-west-1.amazonaws.com.cn
m = re.match("(.*\.)?s3(?:\-[^\.]*)?(?:\.dualstack)?(?:\.[^\.]*)?\.amazonaws\.com(?:\.cn)?$",
m = re.match(r"(.*\.)?s3(?:\-[^\.]*)?(?:\.dualstack)?(?:\.[^\.]*)?\.amazonaws\.com(?:\.cn)?$",
hostname, re.IGNORECASE | re.UNICODE)
if not m:
raise ValueError("Unable to parse URL: %s" % http_url)
Expand Down Expand Up @@ -167,7 +167,7 @@ def uri(self):

class S3UriFile(S3Uri):
type = "file"
_re = re.compile("^(\w+://)?(.*)", re.UNICODE)
_re = re.compile(r"^(\w+://)?(.*)", re.UNICODE)
def __init__(self, string):
match = self._re.match(string)
groups = match.groups()
Expand Down

0 comments on commit dd8908d

Please sign in to comment.