[bindings] Fix overload order

This commit is contained in:
Frank Martinez
2025-10-07 12:04:08 -05:00
parent f6615763ad
commit d4d7cabdc5
9 changed files with 50 additions and 47 deletions

View File

@@ -3,7 +3,7 @@
from __future__ import annotations
from DocumentObject import DocumentObject
from Base import Placement
from Base.Placement import Placement
from typing import Any, Final, Optional
class GeoFeature(DocumentObject):

View File

@@ -24,8 +24,6 @@ class Material(PyObjectBase):
UserDocu: This is the Material class
"""
@overload
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def set(self, string: str, /) -> None:
"""
Set(string) -- Set the material.
@@ -35,6 +33,7 @@ class Material(PyObjectBase):
Satin, Metalized, Neon GNC, Chrome, Aluminium, Obsidian, Neon PHC, Jade, Ruby or Emerald.
"""
...
AmbientColor: Any = ...
"""Ambient color"""

View File

@@ -19,7 +19,9 @@ class StringHasher(BaseClass):
"""
@overload
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def getID(self, txt: str, base64: bool = False, /) -> Any: ...
@overload
def getID(self, id: int, base64: bool = False, /) -> Any: ...
def getID(self, arg: Any, base64: bool = False, /) -> Any:
"""
getID(txt|id, base64=False) -> StringID
@@ -34,16 +36,13 @@ class StringHasher(BaseClass):
"""
...
@overload
def getID(self, txt: str, base64: bool = False, /) -> Any: ...
@overload
def getID(self, id: int, base64: bool = False, /) -> Any: ...
@constmethod
def isSame(self, other: "StringHasher", /) -> bool:
"""
Check if two hasher are the same
"""
...
Count: Final[int] = 0
"""Return count of used hashes"""

View File

@@ -12,8 +12,8 @@ def export(**kwargs):
"""
...
def constmethod(): ...
def no_args(): ...
def constmethod(method): ...
def no_args(method): ...
def forward_declarations(source_code):
"""
A decorator to attach forward declarations to a class.

View File

@@ -120,6 +120,8 @@ class Placement(PyObjectBase):
def rotate(
self, center: Sequence[float], axis: Sequence[float], angle: float, *, comp: bool = False
) -> None: ...
@overload
def rotate(self, center: Vector, axis: Vector, angle: float, *, comp: bool = False) -> None:
"""
rotate(center, axis, angle, comp) -> None
@@ -138,6 +140,8 @@ class Placement(PyObjectBase):
optional keyword only argument, if True (default=False),
behave like TopoShape.rotate() (i.e. the resulting placements are interchangeable).
"""
def rotate(self, *args, **kwargs) -> None:
...
@constmethod

View File

@@ -54,6 +54,10 @@ class Quantity(PyObjectBase):
def __init__(self, string: str) -> None: ...
# fmt: on
@overload
def toStr(self, /) -> str: ...
@overload
def toStr(self, decimals: int, /) -> str: ...
@constmethod
def toStr(self, decimals: int = ..., /) -> str:
"""
@@ -64,10 +68,6 @@ class Quantity(PyObjectBase):
"""
...
@overload
def toStr(self, /) -> str: ...
@overload
def toStr(self, decimals: int, /) -> str: ...
@constmethod
def getUserPreferred(self) -> Tuple["Quantity", str]:
"""
@@ -97,6 +97,10 @@ class Quantity(PyObjectBase):
"""
...
@overload
def __round__(self, /) -> int: ...
@overload
def __round__(self, ndigits: int, /) -> float: ...
@constmethod
def __round__(self, ndigits: int = ..., /) -> Union[int, float]:
"""
@@ -105,7 +109,3 @@ class Quantity(PyObjectBase):
"""
...
@overload
def __round__(self, /) -> int: ...
@overload
def __round__(self, ndigits: int, /) -> float: ...

View File

