From 57d7d83ebbe3a0b86f283f90deb49bbec72fb6ec Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Tue, 11 Feb 2025 16:50:00 +0500 Subject: [PATCH] Fix Python <3.10 support #6141 --- .../ifcopenshell/api/geometry/validate_type.py | 3 ++- src/ifcopenshell-python/ifcopenshell/util/representation.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ifcopenshell-python/ifcopenshell/api/geometry/validate_type.py b/src/ifcopenshell-python/ifcopenshell/api/geometry/validate_type.py index ef3c9a0bbf..3848a0fb87 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/geometry/validate_type.py +++ b/src/ifcopenshell-python/ifcopenshell/api/geometry/validate_type.py @@ -18,12 +18,13 @@ import ifcopenshell.api.geometry import ifcopenshell.util.representation +from typing import Union def validate_type( file: ifcopenshell.file, representation: ifcopenshell.entity_instance, - preferred_item: ifcopenshell.entity_instance | None = None, + preferred_item: Union[ifcopenshell.entity_instance, None] = None, ) -> bool: """Validates the RepresentationType of an IfcShapeRepresentation diff --git a/src/ifcopenshell-python/ifcopenshell/util/representation.py b/src/ifcopenshell-python/ifcopenshell/util/representation.py index 556067ab06..1255621608 100644 --- a/src/ifcopenshell-python/ifcopenshell/util/representation.py +++ b/src/ifcopenshell-python/ifcopenshell/util/representation.py @@ -146,7 +146,7 @@ def get_representation( return r -def guess_type(items: Sequence[ifcopenshell.entity_instance]) -> str | None: +def guess_type(items: Sequence[ifcopenshell.entity_instance]) -> Union[str, None]: """Guesses the appropriate RepresentationType attribute based on a list of items :param items: A list of IfcRepresentationItem, typically in an IfcShapeRepresentation