-
-
Notifications
You must be signed in to change notification settings - Fork 113
Review the Location constructor and optimize the valid overloads #441
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
kwargs are currently not working in |
@gumyr I have been looking at this issue again and here are the current overloads for the class Location:
"@overloads" #omitting future @overload for brevity
X def __init__(self):
def __init__(self, location: Location):
X def __init__(self, translation: VectorLike, angle: float = 0):
C def __init__(self, translation: VectorLike, rotation: RotationLike | None = None):
C def __init__(self, translation: VectorLike, rotation: RotationLike, ordering: Extrinsic | Intrinsic):
def __init__(self, plane: Plane):
def __init__(self, plane: Plane, plane_offset: VectorLike):
def __init__(self, top_loc: TopLoc_Location):
def __init__(self, gp_trsf: gp_Trsf):
X def __init__(self, translation: VectorLike, direction: VectorLike, angle: float):
┕ DELETE those marked with "X", COMBINE marked with "C"
#actual constructor \/
def __init__(self, *args): # consider adding **kwargs
... Furthermore I agree that all uses of class Location:
"@overloads" #omitting future @overload for brevity
def __init__(self, position: VectorLike | None = None, orientation: RotationLike | None = None, ordering: Extrinsic | Intrinsic | None = None):
def __init__(self, plane: Plane):
def __init__(self, location: Location):
def __init__(self, top_loc: TopLoc_Location):
def __init__(self, gp_trsf: gp_Trsf):
#actual constructor \/
def __init__(self, *args, **kwargs):
... What do you think? If this is acceptable I can work on the actual constructor init. EDIT: I realized that it should be possible to eliminate the empty init overload, and changed the first init overload to have a default value for |
@jdegenstein thanks for all the work you did to close this one. Commit 6711511 adds a little to your PR #991 to handle all of the overload cases except Plane/plane offset so it has minimal backwards compatibility issues. All of your kwargs tests pass in addition to the existing Location tests (minus the one Plane/plane offset test that isn't needed anymore). Hopefully this issue is good and closed now. |
Some of the Location constructor's overloads seem confusing and may not be optimal. Specifically,
seems misleading at best. The term
translation
anddirection
should also be reconsidered as there areposition
andorientation
properties.The text was updated successfully, but these errors were encountered: