Fix python 3.12 SyntaxWarning (#4045)

Regular expressions now need to be double-escaped:
https://docs.python.org/3/whatsnew/3.12.html#other-language-changes
This commit is contained in:
Bruno Postle
2023-11-28 22:51:58 +00:00
parent 434a11a502
commit 5face7170f
+2 -2
View File
@@ -34,7 +34,7 @@ class IfcGit:
working_dir = repo.working_dir
for item in os.listdir(working_dir):
path = os.path.join(working_dir, item)
if os.path.isfile(path) and re.match(".*\.ifc$", path, re.IGNORECASE):
if os.path.isfile(path) and re.match(".*\\.ifc$", path, re.IGNORECASE):
cls.load_project(path)
return True
return False
@@ -202,7 +202,7 @@ class IfcGit:
"""Check a bare branch or tag name is valid"""
return re.match(
"^(?!\.| |-|/)((?!\.\.)(?!.*/\.)(/\*|/\*/)*(?!@\{)[^\~\:\^\\\ \?*\[])+(?<!\.|/)(?<!\.lock)$",
"^(?!\\.| |-|/)((?!\\.\\.)(?!.*/\\.)(/\\*|/\\*/)*(?!@\\{)[^\\~\\:\\^\\\\ \\?*\\[])+(?<!\\.|/)(?<!\\.lock)$",
string,
)