[bindings] Code formatting

This commit is contained in:
Frank Martinez
2025-09-25 21:43:39 -05:00
parent 802f62739e
commit c9579bbff2
191 changed files with 733 additions and 345 deletions

View File

@@ -8,6 +8,7 @@ from Vector import Vector
from Placement import Placement
from typing import overload
@export(
Constructor=True,
Delete=True,

View File

@@ -6,6 +6,7 @@ from Metadata import constmethod
from PyObjectBase import PyObjectBase
from typing import List, Final
class BaseClass(PyObjectBase):
"""
This is the base class

View File

@@ -8,6 +8,7 @@ from Vector import Vector
from Matrix import Matrix
from typing import overload, Any, Final, Tuple, Union
@export(
TwinPointer="BoundBox3d",
Constructor=True,
@@ -109,13 +110,13 @@ class BoundBox(PyObjectBase):
xMax: float = 0,
yMax: float = 0,
zMax: float = 0,
) -> None: ...
) -> None: ...
@overload
def __init__(
self,
min: Union[Vector, Tuple[float, float, float]],
max: Union[Vector, Tuple[float, float, float]],
) -> None: ...
) -> None: ...
# fmt: on
def setVoid(self) -> None:
@@ -136,13 +137,16 @@ class BoundBox(PyObjectBase):
...
@overload
def add(self, minMax: Vector, /) -> None: ...
def add(self, minMax: Vector, /) -> None:
...
@overload
def add(self, minMax: Tuple[float, float, float], /) -> None: ...
def add(self, minMax: Tuple[float, float, float], /) -> None:
...
@overload
def add(self, x: float, y: float, z: float, /) -> None: ...
def add(self, x: float, y: float, z: float, /) -> None:
...
def add(self, *args: Any, **kwargs: Any) -> None:
"""
@@ -189,9 +193,13 @@ class BoundBox(PyObjectBase):
...
@overload
def closestPoint(self, point: Vector, /) -> Vector: ...
def closestPoint(self, point: Vector, /) -> Vector:
...
@overload
def closestPoint(self, x: float, y: float, z: float, /) -> Vector: ...
def closestPoint(self, x: float, y: float, z: float, /) -> Vector:
...
@constmethod
def closestPoint(self, *args: Any, **kwargs: Any) -> Vector:
"""
@@ -212,13 +220,18 @@ class BoundBox(PyObjectBase):
...
@overload
def intersect(self, boundBox2: "BoundBox", /) -> bool: ...
def intersect(self, boundBox2: "BoundBox", /) -> bool:
...
@overload
def intersect(
self,
base: Union[Vector, Tuple[float, float, float]],
dir: Union[Vector, Tuple[float, float, float]],
/,) -> bool: ...
/,
) -> bool:
...
def intersect(self, *args: Any) -> bool:
"""
intersect(boundBox2) -> bool
@@ -281,11 +294,17 @@ class BoundBox(PyObjectBase):
...
@overload
def move(self, displacement: Vector, /) -> None: ...
def move(self, displacement: Vector, /) -> None:
...
@overload
def move(self, displacement: Tuple[float, float, float], /) -> None: ...
def move(self, displacement: Tuple[float, float, float], /) -> None:
...
@overload
def move(self, x: float, y: float, z: float, /) -> None: ...
def move(self, x: float, y: float, z: float, /) -> None:
...
def move(self, *args: Any, **kwargs: Any) -> None:
"""
move(displacement) -> None
@@ -305,11 +324,17 @@ class BoundBox(PyObjectBase):
...
@overload
def scale(self, factor: Vector, /) -> None: ...
def scale(self, factor: Vector, /) -> None:
...
@overload
def scale(self, factor: Tuple[float, float, float], /) -> None: ...
def scale(self, factor: Tuple[float, float, float], /) -> None:
...
@overload
def scale(self, x: float, y: float, z: float, /) -> None: ...
def scale(self, x: float, y: float, z: float, /) -> None:
...
def scale(self, *args: Any, **kwargs: Any) -> None:
"""
scale(factor) -> None
@@ -353,11 +378,17 @@ class BoundBox(PyObjectBase):
...
@overload
def isInside(self, object: Vector, /) -> bool: ...
def isInside(self, object: Vector, /) -> bool:
...
@overload
def isInside(self, object: "BoundBox", /) -> bool: ...
def isInside(self, object: "BoundBox", /) -> bool:
...
@overload
def isInside(self, x: float, y: float, z: float, /) -> bool: ...
def isInside(self, x: float, y: float, z: float, /) -> bool:
...
def isInside(self, *args: Any) -> bool:
"""
isInside(object) -> bool

View File

@@ -10,6 +10,7 @@ from Placement import Placement
from Rotation import Rotation
from typing import Union
@export(
Constructor=True,
Delete=True,

View File

@@ -8,6 +8,7 @@ from PyObjectBase import PyObjectBase
from enum import IntEnum
from typing import overload, Union, Tuple, Sequence
class ScaleType(IntEnum):
Other = -1
NoScaling = 0
@@ -15,6 +16,7 @@ class ScaleType(IntEnum):
NonUniformLeft = 2
Uniform = 3
@export(
TwinPointer="Matrix4D",
Constructor=True,
@@ -107,9 +109,13 @@ class Matrix(PyObjectBase):
"""The matrix elements."""
@overload
def move(self, vector: Vector, /) -> None: ...
def move(self, vector: Vector, /) -> None:
...
@overload
def move(self, x: float, y: float, z: float, /) -> None: ...
def move(self, x: float, y: float, z: float, /) -> None:
...
def move(self, *args) -> None:
"""
move(vector) -> None
@@ -129,11 +135,17 @@ class Matrix(PyObjectBase):
...
@overload
def scale(self, vector: Vector, /) -> None: ...
def scale(self, vector: Vector, /) -> None:
...
@overload
def scale(self, x: float, y: float, z: float, /) -> None: ...
def scale(self, x: float, y: float, z: float, /) -> None:
...
@overload
def scale(self, factor: float, /) -> None: ...
def scale(self, factor: float, /) -> None:
...
def scale(self, *args) -> None:
"""
scale(vector) -> None
@@ -335,9 +347,13 @@ class Matrix(PyObjectBase):
...
@overload
def multiply(self, matrix: "Matrix", /) -> "Matrix": ...
def multiply(self, matrix: "Matrix", /) -> "Matrix":
...
@overload
def multiply(self, vector: Vector, /) -> Vector: ...
def multiply(self, vector: Vector, /) -> Vector:
...
@constmethod
def multiply(self, obj: Union["Matrix", Vector], /) -> Union["Matrix", Vector]:
"""

View File

@@ -1,31 +1,40 @@
# SPDX-License: LGPL-2.1-or-later
from __future__ import annotations
"""
This file keeps auxiliary metadata to be used by the Python API stubs.
"""
def export(**kwargs):
"""
A decorator to attach metadata to a class.
"""
...
def constmethod(): ...
def no_args(): ...
def constmethod():
...
def no_args():
...
def forward_declarations(source_code):
"""
A decorator to attach forward declarations to a class.
"""
...
def class_declarations(source_code):
"""
A decorator to attach forward declarations to a class.
"""
...
def sequence_protocol(**kwargs):
"""
A decorator to attach sequence protocol metadata to a class.

View File

@@ -6,6 +6,7 @@ from Metadata import constmethod
from BaseClass import BaseClass
from typing import Final
class Persistence(BaseClass):
"""
Base.Persistence class.

View File

@@ -9,6 +9,7 @@ from Rotation import Rotation as RotationPy
from Vector import Vector
from typing import Sequence, overload
@export(
Constructor=True,
Delete=True,
@@ -119,7 +120,9 @@ class Placement(PyObjectBase):
@overload
def rotate(
self, center: Sequence[float], axis: Sequence[float], angle: float, *, comp: bool = False
) -> None: ...
) -> None:
...
def rotate(self, center: Vector, axis: Vector, angle: float, *, comp: bool = False) -> None:
"""
rotate(center, axis, angle, comp) -> None

View File

@@ -4,6 +4,7 @@ from __future__ import annotations
from PyObjectBase import PyObjectBase
class Precision(PyObjectBase):
"""
This is the Precision class

View File

@@ -2,6 +2,7 @@
from __future__ import annotations
class PyObjectBase:
"""
The most base class for Python bindings.

View File

@@ -7,6 +7,7 @@ from PyObjectBase import PyObjectBase
from typing import overload, Final, Tuple, Union
from Unit import Unit as UnitPy
@export(
NumberProtocol=True,
RichCompare=True,
@@ -65,9 +66,13 @@ class Quantity(PyObjectBase):
...
@overload
def toStr(self, /) -> str: ...
def toStr(self, /) -> str:
...
@overload
def toStr(self, decimals: int, /) -> str: ...
def toStr(self, decimals: int, /) -> str:
...
@constmethod
def getUserPreferred(self) -> Tuple["Quantity", str]:
"""
@@ -76,13 +81,21 @@ class Quantity(PyObjectBase):
...
@overload
def getValueAs(self, unit: str, /) -> float: ...
def getValueAs(self, unit: str, /) -> float:
...
@overload
def getValueAs(self, translation: float, unit_signature: int, /) -> float: ...
def getValueAs(self, translation: float, unit_signature: int, /) -> float:
...
@overload
def getValueAs(self, unit: UnitPy, /) -> float: ...
def getValueAs(self, unit: UnitPy, /) -> float:
...
@overload
def getValueAs(self, quantity: "Quantity", /) -> float: ...
def getValueAs(self, quantity: "Quantity", /) -> float:
...
@constmethod
def getValueAs(self, *args) -> float:
"""
@@ -106,6 +119,9 @@ class Quantity(PyObjectBase):
...
@overload
def __round__(self, /) -> int: ...
def __round__(self, /) -> int:
...
@overload
def __round__(self, ndigits: int, /) -> float: ...
def __round__(self, ndigits: int, /) -> float:
...

View File

@@ -8,6 +8,7 @@ from Vector import Vector
from Matrix import Matrix
from typing import overload, Tuple, List, Final
@export(
Constructor=True,
Delete=True,

View File

@@ -6,17 +6,16 @@ from Metadata import export, forward_declarations, constmethod
from PyObjectBase import PyObjectBase
from typing import List, Final
@export(
Twin="BaseType",
TwinPointer="BaseType",
Delete=True,
)
@forward_declarations(
"""
@forward_declarations("""
namespace Base {
using BaseType = Type;
}"""
)
}""")
class Type(PyObjectBase):
"""
BaseTypePy class.

View File

@@ -8,6 +8,7 @@ from Quantity import Quantity
from Unit import Unit
from typing import Final, Tuple, overload
@export(
NumberProtocol=True,
RichCompare=True,
@@ -31,7 +32,9 @@ class Unit(PyObjectBase):
"""
@overload
def __init__(self) -> None: ...
def __init__(self) -> None:
...
@overload
def __init__(
self,
@@ -43,13 +46,20 @@ class Unit(PyObjectBase):
i6: float,
i7: float,
i8: float,
) -> None: ...
) -> None:
...
@overload
def __init__(self, quantity: Quantity) -> None: ...
def __init__(self, quantity: Quantity) -> None:
...
@overload
def __init__(self, unit: Unit) -> None: ...
def __init__(self, unit: Unit) -> None:
...
@overload
def __init__(self, string: str) -> None: ...
def __init__(self, string: str) -> None:
...
Type: Final[str] = ...
"""holds the unit type as a string, e.g. 'Area'."""

View File

@@ -6,6 +6,7 @@ from Metadata import export, constmethod, sequence_protocol, class_declarations
from PyObjectBase import PyObjectBase
from typing import overload, Sequence, TYPE_CHECKING
@export(
TwinPointer="Vector3d",
Include="Base/Vector3D.h",