Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[MNT]: Add type stubs for proj3d.pyi to resolve inconsistent type ann…#30716

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
Zrahay wants to merge1 commit intomatplotlib:main
base:main
Choose a base branch
Loading
fromZrahay:feature/typehinting

Conversation

@Zrahay
Copy link

PR summary

Adds type stub file (.pyi) formpl_toolkits/mplot3d/proj3d.py to improve type checking and IDE support for 3D projection functions.

closes #XXXX

PR checklist

  • "closes[MNT]: Inconsistent type annotation #30670 " is in the body of the PR description
  • [N/A] new and changed code is tested
  • [N/A] Plotting related features are demonstrated in an example
  • [N/A] New Features and API Changes are noted with a directive
  • Documentation complies with general and docstring guidelines

Copy link
Member

@timhoffmtimhoffm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thanks for your willingness to contribute. However, please take more care when submitting a pull request. There are several errors in the types, some of which are quite obvious.

Also, please format the file appropriately. While we do not enforce strict formatting, excessive long lines and missing spaces like inM:np.ndarray reduce readability. You may run black/ruff format over the file or just look at existing .pyi files how we do this.


def _view_transformation_uvw(u: np.ndarray, v: np.ndarray, w: np.ndarray, E:np.ndarray) -> np.ndarray: ...

def _persp_transformation(zfront: np.typing.ArrayLike, zback: np.typing.ArrayLike, focal_length: np.typing.ArrayLike) -> np.ndarray: ...
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
def_persp_transformation(zfront:np.typing.ArrayLike,zback:np.typing.ArrayLike,focal_length:np.typing.ArrayLike)->np.ndarray: ...
def_persp_transformation(zfront:float,zback:float,focal_length:float)->np.ndarray: ...




def _ortho_transformation(zfront, zback) -> np.ndarray: ...
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
def_ortho_transformation(zfront,zback)->np.ndarray: ...
def_ortho_transformation(zfront:float,zback:float)->np.ndarray: ...

def _proj_transform_vectors(vecs: np.ndarray, M: np.ndarray) -> np.ndarray: ...


def _proj_transform_vec_clip(vec: np.typing.ArrayLike, M: np.ndarray, focal_length:np.typing.ArrayLike) -> tuple[np.ndarray, np.ndarray, np.ndarray]: ...
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
def_proj_transform_vec_clip(vec:np.typing.ArrayLike,M:np.ndarray,focal_length:np.typing.ArrayLike)->tuple[np.ndarray,np.ndarray,np.ndarray]: ...
def_proj_transform_vec_clip(vec:np.ndarray,M:np.ndarray,focal_length:float)->tuple[np.ndarray,np.ndarray,np.ndarray]: ...

Also the return type cannot be correct because it has 4 elements. Please fix this as well for the functions that propagate this return value.




def _proj_transform_vec(vec: np.typing.ArrayLike, M: np.typing.ArrayLike) -> tuple[float, float, float]: ...
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The return type is not correct the three tuple elements are not simple floats. Likely ndarrays, but please recheck.

@_api.deprecated("3.10")
def proj_transform_clip(xs: np.typing.ArrayLike, ys: np.typing.ArrayLike, zs: np.typing.ArrayLike, M:np.ndarray) -> tuple[np.ndarray, np.ndarray, np.ndarray]: ...

def _proj_transform_clip(xs: np.typing.ArrayLike, ys: np.typing.ArrayLike, zs: np.typing.ArrayLike, M:np.ndarray, focal_length: np.typing.ArrayLike) -> tuple[np.ndarray, np.ndarray, np.ndarray]: ...
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
def_proj_transform_clip(xs:np.typing.ArrayLike,ys:np.typing.ArrayLike,zs:np.typing.ArrayLike,M:np.ndarray,focal_length:np.typing.ArrayLike)->tuple[np.ndarray,np.ndarray,np.ndarray]: ...
def_proj_transform_clip(xs:np.typing.ArrayLike,ys:np.typing.ArrayLike,zs:np.typing.ArrayLike,M:np.ndarray,focal_length:float)->tuple[np.ndarray,np.ndarray,np.ndarray]: ...

@Zrahay
Copy link
Author

Zrahay commentedNov 2, 2025
edited
Loading

@timhoffm I am so terribly sorry for the mistake from my end. I understand your frustration and will close my PR in some time.

Thanks for the feedback! Since I am new to Open Source, your feedback is only going to help me get better.

@rcomer
Copy link
Member

@Zrahay you do not need to close this PR. Please make the corrections on this branch and push them. They will show up here.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@timhoffmtimhoffmtimhoffm left review comments

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[MNT]: Inconsistent type annotation

3 participants

@Zrahay@rcomer@timhoffm

[8]ページ先頭

©2009-2025 Movatter.jp