diff --git a/snakemake/deployment/conda.py b/snakemake/deployment/conda.py index 4609a348e..5e8107694 100644 --- a/snakemake/deployment/conda.py +++ b/snakemake/deployment/conda.py @@ -747,7 +747,7 @@ def _check_version(self): version = shell.check_output( self._get_cmd("conda --version"), stderr=subprocess.PIPE, text=True ) - version_matches = re.findall("\d+.\d+.\d+", version) + version_matches = re.findall(r"\d+.\d+.\d+", version) if len(version_matches) != 1: raise WorkflowError( f"Unable to determine conda version. 'conda --version' returned {version}" diff --git a/snakemake/linting/rules.py b/snakemake/linting/rules.py index c2d2498aa..269080ad3 100644 --- a/snakemake/linting/rules.py +++ b/snakemake/linting/rules.py @@ -111,7 +111,7 @@ def lint_long_run(self, rule): links=[links.external_scripts, links.notebooks], ) - def lint_iofile_by_index(self, rule, regex=re.compile("(input|output)\[[0-9]+\]")): + def lint_iofile_by_index(self, rule, regex=re.compile(r"(input|output)\[[0-9]+\]")): if rule.shellcmd and regex.search(rule.shellcmd): yield Lint( title="Do not access input and output files individually by index in shell commands", diff --git a/snakemake/linting/snakefiles.py b/snakemake/linting/snakefiles.py index 46bac4b51..770d75dc2 100644 --- a/snakemake/linting/snakefiles.py +++ b/snakemake/linting/snakefiles.py @@ -63,7 +63,7 @@ def lint_path_add( def lint_envvars( self, snakefile, - regex=re.compile("os.environ\[(?P['\"])(?P.+)?(?P=quote)\]"), + regex=re.compile(r"os.environ\[(?P['\"])(?P.+)?(?P=quote)\]"), ): for match in regex.finditer(snakefile): line = get_line(match, snakefile) diff --git a/snakemake/remote/XRootD.py b/snakemake/remote/XRootD.py index 71395ae07..abba3111e 100644 --- a/snakemake/remote/XRootD.py +++ b/snakemake/remote/XRootD.py @@ -151,7 +151,7 @@ def get_client(self, domain): def _parse_url(self, url): match = re.search( - "(?P(?:[A-Za-z]+://)[A-Za-z0-9:@\_\-\.]+\:?/)(?P.+)", url + r"(?P(?:[A-Za-z]+://)[A-Za-z0-9:@\_\-\.]+\:?/)(?P.+)", url ) if match is None: return None diff --git a/snakemake/sourcecache.py b/snakemake/sourcecache.py index 69e746042..a70a0ae72 100644 --- a/snakemake/sourcecache.py +++ b/snakemake/sourcecache.py @@ -343,7 +343,7 @@ def infer_source_file(path_or_uri, basedir: SourceFile = None): class SourceCache: cache_whitelist = [ - "https://raw.githubusercontent.com/snakemake/snakemake-wrappers/\d+\.\d+.\d+" + r"https://raw.githubusercontent.com/snakemake/snakemake-wrappers/\d+\.\d+.\d+" ] # TODO add more prefixes for uris that are save to be cached def __init__(self, runtime_cache_path=None): diff --git a/snakemake/workflow.py b/snakemake/workflow.py index 850afafc9..4950be381 100644 --- a/snakemake/workflow.py +++ b/snakemake/workflow.py @@ -1325,7 +1325,7 @@ def register_envvars(self, *envvars): invalid_envvars = [ envvar for envvar in envvars - if re.match("^\w+$", envvar, flags=re.ASCII) is None + if re.match(r"^\w+$", envvar, flags=re.ASCII) is None ] if invalid_envvars: raise WorkflowError( @@ -1410,7 +1410,7 @@ def scattergather(self, **content): self._scatter.update(self.overwrite_scatter) # add corresponding wildcard constraint - self.global_wildcard_constraints(scatteritem="\d+-of-\d+") + self.global_wildcard_constraints(scatteritem=r"\d+-of-\d+") def func(key, *args, **wildcards): n = self._scatter[key]