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

Add type stubs for Axes3D and improve type hints in _AxesBase#30713

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
ABarpanda wants to merge5 commits intomatplotlib:main
base:main
Choose a base branch
Loading
fromABarpanda:abarpanda

Conversation

@ABarpanda
Copy link

@ABarpandaABarpanda commentedOct 31, 2025
edited
Loading

PR summary

This PR adds a new type stub file for mpl_toolkits.mplot3d.axes3d and makes minor improvements to type hints in matplotlib.axes._base.

  • Added axes3d.pyi with type definitions for Axes3D, _Quaternion, and get_test_data.

  • Updated _base.py and _base.pyi with more explicit annotations for _shared_axes and _twinned_axes.

  • Since there are no dedicated test files for these modules, pytest could not be used.

  • Type checking was done using mypy; remaining errors are from inherited parent classes, not the new additions.

PR checklist

Copy link
Member

@QuLogicQuLogic left a comment

Choose a reason for hiding this comment

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

You will need to fix the linting errors. There are also a lot ofAny; I'm not sure how helpful the type hints are with so many of them.

importnumpyasnp
fromnumpy.typingimportArrayLike
fromtypingimportAny,Literal,TypeVar,overload
fromtypingimportAny,Literal,TypeVar,overload,List
Copy link
Member

Choose a reason for hiding this comment

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

We don't use these deprecated aliases; you should be usinglist.

Comment on lines +48 to +50
def__init__(self,bounds:Sequence[float],transform:Transform)->None: ...

def__call__(self,ax:Any,renderer:Any)->Bbox: ...
Copy link
Member

Choose a reason for hiding this comment

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

Don't need the blank lines between methods in type stubs.

title:Text
_axis_map:dict[str,Axis]
_projection_init:Any
_axis_names:tuple[Literal['x'],Literal['y']]|tuple[Literal['x'],Literal['y'],Literal['z']]
Copy link
Member

Choose a reason for hiding this comment

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

This type is definitely not literals.

fig : Figure
The parent figure.
rect : tuple (left, bottom, width, height), default:(0, 0, 1, 1)
rect : tuple (left, bottom, width, height), default:None
Copy link
Member

Choose a reason for hiding this comment

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

This change is unrelated, and incorrect.

from __future__importannotations
__all__= ["Axes3D","_Quaternion","get_test_data"]

fromtypingimportAny,List,Optional,Sequence,Tuple,Union
Copy link
Member

Choose a reason for hiding this comment

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

Remove all deprecated aliases. We don't useOptional orUnion either.

@@ -0,0 +1,170 @@
from __future__importannotations
__all__= ["Axes3D","_Quaternion","get_test_data"]
Copy link
Member

Choose a reason for hiding this comment

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

Is__all__ actually relevant in type stubs?

@ABarpanda
Copy link
Author

Oh thanks
The comments are really detailed😅
I will make the changes as soon as possible

label_namer="y")
@_docstring.interpd
defscatter(self,x,y,s=None,c=None,marker=None,cmap=None,norm=None,
defscatter(self,x,y,z=0,s=None,c=None,marker=None,cmap=None,norm=None,
Copy link
Member

Choose a reason for hiding this comment

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

You can't change the signature of Axes methods. Please revert.

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

Reviewers

@QuLogicQuLogicQuLogic left review comments

@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

@ABarpanda@QuLogic@timhoffm

[8]ページ先頭

©2009-2025 Movatter.jp