Skip to content
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

Fix Type Annotations in pandas.core.generic #25901

Closed
WillAyd opened this issue Mar 28, 2019 · 7 comments · Fixed by #25909
Closed

Fix Type Annotations in pandas.core.generic #25901

WillAyd opened this issue Mar 28, 2019 · 7 comments · Fixed by #25909
Labels
good first issue Typing type annotations, mypy/pyright type checking
Milestone

Comments

@WillAyd
Copy link
Member

WillAyd commented Mar 28, 2019

Part of #25882

Current errors are as follows:

pandas/core/generic.py:116: error: Need type annotation for '_accessors'
pandas/core/generic.py:119: error: Need type annotation for '_metadata'

Both of these are containers which should contain strings, so just need proper annotation and this module can be removed from mypy.ini

@WillAyd WillAyd added good first issue Typing type annotations, mypy/pyright type checking labels Mar 28, 2019
@WillAyd WillAyd added this to the Contributions Welcome milestone Mar 28, 2019
@WillAyd
Copy link
Member Author

WillAyd commented Mar 28, 2019

Also makes sense to clean up a similar error in the frame module:

pandas/core/frame.py:368: error: Need type annotation for '_accessors'

@vaibhavhrt
Copy link
Contributor

vaibhavhrt commented Mar 28, 2019

I think we need to add a comment like this: # type: List[str] or

from typing import Container
_metadata: Container[str] = []

right? I can do that. But I have never contributed to open source before so if you can help me a bit if I get stuck somewhere it will be nice.

@vaibhavhrt
Copy link
Contributor

Hi, I tried _metadata: Container[str] = [] but now pep8 gives me error that:

pandas/core/generic.py:120:14: E701 multiple statements on one line (colon)

Should I use the the comment syntax # type: Container[str] or can we ignore this error?

@WillAyd
Copy link
Member Author

WillAyd commented Mar 28, 2019 via email

@vaibhavhrt
Copy link
Contributor

Thanks, I will fix this and open a pull request. There are some other open issues related to Type Annotation, should I fix them too in the same PR, or you want different PR for each one?

Also looking at the code _metadata looks like a list to me, should I use List[str] or Container[str]

@WillAyd
Copy link
Member Author

WillAyd commented Mar 28, 2019 via email

@vaibhavhrt
Copy link
Contributor

ok. You said list in your last comment, sorry I missed that, my bad. I was looking at your very first comment which said both are containers.

@jreback jreback modified the milestones: Contributions Welcome, 0.25.0 Mar 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Typing type annotations, mypy/pyright type checking
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants