mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 21:14:48 +08:00
Switch to PEP-604 syntax in python2 stubs (#5915)
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
This commit is contained in:
@@ -29,9 +29,9 @@ class ModuleInfo(NamedTuple):
|
||||
mode: str
|
||||
module_type: int
|
||||
|
||||
def getmembers(object: object, predicate: Optional[Callable[[Any], bool]] = ...) -> List[Tuple[str, Any]]: ...
|
||||
def getmoduleinfo(path: Union[str, unicode]) -> Optional[ModuleInfo]: ...
|
||||
def getmodulename(path: AnyStr) -> Optional[AnyStr]: ...
|
||||
def getmembers(object: object, predicate: Callable[[Any], bool] | None = ...) -> List[Tuple[str, Any]]: ...
|
||||
def getmoduleinfo(path: str | unicode) -> ModuleInfo | None: ...
|
||||
def getmodulename(path: AnyStr) -> AnyStr | None: ...
|
||||
def ismodule(object: object) -> bool: ...
|
||||
def isclass(object: object) -> bool: ...
|
||||
def ismethod(object: object) -> bool: ...
|
||||
@@ -55,35 +55,35 @@ _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[AnyStr]) -> Sequence[AnyStr]: ...
|
||||
def getdoc(object: object) -> Optional[str]: ...
|
||||
def getcomments(object: object) -> Optional[str]: ...
|
||||
def getdoc(object: object) -> str | None: ...
|
||||
def getcomments(object: object) -> str | None: ...
|
||||
def getfile(object: _SourceObjectType) -> str: ...
|
||||
def getmodule(object: object) -> Optional[ModuleType]: ...
|
||||
def getsourcefile(object: _SourceObjectType) -> Optional[str]: ...
|
||||
def getmodule(object: object) -> ModuleType | None: ...
|
||||
def getsourcefile(object: _SourceObjectType) -> str | None: ...
|
||||
def getsourcelines(object: _SourceObjectType) -> Tuple[List[str], int]: ...
|
||||
def getsource(object: _SourceObjectType) -> str: ...
|
||||
def cleandoc(doc: AnyStr) -> AnyStr: ...
|
||||
def indentsize(line: Union[str, unicode]) -> int: ...
|
||||
def indentsize(line: str | unicode) -> int: ...
|
||||
|
||||
# Classes and functions
|
||||
def getclasstree(classes: List[type], unique: bool = ...) -> List[Union[Tuple[type, Tuple[type, ...]], List[Any]]]: ...
|
||||
def getclasstree(classes: List[type], unique: bool = ...) -> List[Tuple[type, Tuple[type, ...]] | List[Any]]: ...
|
||||
|
||||
class ArgSpec(NamedTuple):
|
||||
args: List[str]
|
||||
varargs: Optional[str]
|
||||
keywords: Optional[str]
|
||||
varargs: str | None
|
||||
keywords: str | None
|
||||
defaults: Tuple[Any, ...]
|
||||
|
||||
class ArgInfo(NamedTuple):
|
||||
args: List[str]
|
||||
varargs: Optional[str]
|
||||
keywords: Optional[str]
|
||||
varargs: str | None
|
||||
keywords: str | None
|
||||
locals: Dict[str, Any]
|
||||
|
||||
class Arguments(NamedTuple):
|
||||
args: List[Union[str, List[Any]]]
|
||||
varargs: Optional[str]
|
||||
keywords: Optional[str]
|
||||
args: List[str | List[Any]]
|
||||
varargs: str | None
|
||||
keywords: str | None
|
||||
|
||||
def getargs(co: CodeType) -> Arguments: ...
|
||||
def getargspec(func: object) -> ArgSpec: ...
|
||||
@@ -103,13 +103,13 @@ class Traceback(NamedTuple):
|
||||
filename: str
|
||||
lineno: int
|
||||
function: str
|
||||
code_context: Optional[List[str]]
|
||||
index: Optional[int] # type: ignore
|
||||
code_context: List[str] | None
|
||||
index: int | None # type: ignore
|
||||
|
||||
_FrameInfo = Tuple[FrameType, str, int, str, Optional[List[str]], Optional[int]]
|
||||
|
||||
def getouterframes(frame: FrameType, context: int = ...) -> List[_FrameInfo]: ...
|
||||
def getframeinfo(frame: Union[FrameType, TracebackType], context: int = ...) -> Traceback: ...
|
||||
def getframeinfo(frame: FrameType | TracebackType, context: int = ...) -> Traceback: ...
|
||||
def getinnerframes(traceback: TracebackType, context: int = ...) -> List[_FrameInfo]: ...
|
||||
def getlineno(frame: FrameType) -> int: ...
|
||||
def currentframe(depth: int = ...) -> FrameType: ...
|
||||
|
||||
Reference in New Issue
Block a user