From 226f0553fe3df7682b8f808e6b10d392c8b2e553 Mon Sep 17 00:00:00 2001 From: Sushain Cherivirala Date: Thu, 24 May 2018 23:10:17 -0500 Subject: [PATCH] Add compact keyword arg to pprint (#2162) --- stdlib/2and3/pprint.pyi | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/stdlib/2and3/pprint.pyi b/stdlib/2and3/pprint.pyi index 35da3a3e9..90a87ab0f 100644 --- a/stdlib/2and3/pprint.pyi +++ b/stdlib/2and3/pprint.pyi @@ -3,19 +3,35 @@ # Based on http://docs.python.org/2/library/pprint.html # Based on http://docs.python.org/3/library/pprint.html +import sys from typing import Any, Dict, Tuple, IO -def pformat(o: object, indent: int = ..., width: int = ..., - depth: int = ...) -> str: ... -def pprint(o: object, stream: IO[str] = ..., indent: int = ..., width: int = ..., - depth: int = ...) -> None: ... +if sys.version_info >= (3, 4): + def pformat(o: object, indent: int = ..., width: int = ..., + depth: int = ..., compact: bool = ...) -> str: ... +else: + def pformat(o: object, indent: int = ..., width: int = ..., + depth: int = ...) -> str: ... + +if sys.version_info >= (3, 4): + def pprint(o: object, stream: IO[str] = ..., indent: int = ..., width: int = ..., + depth: int = ..., compact: bool = ...) -> None: ... +else: + def pprint(o: object, stream: IO[str] = ..., indent: int = ..., width: int = ..., + depth: int = ...) -> None: ... + def isreadable(o: object) -> bool: ... def isrecursive(o: object) -> bool: ... def saferepr(o: object) -> str: ... class PrettyPrinter: - def __init__(self, indent: int = ..., width: int = ..., depth: int = ..., - stream: IO[str] = ...) -> None: ... + if sys.version_info >= (3, 4): + def __init__(self, indent: int = ..., width: int = ..., depth: int = ..., + stream: IO[str] = ..., compact: bool = ...) -> None: ... + else: + def __init__(self, indent: int = ..., width: int = ..., depth: int = ..., + stream: IO[str] = ...) -> None: ... + def pformat(self, o: object) -> str: ... def pprint(self, o: object) -> None: ... def isreadable(self, o: object) -> bool: ...