mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-20 10:51:15 +08:00
typed-ast: fix get_docstring, allow buffer (#9019)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from _typeshed import ReadableBuffer
|
||||
from collections.abc import Iterator
|
||||
from typing import Any
|
||||
from typing_extensions import TypeAlias
|
||||
@@ -9,11 +10,11 @@ class NodeVisitor:
|
||||
class NodeTransformer(NodeVisitor):
|
||||
def generic_visit(self, node: AST) -> None: ...
|
||||
|
||||
def parse(source: str | bytes, filename: str | bytes = ..., mode: str = ...) -> AST: ...
|
||||
def parse(source: str | ReadableBuffer, filename: str | ReadableBuffer = ..., mode: str = ...) -> AST: ...
|
||||
def copy_location(new_node: AST, old_node: AST) -> AST: ...
|
||||
def dump(node: AST, annotate_fields: bool = ..., include_attributes: bool = ...) -> str: ...
|
||||
def fix_missing_locations(node: AST) -> AST: ...
|
||||
def get_docstring(node: AST, clean: bool = ...) -> bytes | None: ...
|
||||
def get_docstring(node: AST, clean: bool = ...) -> str | bytes | None: ...
|
||||
def increment_lineno(node: AST, n: int = ...) -> AST: ...
|
||||
def iter_child_nodes(node: AST) -> Iterator[AST]: ...
|
||||
def iter_fields(node: AST) -> Iterator[tuple[str, Any]]: ...
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from _typeshed import ReadableBuffer
|
||||
from collections.abc import Iterator
|
||||
from typing import Any
|
||||
from typing_extensions import TypeAlias
|
||||
@@ -9,7 +10,9 @@ class NodeVisitor:
|
||||
class NodeTransformer(NodeVisitor):
|
||||
def generic_visit(self, node: AST) -> None: ...
|
||||
|
||||
def parse(source: str | bytes, filename: str | bytes = ..., mode: str = ..., feature_version: int = ...) -> AST: ...
|
||||
def parse(
|
||||
source: str | ReadableBuffer, filename: str | ReadableBuffer = ..., mode: str = ..., feature_version: int = ...
|
||||
) -> AST: ...
|
||||
def copy_location(new_node: AST, old_node: AST) -> AST: ...
|
||||
def dump(node: AST, annotate_fields: bool = ..., include_attributes: bool = ...) -> str: ...
|
||||
def fix_missing_locations(node: AST) -> AST: ...
|
||||
|
||||
Reference in New Issue
Block a user