From 193e6885d4478d390c218e69c8fdf94384953f0a Mon Sep 17 00:00:00 2001 From: Yusuke Miyazaki Date: Thu, 1 Jun 2017 04:07:21 +0900 Subject: [PATCH] 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` --- stdlib/2/spwd.pyi | 14 ++++++++++++++ stdlib/2and3/spwd.pyi | 15 --------------- stdlib/3/spwd.pyi | 14 ++++++++++++++ 3 files changed, 28 insertions(+), 15 deletions(-) create mode 100644 stdlib/2/spwd.pyi delete mode 100644 stdlib/2and3/spwd.pyi create mode 100644 stdlib/3/spwd.pyi diff --git a/stdlib/2/spwd.pyi b/stdlib/2/spwd.pyi new file mode 100644 index 000000000..1d5899031 --- /dev/null +++ b/stdlib/2/spwd.pyi @@ -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: ... diff --git a/stdlib/2and3/spwd.pyi b/stdlib/2and3/spwd.pyi deleted file mode 100644 index ca77abd37..000000000 --- a/stdlib/2and3/spwd.pyi +++ /dev/null @@ -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: ... diff --git a/stdlib/3/spwd.pyi b/stdlib/3/spwd.pyi new file mode 100644 index 000000000..0e55d7421 --- /dev/null +++ b/stdlib/3/spwd.pyi @@ -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: ...