Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix re string type #1077

Merged
merged 3 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading