Skip to content

Commit fff7a10

Browse files
authored
Add a version guard for importing enum in pstats. (#4635)
* Add a version guard for importing enum. I'm trying to pull the latest version of typeshed into Google, and pytype chokes on pstats in Python 2 because the enum module was introduced in 3.4. * Move the enum import into the branch that defines SortKey.
1 parent 35f4ade commit fff7a10

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

stdlib/2and3/pstats.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import sys
22
from _typeshed import AnyPath
33
from cProfile import Profile as _cProfile
4-
from enum import Enum
54
from profile import Profile
65
from typing import IO, Any, Dict, Iterable, List, Optional, Text, Tuple, TypeVar, Union, overload
76

87
_Selector = Union[str, float, int]
98
_T = TypeVar("_T", bound=Stats)
109

1110
if sys.version_info >= (3, 7):
11+
from enum import Enum
1212
class SortKey(str, Enum):
1313
CALLS: str
1414
CUMULATIVE: str

0 commit comments

Comments
 (0)