From 4c31bf18c599b02403cfa6908f98c3d3ee48e47a Mon Sep 17 00:00:00 2001 From: Luke Anderson Date: Tue, 10 Dec 2024 10:12:54 +0000 Subject: [PATCH] Fix SyntaxWarning: incalid escape sequence. https://docs.python.org/3/whatsnew/3.12.html A backslash-character pair that is not a valid escape sequence now generates a SyntaxWarning, instead of DeprecationWarning. For example, re.compile("\d+\.\d+") now emits a SyntaxWarning ("\d" is an invalid escape sequence, use raw strings for regular expression: re.compile(r"\d+\.\d+")). In a future Python version, SyntaxError will eventually be raised, instead of SyntaxWarning. (Contributed by Victor Stinner in gh-98401.) --- src/pyaml_env/parse_config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pyaml_env/parse_config.py b/src/pyaml_env/parse_config.py index e3706cd..f78b1cf 100644 --- a/src/pyaml_env/parse_config.py +++ b/src/pyaml_env/parse_config.py @@ -55,7 +55,7 @@ def parse_config( # For inner type conversions because double tags do not work, e.g. !ENV !!float type_tag = 'tag:yaml.org,2002:' - type_tag_pattern = re.compile(f'({type_tag}\w+\s)') + type_tag_pattern = re.compile(rf'({type_tag}\w+\s)') def constructor_env_variables(loader, node): """