From b82073dd5737a3b32a185270cd56cdb0e9c77b3e Mon Sep 17 00:00:00 2001 From: sukanka Date: Sun, 1 Sep 2024 18:45:43 +0800 Subject: [PATCH] fix-py-syntax-warning --- src/bonsai/bonsai/bim/module/drawing/scheduler.py | 6 +++--- src/ifcopenshell-python/ifcopenshell/express/bootstrap.py | 2 +- .../ifcopenshell/express/rule_compiler.py | 2 +- src/ifcopenshell-python/ifcopenshell/file.py | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/bonsai/bonsai/bim/module/drawing/scheduler.py b/src/bonsai/bonsai/bim/module/drawing/scheduler.py index 2e7bc9034c..abe44ffd7a 100644 --- a/src/bonsai/bonsai/bim/module/drawing/scheduler.py +++ b/src/bonsai/bonsai/bim/module/drawing/scheduler.py @@ -81,11 +81,11 @@ class Scheduler: with open(stylesheet_path, "r") as stylesheet: css = stylesheet.read() - matches = re.search("--font-size-pt:\s*([0-9.]+);", css) + matches = re.search(r"--font-size-pt:\s*([0-9.]+);", css) self.font_size_pt = float(matches.groups()[0]) if matches else 12 # Default to 12pt - matches = re.search("--font-size-px:\s*([0-9.]+);", css) + matches = re.search(r"--font-size-px:\s*([0-9.]+);", css) self.font_size_px = float(matches.groups()[0]) if matches else 4.13 # Magic number 4.13px ~= 12pt - matches = re.search("--font-width:\s*([0-9.]+);", css) + matches = re.search(r"--font-width:\s*([0-9.]+);", css) self.font_width = float(matches.groups()[0]) if matches else 0.45 # A magic number for OpenGost self.svg.defs.add(self.svg.style(css)) diff --git a/src/ifcopenshell-python/ifcopenshell/express/bootstrap.py b/src/ifcopenshell-python/ifcopenshell/express/bootstrap.py index c93fdc21f5..9ff87d5ad0 100644 --- a/src/ifcopenshell-python/ifcopenshell/express/bootstrap.py +++ b/src/ifcopenshell-python/ifcopenshell/express/bootstrap.py @@ -204,7 +204,7 @@ for id in to_emit: statements.append("%s << %s" % (id, stmt)) if __name__ == "__main__": - print(""" + print(r""" # This file is generated by IfcOpenShell ifcexpressparser bootstrap.py from __future__ import annotations diff --git a/src/ifcopenshell-python/ifcopenshell/express/rule_compiler.py b/src/ifcopenshell-python/ifcopenshell/express/rule_compiler.py index b617036f8a..c49146ad33 100644 --- a/src/ifcopenshell-python/ifcopenshell/express/rule_compiler.py +++ b/src/ifcopenshell-python/ifcopenshell/express/rule_compiler.py @@ -585,7 +585,7 @@ def process_local_variable(context): if ( context.parameter_type.generalized_types.general_aggregation_types.general_set_type ): - expr = re.sub("(\[[^\]]*\])", "express_set(\\1)", expr) + expr = re.sub(r"(\[[^\]]*\])", "express_set(\\1)", expr) return "%s = %s" % (str(context.variable_id).lower(), expr) else: diff --git a/src/ifcopenshell-python/ifcopenshell/file.py b/src/ifcopenshell-python/ifcopenshell/file.py index 953693ba44..addca6a3be 100644 --- a/src/ifcopenshell-python/ifcopenshell/file.py +++ b/src/ifcopenshell-python/ifcopenshell/file.py @@ -409,7 +409,7 @@ class file: def schema(self) -> Literal["IFC2X3", "IFC4", "IFC4X3"]: """General IFC schema version: IFC2X3, IFC4, IFC4X3.""" prefixes = ("IFC", "X", "_ADD", "_TC") - reg = "".join(f"(?P<{s}>{s}\d+)?" for s in prefixes) + reg = "".join(f"(?P<{s}>{s}\\d+)?" for s in prefixes) match = re.match(reg, self.wrapped_data.schema) version_tuple = tuple( map(