| 1 | import sys |
| 2 | from _typeshed import SupportsWrite |
| 3 | from collections import deque |
| 4 | from typing import IO |
| 5 | |
| 6 | __all__ = ["pprint", "pformat", "isreadable", "isrecursive", "saferepr", "PrettyPrinter", "pp"] |
| 7 | |
| 8 | if sys.version_info >= (3, 10): |
| 9 | def pformat( |
| 10 | object: object, |
| 11 | indent: int = 1, |
| 12 | width: int = 80, |
| 13 | depth: int | None = None, |
| 14 | *, |
| 15 | compact: bool = False, |
| 16 | sort_dicts: bool = True, |
| 17 | underscore_numbers: bool = False, |
| 18 | ) -> str: ... |
| 19 | |
| 20 | else: |
| 21 | def pformat( |
| 22 | object: object, |
| 23 | indent: int = 1, |
| 24 | width: int = 80, |
| 25 | depth: int | None = None, |
| 26 | *, |
| 27 | compact: bool = False, |
| 28 | sort_dicts: bool = True, |
| 29 | ) -> str: ... |
| 30 | |
| 31 | if sys.version_info >= (3, 10): |
| 32 | def pp( |
| 33 | object: object, |
| 34 | stream: IO[str] | None = None, |
| 35 | indent: int = 1, |
| 36 | width: int = 80, |
| 37 | depth: int | None = None, |
| 38 | *, |
| 39 | compact: bool = False, |
| 40 | sort_dicts: bool = False, |
| 41 | underscore_numbers: bool = False, |
| 42 | ) -> None: ... |
| 43 | |
| 44 | else: |
| 45 | def pp( |
| 46 | object: object, |
| 47 | stream: IO[str] | None = None, |
| 48 | indent: int = 1, |
| 49 | width: int = 80, |
| 50 | depth: int | None = None, |
| 51 | *, |
| 52 | compact: bool = False, |
| 53 | sort_dicts: bool = False, |
| 54 | ) -> None: ... |
| 55 | |
| 56 | if sys.version_info >= (3, 10): |
| 57 | def pprint( |
| 58 | object: object, |
| 59 | stream: IO[str] | None = None, |
| 60 | indent: int = 1, |
| 61 | width: int = 80, |
| 62 | depth: int | None = None, |
| 63 | *, |
| 64 | compact: bool = False, |
| 65 | sort_dicts: bool = True, |
| 66 | underscore_numbers: bool = False, |
| 67 | ) -> None: ... |
| 68 | |
| 69 | else: |
| 70 | def pprint( |
| 71 | object: object, |
| 72 | stream: IO[str] | None = None, |
| 73 | indent: int = 1, |
| 74 | width: int = 80, |
| 75 | depth: int | None = None, |
| 76 | *, |
| 77 | compact: bool = False, |
| 78 | sort_dicts: bool = True, |
| 79 | ) -> None: ... |
| 80 | |
| 81 | def isreadable(object: object) -> bool: ... |
| 82 | def isrecursive(object: object) -> bool: ... |
| 83 | def saferepr(object: object) -> str: ... |
| 84 | |
| 85 | class PrettyPrinter: |
| 86 | if sys.version_info >= (3, 10): |
| 87 | def __init__( |
| 88 | self, |
| 89 | indent: int = 1, |
| 90 | width: int = 80, |
| 91 | depth: int | None = None, |
| 92 | stream: IO[str] | None = None, |
| 93 | *, |
| 94 | compact: bool = False, |
| 95 | sort_dicts: bool = True, |
| 96 | underscore_numbers: bool = False, |
| 97 | ) -> None: ... |
| 98 | else: |
| 99 | def __init__( |
| 100 | self, |
| 101 | indent: int = 1, |
| 102 | width: int = 80, |
| 103 | depth: int | None = None, |
| 104 | stream: IO[str] | None = None, |
| 105 | *, |
| 106 | compact: bool = False, |
| 107 | sort_dicts: bool = True, |
| 108 | ) -> None: ... |
| 109 | |
| 110 | def pformat(self, object: object) -> str: ... |
| 111 | def pprint(self, object: object) -> None: ... |
| 112 | def isreadable(self, object: object) -> bool: ... |
| 113 | def isrecursive(self, object: object) -> bool: ... |
| 114 | def format(self, object: object, context: dict[int, int], maxlevels: int, level: int) -> tuple[str, bool, bool]: ... |
| 115 | def _format( |
| 116 | self, object: object, stream: SupportsWrite[str], indent: int, allowance: int, context: dict[int, int], level: int |
| 117 | ) -> None: ... |
| 118 | def _pprint_dict( |
| 119 | self, |
| 120 | object: dict[object, object], |
| 121 | stream: SupportsWrite[str], |
| 122 | indent: int, |
| 123 | allowance: int, |
| 124 | context: dict[int, int], |
| 125 | level: int, |
| 126 | ) -> None: ... |
| 127 | def _pprint_list( |
| 128 | self, object: list[object], stream: SupportsWrite[str], indent: int, allowance: int, context: dict[int, int], level: int |
| 129 | ) -> None: ... |
| 130 | def _pprint_tuple( |
| 131 | self, |
| 132 | object: tuple[object, ...], |
| 133 | stream: SupportsWrite[str], |
| 134 | indent: int, |
| 135 | allowance: int, |
| 136 | context: dict[int, int], |
| 137 | level: int, |
| 138 | ) -> None: ... |
| 139 | def _pprint_set( |
| 140 | self, object: set[object], stream: SupportsWrite[str], indent: int, allowance: int, context: dict[int, int], level: int |
| 141 | ) -> None: ... |
| 142 | def _pprint_deque( |
| 143 | self, object: deque[object], stream: SupportsWrite[str], indent: int, allowance: int, context: dict[int, int], level: int |
| 144 | ) -> None: ... |
| 145 | def _format_dict_items( |
| 146 | self, |
| 147 | items: list[tuple[object, object]], |
| 148 | stream: SupportsWrite[str], |
| 149 | indent: int, |
| 150 | allowance: int, |
| 151 | context: dict[int, int], |
| 152 | level: int, |
| 153 | ) -> None: ... |
| 154 | def _format_items( |
| 155 | self, items: list[object], stream: SupportsWrite[str], indent: int, allowance: int, context: dict[int, int], level: int |
| 156 | ) -> None: ... |
| 157 | def _repr(self, object: object, context: dict[int, int], level: int) -> str: ... |
| 158 | if sys.version_info >= (3, 10): |
| 159 | def _safe_repr(self, object: object, context: dict[int, int], maxlevels: int, level: int) -> tuple[str, bool, bool]: ... |