@@ -5,7 +5,6 @@ from __future__ import annotations
from Metadata import export
from PyObjectBase import PyObjectBase
from Quantity import Quantity
from Unit import Unit
from typing import Final, Tuple, overload
@export(

View File

@@ -25,6 +25,14 @@ class LinkView(BaseClass):
"""
...
@overload
def setMaterial(self, material: None, /) -> None: ...
@overload
def setMaterial(self, material: Any, /) -> None: ...
@overload
def setMaterial(self, material: List[Any], /) -> None: ...
@overload
def setMaterial(self, material: Dict[int, Any], /) -> None: ...
def setMaterial(self, material: Any, /) -> None:
"""
setMaterial(Material): set the override material of the entire linked object
@@ -41,14 +49,11 @@ class LinkView(BaseClass):
"""
...
@overload
def setMaterial(self, material: None, /) -> None: ...
def setType(self, type: int, /) -> None: ...
@overload
def setMaterial(self, material: Any, /) -> None: ...
@overload
def setMaterial(self, material: List[Any], /) -> None: ...
@overload
def setMaterial(self, material: Dict[int, Any], /) -> None: ...
def setType(self, type: int, sublink: bool, /) -> None: ...
def setType(self, type: int, sublink: bool = True, /) -> None:
"""
setType(type, sublink=True): set the link type.
@@ -65,9 +70,11 @@ class LinkView(BaseClass):
...
@overload
def setType(self, type: int, /) -> None: ...
def setTransform(self, matrix: Any, /) -> None: ...
@overload
def setType(self, type: int, sublink: bool, /) -> None: ...
def setTransform(self, matrix: List[Any], /) -> None: ...
@overload
def setTransform(self, matrix: Dict[int, Any], /) -> None: ...
def setTransform(self, matrix: Any, /) -> None:
"""
setTransform(matrix): set transformation of the linked object
@@ -80,12 +87,6 @@ class LinkView(BaseClass):
"""
...
@overload
def setTransform(self, matrix: Any, /) -> None: ...
@overload
def setTransform(self, matrix: List[Any], /) -> None: ...
@overload
def setTransform(self, matrix: Dict[int, Any], /) -> None: ...
def setChildren(self, children: List[Any], vis: List[Any] = [], type: int = 0, /) -> None:
"""
setChildren([obj...],vis=[],type=0)
@@ -102,6 +103,12 @@ class LinkView(BaseClass):
"""
...
@overload
def setLink(self, obj: Any, /) -> None: ...
@overload
def setLink(self, obj: Any, subname: str, /) -> None: ...
@overload
def setLink(self, obj: Any, subname: List[str], /) -> None: ...
def setLink(self, obj: Any, subname: Any = None, /) -> None:
"""
setLink(object): Set the link
@@ -119,12 +126,6 @@ class LinkView(BaseClass):
"""
...
@overload
def setLink(self, obj: Any, /) -> None: ...
@overload
def setLink(self, obj: Any, subname: str, /) -> None: ...
@overload
def setLink(self, obj: Any, subname: List[str], /) -> None: ...
def getDetailPath(self, element: Any, /) -> Tuple[Any, Any]:
"""
getDetailPath(element): get the 3d path an detail of an element.

View File

@@ -521,6 +521,12 @@ class TopoShape(ComplexGeoData):
"""
...
@overload
@constmethod
def makeFillet(self, radius: float, edgeList: List, /) -> TopoShape: ...
@overload
@constmethod
def makeFillet(self, radius1: float, radius2: float, edgeList: List, /) -> TopoShape: ...
@constmethod
def makeFillet(self, *args) -> TopoShape:
"""
@@ -531,12 +537,13 @@ class TopoShape(ComplexGeoData):
"""
...
@overload
@constmethod
def makeFillet(self, radius: float, edgeList: List, /) -> TopoShape: ...
def makeChamfer(self, radius: float, edgeList: List, /) -> TopoShape: ...
@overload
@constmethod
def makeFillet(self, radius1: float, radius2: float, edgeList: List, /) -> TopoShape: ...
def makeChamfer(self, radius1: float, radius2: float, edgeList: List, /) -> TopoShape: ...
@constmethod
def makeChamfer(self, *args) -> TopoShape:
"""
@@ -547,12 +554,6 @@ class TopoShape(ComplexGeoData):
"""
...
@overload
@constmethod
def makeChamfer(self, radius: float, edgeList: List, /) -> TopoShape: ...
@overload
@constmethod
def makeChamfer(self, radius1: float, radius2: float, edgeList: List, /) -> TopoShape: ...
@constmethod
def makeThickness(self, faces: List, offset: float, tolerance: float, /) -> TopoShape:
"""