Skip to content

Commit 97be335

Browse files
JelleZijlstramatthiaskramm
authored andcommitted
don't import enum in Python 2 (#1724)
* don't import enum in Python 2 Fixes a pytype issue from #1720. * move enums together
1 parent 9390a49 commit 97be335

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

stdlib/2and3/plistlib.pyi

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,15 @@ from typing import (
55
Type, TypeVar,
66
)
77
from typing import Dict as DictT
8-
from enum import Enum
98
import sys
9+
if sys.version_info >= (3,):
10+
from enum import Enum
11+
12+
class PlistFormat(Enum):
13+
FMT_XML = ... # type: PlistFormat
14+
FMT_BINARY = ... # type: PlistFormat
15+
FMT_XML = PlistFormat.FMT_XML
16+
FMT_BINARY = PlistFormat.FMT_BINARY
1017

1118
mm = MutableMapping[str, Any]
1219
_D = TypeVar('_D', bound=mm)
@@ -15,15 +22,9 @@ if sys.version_info >= (3,):
1522
else:
1623
_Path = Union[str, unicode]
1724

18-
19-
if sys.version_info >= (3,):
20-
class PlistFormat(Enum):
21-
FMT_XML = ... # type: PlistFormat
22-
FMT_BINARY = ... # type: PlistFormat
23-
2425
if sys.version_info >= (3, 4):
2526
def load(fp: IO[bytes], *, fmt: Optional[PlistFormat] = ...,
26-
use_builtin_types: bool, dict_type: Type[_D] =...) -> _D: ...
27+
use_builtin_types: bool, dict_type: Type[_D] = ...) -> _D: ...
2728
def loads(data: bytes, *, fmt: Optional[PlistFormat] = ...,
2829
use_builtin_types: bool = ..., dict_type: Type[_D] = ...) -> _D: ...
2930
def dump(value: Mapping[str, Any], fp: IO[bytes], *,
@@ -54,7 +55,3 @@ if sys.version_info >= (3,):
5455
class Data:
5556
data = ... # type: bytes
5657
def __init__(self, data: bytes) -> None: ...
57-
58-
if sys.version_info >= (3,):
59-
FMT_XML = PlistFormat.FMT_XML
60-
FMT_BINARY = PlistFormat.FMT_BINARY

0 commit comments

Comments
 (0)