mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-05 23:41:44 +00:00
entity_instance.py: fix oveloads signatures (f93d79dc)
Without `/` overload implies that it also accepts kw args, while the implementation signature doesn't support them.
This commit is contained in:
@@ -409,9 +409,9 @@ class entity_instance:
|
|||||||
@overload
|
@overload
|
||||||
def is_a(self) -> str: ...
|
def is_a(self) -> str: ...
|
||||||
@overload
|
@overload
|
||||||
def is_a(self, ifc_class: str) -> bool: ...
|
def is_a(self, ifc_class: str, /) -> bool: ...
|
||||||
@overload
|
@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]:
|
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.
|
"""Return the IFC class name of an instance, or checks if an instance belongs to a class.
|
||||||
|
|
||||||
|
|||||||
@@ -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"
|
||||||
Reference in New Issue
Block a user