mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-26 05:41:11 +08:00
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.
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
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
|
||||
|
||||
@@ -9,6 +8,7 @@ _Selector = Union[str, float, int]
|
||||
_T = TypeVar("_T", bound=Stats)
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
from enum import Enum
|
||||
class SortKey(str, Enum):
|
||||
CALLS: str
|
||||
CUMULATIVE: str
|
||||
|
||||
Reference in New Issue
Block a user