mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-05-06 21:43:59 +08:00
Support Module and other objects in ast.parse (#14837)
This commit is contained in:
@@ -1744,6 +1744,16 @@ if sys.version_info < (3, 14):
|
||||
_T = _TypeVar("_T", bound=AST)
|
||||
|
||||
if sys.version_info >= (3, 13):
|
||||
@overload
|
||||
def parse(
|
||||
source: _T,
|
||||
filename: str | ReadableBuffer | os.PathLike[Any] = "<unknown>",
|
||||
mode: Literal["exec", "eval", "func_type", "single"] = "exec",
|
||||
*,
|
||||
type_comments: bool = False,
|
||||
feature_version: None | int | tuple[int, int] = None,
|
||||
optimize: Literal[-1, 0, 1, 2] = -1,
|
||||
) -> _T: ...
|
||||
@overload
|
||||
def parse(
|
||||
source: str | ReadableBuffer,
|
||||
@@ -1823,6 +1833,15 @@ if sys.version_info >= (3, 13):
|
||||
) -> mod: ...
|
||||
|
||||
else:
|
||||
@overload
|
||||
def parse(
|
||||
source: _T,
|
||||
filename: str | ReadableBuffer | os.PathLike[Any] = "<unknown>",
|
||||
mode: Literal["exec", "eval", "func_type", "single"] = "exec",
|
||||
*,
|
||||
type_comments: bool = False,
|
||||
feature_version: None | int | tuple[int, int] = None,
|
||||
) -> _T: ...
|
||||
@overload
|
||||
def parse(
|
||||
source: str | ReadableBuffer,
|
||||
|
||||
Reference in New Issue
Block a user