Skip to content

Commit e5a276c

Browse files
authored
Add parser stubs (#3822)
1 parent 92d5308 commit e5a276c

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

stdlib/2and3/parser.pyi

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
from typing import Any, List, Sequence, Text, Tuple, Union
2+
from types import CodeType
3+
4+
import sys
5+
6+
if sys.version_info >= (3, 6):
7+
from builtins import _PathLike
8+
_Path = Union[str, bytes, _PathLike]
9+
else:
10+
_Path = Union[str, bytes]
11+
12+
def expr(source: Text) -> STType: ...
13+
def suite(source: Text) -> STType: ...
14+
def sequence2st(sequence: Sequence[Any]) -> STType: ...
15+
def tuple2st(sequence: Sequence[Any]) -> STType: ...
16+
def st2list(st: STType, line_info: bool = ..., col_info: bool = ...) -> List[Any]: ...
17+
def st2tuple(st: STType, line_info: bool = ..., col_info: bool = ...) -> Tuple[Any]: ...
18+
def compilest(st: STType, filename: _Path = ...) -> CodeType: ...
19+
def isexpr(st: STType) -> bool: ...
20+
def issuite(st: STType) -> bool: ...
21+
22+
class ParserError(Exception): ...
23+
24+
class STType:
25+
def compile(self, filename: _Path) -> CodeType: ...
26+
def isexpr(self) -> bool: ...
27+
def issuite(self) -> bool: ...
28+
def tolist(self, line_info: bool = ..., col_info: bool = ...) -> List[Any]: ...
29+
def totuple(self, line_info: bool = ..., col_info: bool = ...) -> Tuple[Any]: ...

0 commit comments

Comments
 (0)