mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-06 20:24:30 +08:00
Make Python 2's inspect more tolerant of unicode (#3847)
This commit is contained in:
@@ -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]]]: ...
|
||||
|
||||
Reference in New Issue
Block a user