-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Conversation
This seems like a bit of a special case, in that it's intended to include arbitrary user-specified code. I think we should add a module-level |
stdlib/2/user.pyi
Outdated
|
||
|
||
home: str | ||
pythonrc: Union[bytes, Text] |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
stdlib/2/user.pyi
Outdated
|
||
home: str | ||
pythonrc: Union[bytes, Text] | ||
f: BinaryIO |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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.
To fix the test failure, you can add |
* python/master: Added stub for toaiff module (python#1455) Added stub for user module (python#1454) Add more multiprocessing function stubs (python#1435) PyYaml: uncomment commented out imports and add missing classmethod decorators (python#1439) Allow `os.readlink` to accept path-like objects (python#1441) Support named attributes in `os.uname()` result (python#1445) Fix signature for slite3.fetchmany (python#1444) Add __name__ field to MethodType (python#1442) Add TypedDict total argument (python#1443)
Related to: #1147