Skip to content

Commit 1965e9d

Browse files
gvanrossumJelleZijlstra
authored andcommitted
Add stub for toml (#2355)
See uiri/toml#178
1 parent 4ca0a63 commit 1965e9d

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

third_party/2and3/toml.pyi

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
from typing import Any, IO, List, Mapping, MutableMapping, Optional, Protocol, Text, Type, Union
2+
import datetime
3+
import sys
4+
5+
if sys.version_info >= (3, 4):
6+
import pathlib
7+
if sys.version_info >= (3, 6):
8+
import os
9+
_PathLike = Union[Text, pathlib.PurePath, os.PathLike]
10+
else:
11+
_PathLike = Union[Text, pathlib.PurePath]
12+
else:
13+
_PathLike = Text
14+
15+
class _Writable(Protocol):
16+
def write(self, obj: str) -> Any: ...
17+
18+
class TomlDecodeError(Exception): ...
19+
20+
def load(f: Union[_PathLike, List[Text], IO[str]], _dict: Type[MutableMapping[str, Any]] = ...) -> MutableMapping[str, Any]: ...
21+
def loads(s: Text, _dict: Type[MutableMapping[str, Any]] = ...) -> MutableMapping[str, Any]: ...
22+
23+
def dump(o: Mapping[str, Any], f: _Writable) -> str: ...
24+
def dumps(o: Mapping[str, Any]) -> str: ...

0 commit comments

Comments
 (0)