Skip to content

Update pwd stub file #5741

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 7 commits into from
Jul 9, 2021
Merged

Update pwd stub file #5741

merged 7 commits into from
Jul 9, 2021

Conversation

LeMeteore
Copy link
Contributor

Add the following properties to struct_passwd:

  • n_fields
  • n_sequence_fields
  • n_unnamed_fields

To fix the following errors:

  • pwd.struct_passwd.n_fields is not present in stub
  • pwd.struct_passwd.n_sequence_fields is not present in stub
  • pwd.struct_passwd.n_unnamed_fields is not present in stub

Add the following properties to struct_passwd:
* n_fields
* n_sequence_fields
* n_unnamed_fields

To fix the following errors:
* pwd.struct_passwd.n_fields is not present in stub
* pwd.struct_passwd.n_sequence_fields is not present in stub
* pwd.struct_passwd.n_unnamed_fields is not present in stub
@github-actions

This comment has been minimized.

@JelleZijlstra
Copy link
Member

Could you reformat with Black?

@LeMeteore
Copy link
Contributor Author

LeMeteore commented Jul 9, 2021 via email

@github-actions

This comment has been minimized.

@LeMeteore
Copy link
Contributor Author

LeMeteore commented Jul 9, 2021

I see there Is the Pillow error:

stubtest failed for Pillow
error: PIL.Image.Image.__array__ is inconsistent, stub does not have argument "dtype"

But :\
Capture d’écran_2021-07-09_08-00-00

@Akuli
Copy link
Collaborator

Akuli commented Jul 9, 2021

PIL error is unrelated to this PR. See #5746

stdlib/pwd.pyi Outdated
Comment on lines 11 to 16
@property
def n_fields(self) -> int: ...
@property
def n_sequence_fields(self) -> int: ...
@property
def n_unnamed_fields(self) -> int: ...
Copy link
Collaborator

@srittau srittau Jul 9, 2021

Choose a reason for hiding this comment

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

These are actually class properties:

srittau@blitz:~$ python3
Python 3.7.3 (default, Jan 22 2021, 20:04:44) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pwd
>>> pwd.struct_passwd.n_fields
7
>>> 

Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe:

Suggested change
@property
def n_fields(self) -> int: ...
@property
def n_sequence_fields(self) -> int: ...
@property
def n_unnamed_fields(self) -> int: ...
n_fields: ClassVar[int]
n_sequence_fields: ClassVar[int]
n_unnamed_fields: ClassVar[int]

You will need to add from typing import ClassVar.

@github-actions

This comment has been minimized.

@Akuli
Copy link
Collaborator

Akuli commented Jul 9, 2021

You need to run isort pwd.pyi.

@github-actions

This comment has been minimized.

@LeMeteore
Copy link
Contributor Author

Thanks a lot for your time, advices & suggestions 😆

@github-actions
Copy link
Contributor

github-actions bot commented Jul 9, 2021

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@Akuli Akuli merged commit 0330530 into python:master Jul 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants