Make Python 2's inspect more tolerant of unicode (#3847)

This commit is contained in:
Jan Verbeek
2020-03-14 04:48:42 +01:00
committed by GitHub
parent 01d4a4c395
commit 6f159d9fc6

View File

@@ -1,5 +1,5 @@
from types import CodeType, TracebackType, FrameType, FunctionType, MethodType, ModuleType
from typing import Any, Dict, Callable, List, NamedTuple, Optional, Sequence, Tuple, Type, Union
from typing import Any, Dict, Callable, List, NamedTuple, Optional, Sequence, Tuple, Type, Union, AnyStr
# Types and members
class EndOfBlock(Exception): ...
@@ -10,8 +10,8 @@ class BlockFinder:
started: bool
passline: bool
last: int
def tokeneater(self, type: int, token: str, srow_scol: Tuple[int, int],
erow_ecol: Tuple[int, int], line: str) -> None: ...
def tokeneater(self, type: int, token: AnyStr, srow_scol: Tuple[int, int],
erow_ecol: Tuple[int, int], line: AnyStr) -> None: ...
CO_GENERATOR: int
CO_NESTED: int
@@ -32,8 +32,8 @@ def getmembers(
object: object,
predicate: Optional[Callable[[Any], bool]] = ...
) -> List[Tuple[str, Any]]: ...
def getmoduleinfo(path: str) -> Optional[ModuleInfo]: ...
def getmodulename(path: str) -> Optional[str]: ...
def getmoduleinfo(path: Union[str, unicode]) -> Optional[ModuleInfo]: ...
def getmodulename(path: AnyStr) -> Optional[AnyStr]: ...
def ismodule(object: object) -> bool: ...
def isclass(object: object) -> bool: ...
@@ -57,7 +57,7 @@ _SourceObjectType = Union[ModuleType, Type[Any], MethodType, FunctionType, Trace
def findsource(object: _SourceObjectType) -> Tuple[List[str], int]: ...
def getabsfile(object: _SourceObjectType) -> str: ...
def getblock(lines: Sequence[str]) -> Sequence[str]: ...
def getblock(lines: Sequence[AnyStr]) -> Sequence[AnyStr]: ...
def getdoc(object: object) -> Optional[str]: ...
def getcomments(object: object) -> Optional[str]: ...
def getfile(object: _SourceObjectType) -> str: ...
@@ -65,8 +65,8 @@ def getmodule(object: object) -> Optional[ModuleType]: ...
def getsourcefile(object: _SourceObjectType) -> Optional[str]: ...
def getsourcelines(object: _SourceObjectType) -> Tuple[List[str], int]: ...
def getsource(object: _SourceObjectType) -> str: ...
def cleandoc(doc: str) -> str: ...
def indentsize(line: str) -> int: ...
def cleandoc(doc: AnyStr) -> AnyStr: ...
def indentsize(line: Union[str, unicode]) -> int: ...
# Classes and functions
def getclasstree(classes: List[type], unique: bool = ...) -> List[Union[Tuple[type, Tuple[type, ...]], List[Any]]]: ...