Skip to content

Commit

Permalink
Merge pull request #1077 from jhunkeler/fix-re-string-type
Browse files Browse the repository at this point in the history
Fix re string type
  • Loading branch information
alphasentaurii authored Oct 15, 2024
2 parents f5a5ea5 + eb4cede commit fd8d5a7
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions changes/1077.general.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
replaces deprecated string literals with raw strings in regex pattern matching
2 changes: 1 addition & 1 deletion crds/certify/certify.py
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ def load(self):
class AsdfCertifier(ReferenceCertifier):
"""Certifier for ADSF type, invoke data models checks."""

_VERSION_RE = re.compile(f"^[0-9]+\.[0-9]+\.[0-9]+$")
_VERSION_RE = re.compile(r"^[0-9]+\.[0-9]+\.[0-9]+$")

def certify(self):
"""Certify an unknown format file."""
Expand Down
2 changes: 1 addition & 1 deletion crds/certify/validators/synphot.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def _check_component_filename(context, reftype, suffix, filename, header):
log.error("Header missing COMPNAME, unable to certify filename")
return False

pattern = re.compile(".*_([0-9]{3})_" + suffix + ".fits")
pattern = re.compile(r".*_([0-9]{3})_" + suffix + r".fits")

match = pattern.match(os.path.basename(filename))
if not match:
Expand Down
2 changes: 1 addition & 1 deletion crds/core/timestamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ def parse_numerical_date(dstr):
class DateParser:
"""Abstract baseclass for defining date parsers."""

format = re.compile("^$")
format = re.compile(r"^$")
should_be = "DATE FORMAT NOT DEFINED"

@classmethod
Expand Down
2 changes: 1 addition & 1 deletion crds/hst/siname.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class UnknownCDBSPrefix(Exception):
pass

# global compiled regex for splitting filenames
filesplit = re.compile("[_\.]")
filesplit = re.compile(r"[_\.]")

# post-SM2 instruments supported by CDBS
CDBS_supports = ("ACS","STIS","NICMOS","WFPC2","WFC3","COS")
Expand Down
2 changes: 1 addition & 1 deletion crds/submit/submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ def find_new_rmaps(self, old_maps, new_maps):
return rnew

def get_renamed_rmaps(self, soup, fmap):
diffs = soup.find_all(string=re.compile("Logical Diff"))
diffs = soup.find_all(string=re.compile(r"Logical Diff"))
if len(diffs) > 0:
for diff in diffs:
d = diff.split('(')[-1].split(')')[0]
Expand Down

0 comments on commit fd8d5a7

Please sign in to comment.