From 4032bbbd17d3831f17ffaefd2593bf3204716c40 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Tue, 14 Jul 2026 14:33:38 +0500 Subject: [PATCH] entity_instance.py: fix oveloads signatures (f93d79dc) Without `/` overload implies that it also accepts kw args, while the implementation signature doesn't support them. --- .../ifcopenshell/entity_instance.py | 4 ++-- ty.py | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 ty.py diff --git a/src/ifcopenshell-python/ifcopenshell/entity_instance.py b/src/ifcopenshell-python/ifcopenshell/entity_instance.py index fe7608de0b..46fef0a37f 100644 --- a/src/ifcopenshell-python/ifcopenshell/entity_instance.py +++ b/src/ifcopenshell-python/ifcopenshell/entity_instance.py @@ -409,9 +409,9 @@ class entity_instance: @overload def is_a(self) -> str: ... @overload - def is_a(self, ifc_class: str) -> bool: ... + def is_a(self, ifc_class: str, /) -> bool: ... @overload - def is_a(self, with_schema: bool) -> str: ... + def is_a(self, with_schema: bool, /) -> str: ... def is_a(self, *args: Union[str, bool]) -> Union[str, bool]: """Return the IFC class name of an instance, or checks if an instance belongs to a class. diff --git a/ty.py b/ty.py new file mode 100644 index 0000000000..10c33ee524 --- /dev/null +++ b/ty.py @@ -0,0 +1,12 @@ +from typing import Union, overload + + +class entity_instance: + @overload + def is_a(self) -> str: ... + @overload + def is_a(self, ifc_class: str, /) -> bool: ... + @overload + def is_a(self, with_schema: bool, /) -> str: ... + def is_a(self, *args: Union[str, bool]) -> Union[str, bool]: + return args[0] if args else "foo"