From 4aa6dfccdbe52e818872d23283ab9d490442747e Mon Sep 17 00:00:00 2001 From: hauntsaninja Date: Tue, 7 Jan 2020 21:51:54 -0800 Subject: [PATCH] pprint: update for py38, fix kwarg-only parameters (#3585) --- stdlib/2and3/pprint.pyi | 52 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 46 insertions(+), 6 deletions(-) diff --git a/stdlib/2and3/pprint.pyi b/stdlib/2and3/pprint.pyi index 3b15d7312..d257cb0d6 100644 --- a/stdlib/2and3/pprint.pyi +++ b/stdlib/2and3/pprint.pyi @@ -6,16 +6,45 @@ import sys from typing import Any, Dict, Tuple, IO, Optional -if sys.version_info >= (3, 4): +if sys.version_info >= (3, 8): + def pformat( + o: object, indent: int = ..., width: int = ..., depth: Optional[int] = ..., *, compact: bool = ..., sort_dicts: bool = ... + ) -> str: ... + +elif sys.version_info >= (3, 4): def pformat(o: object, indent: int = ..., width: int = ..., - depth: Optional[int] = ..., compact: bool = ...) -> str: ... + depth: Optional[int] = ..., *, compact: bool = ...) -> str: ... else: def pformat(o: object, indent: int = ..., width: int = ..., depth: Optional[int] = ...) -> str: ... -if sys.version_info >= (3, 4): +if sys.version_info >= (3, 8): + def pp( + o: object, + stream: Optional[IO[str]] = ..., + indent: int = ..., + width: int = ..., + depth: Optional[int] = ..., + *, + compact: bool = ..., + sort_dicts: bool = ..., + ) -> None: ... + +if sys.version_info >= (3, 8): + def pprint( + o: object, + stream: Optional[IO[str]] = ..., + indent: int = ..., + width: int = ..., + depth: Optional[int] = ..., + *, + compact: bool = ..., + sort_dicts: bool = ..., + ) -> None: ... + +elif sys.version_info >= (3, 4): def pprint(o: object, stream: Optional[IO[str]] = ..., indent: int = ..., width: int = ..., - depth: Optional[int] = ..., compact: bool = ...) -> None: ... + depth: Optional[int] = ..., *, compact: bool = ...) -> None: ... else: def pprint(o: object, stream: Optional[IO[str]] = ..., indent: int = ..., width: int = ..., depth: Optional[int] = ...) -> None: ... @@ -25,9 +54,20 @@ def isrecursive(o: object) -> bool: ... def saferepr(o: object) -> str: ... class PrettyPrinter: - if sys.version_info >= (3, 4): + if sys.version_info >= (3, 8): + def __init__( + self, + indent: int = ..., + width: int = ..., + depth: Optional[int] = ..., + stream: Optional[IO[str]] = ..., + *, + compact: bool = ..., + sort_dicts: bool = ..., + ) -> None: ... + elif sys.version_info >= (3, 4): def __init__(self, indent: int = ..., width: int = ..., depth: Optional[int] = ..., - stream: Optional[IO[str]] = ..., compact: bool = ...) -> None: ... + stream: Optional[IO[str]] = ..., *, compact: bool = ...) -> None: ... else: def __init__(self, indent: int = ..., width: int = ..., depth: Optional[int] = ..., stream: Optional[IO[str]] = ...) -> None: ...