Skip to content

Added stub for user module #1454

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

Merged
merged 6 commits into from
Jul 2, 2017
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions stdlib/2/user.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Stubs for user (Python 2)

# Docs: https://docs.python.org/2/library/user.html
# Source: https://hg.python.org/cpython/file/2.7/Lib/user.py
from typing import BinaryIO, Text, Union


home: str
pythonrc: Union[bytes, Text]
Copy link
Member

Choose a reason for hiding this comment

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

Isn't it always bytes?

Copy link
Contributor Author

@ashwch ashwch Jul 2, 2017

Choose a reason for hiding this comment

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

In this case yes, but it can return both in general.

Copy link
Member

Choose a reason for hiding this comment

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

Well, in this case all the arguments are bytes, so the return will also be bytes.

f: BinaryIO
Copy link
Member

Choose a reason for hiding this comment

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

This may not exist (it will only exist if ~/.pythonrc.py exists).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@JelleZijlstra How do we deal with variables that may or may not exist?

Secondly is it okay if I include few more stubs in the same PR?

Copy link
Member

Choose a reason for hiding this comment

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

I think the module-level __getattr__ should suffice and we can just omit f.

Copy link
Member

Choose a reason for hiding this comment

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

Also, please submit stubs for other modules as separate PRs.