From 8ce64ce782037031e32210b2646f64975279c0bb Mon Sep 17 00:00:00 2001 From: Andrey Vlasovskikh Date: Sun, 29 Jan 2017 22:16:23 +0300 Subject: [PATCH] Updates to slice built-in (#891) Makes args and attributes optional. --- stdlib/2/__builtin__.pyi | 13 ++++++++----- stdlib/3/builtins.pyi | 11 +++++++---- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/stdlib/2/__builtin__.pyi b/stdlib/2/__builtin__.pyi index e538d7f22..2d8da1561 100644 --- a/stdlib/2/__builtin__.pyi +++ b/stdlib/2/__builtin__.pyi @@ -463,11 +463,14 @@ class bytearray(MutableSequence[int]): class bool(int, SupportsInt, SupportsFloat): def __init__(self, o: object = ...) -> None: ... -class slice: - start = 0 - step = 0 - stop = 0 - def __init__(self, start: int, stop: int = 0, step: int = 0) -> None: ... +class slice(object): + start = ... # type: Optional[int] + step = ... # type: Optional[int] + stop = ... # type: Optional[int] + @overload + def __init__(self, stop: int = None) -> None: ... + @overload + def __init__(self, start: int = None, stop: int = None, step: int = None) -> None: ... class tuple(Sequence[_T_co], Generic[_T_co]): def __init__(self, iterable: Iterable[_T_co] = ...) -> None: ... diff --git a/stdlib/3/builtins.pyi b/stdlib/3/builtins.pyi index 7ccb5959a..2c1200dfa 100644 --- a/stdlib/3/builtins.pyi +++ b/stdlib/3/builtins.pyi @@ -481,10 +481,13 @@ class bool(int, SupportsInt, SupportsFloat): def __init__(self, o: object = ...) -> None: ... class slice: - start = 0 - step = 0 - stop = 0 - def __init__(self, start: Optional[int], stop: Optional[int] = 0, step: Optional[int] = 0) -> None: ... + start = ... # type: Optional[int] + step = ... # type: Optional[int] + stop = ... # type: Optional[int] + @overload + def __init__(self, stop: int = None) -> None: ... + @overload + def __init__(self, start: int = None, stop: int = None, step: int = None) -> None: ... class tuple(Sequence[_T_co], Generic[_T_co]): def __init__(self, iterable: Iterable[_T_co] = ...) -> None: ...