Update stub for spwd (#1372)

Update stub for spwd

- Use `NamedTuple`
- Fix stub for Python 3
  - Some attributes are changed from Python 2
    - `sp_nam` -> `sp_namp`
    - `sp_pwd` -> `sp_pwdp`
This commit is contained in:
Yusuke Miyazaki
2017-06-01 04:07:21 +09:00
committed by Guido van Rossum
parent 6f07424246
commit 193e6885d4
3 changed files with 28 additions and 15 deletions

14
stdlib/2/spwd.pyi Normal file
View File

@@ -0,0 +1,14 @@
from typing import List, NamedTuple
struct_spwd = NamedTuple("struct_spwd", [("sp_nam", str),
("sp_pwd", str),
("sp_lstchg", int),
("sp_min", int),
("sp_max", int),
("sp_warn", int),
("sp_inact", int),
("sp_expire", int),
("sp_flag", int)])
def getspall() -> List[struct_spwd]: ...
def getspnam(name: str) -> struct_spwd: ...

View File

@@ -1,15 +0,0 @@
from typing import List
class struct_spwd(object):
sp_nam = ... # type: str
sp_pwd = ... # type: str
sp_lstchg = ... # type: int
sp_min = ... # type: int
sp_max = ... # type: int
sp_warn = ... # type: int
sp_inact = ... # type: int
sp_expire = ... # type: int
sp_flag = ... # type: int
def getspall() -> List[struct_spwd]: ...
def getspnam(name: str) -> struct_spwd: ...

14
stdlib/3/spwd.pyi Normal file
View File

@@ -0,0 +1,14 @@
from typing import List, NamedTuple
struct_spwd = NamedTuple("struct_spwd", [("sp_namp", str),
("sp_pwdp", str),
("sp_lstchg", int),
("sp_min", int),
("sp_max", int),
("sp_warn", int),
("sp_inact", int),
("sp_expire", int),
("sp_flag", int)])
def getspall() -> List[struct_spwd]: ...
def getspnam(name: str) -> struct_spwd: ...