From 1bc7689cbca1d19d664c7c947482490354696cc1 Mon Sep 17 00:00:00 2001 From: Adam Lichtl <5431291+adamlichtl@users.noreply.github.com> Date: Thu, 10 Sep 2020 22:34:43 -0700 Subject: [PATCH] Add type hints for pstats.SortKey available in Python >= 3.7 (#4523) --- stdlib/2and3/pstats.pyi | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/stdlib/2and3/pstats.pyi b/stdlib/2and3/pstats.pyi index ee5c0dd1c..68c937e27 100644 --- a/stdlib/2and3/pstats.pyi +++ b/stdlib/2and3/pstats.pyi @@ -1,11 +1,25 @@ +import sys from _typeshed import AnyPath from cProfile import Profile as _cProfile +from enum import Enum from profile import Profile from typing import IO, Any, Dict, Iterable, List, Optional, Text, Tuple, TypeVar, Union, overload _Selector = Union[str, float, int] _T = TypeVar("_T", bound=Stats) +if sys.version_info >= (3, 7): + class SortKey(str, Enum): + CALLS: str + CUMULATIVE: str + FILENAME: str + LINE: str + NAME: str + NFL: str + PCALLS: str + STDNAME: str + TIME: str + class Stats: sort_arg_dict_default: Dict[str, Tuple[Any, str]] def __init__(