File: type.pyi

package info (click to toggle)
mypy 1.19.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 22,412 kB
  • sloc: python: 114,754; ansic: 13,343; cpp: 11,380; makefile: 257; sh: 28
file content (35 lines) | stat: -rw-r--r-- 924 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# builtins stub used in type-related test cases.

from typing import Any, Generic, TypeVar, List, Union
import sys
import types

T = TypeVar("T")
S = TypeVar("S")

class object:
    def __init__(self) -> None: pass
    def __str__(self) -> 'str': pass

class list(Generic[T]): pass

class type:
    __name__: str
    def __call__(self, *args: Any, **kwargs: Any) -> Any: pass
    def __or__(self, other: Union[type, None]) -> type: pass
    def __ror__(self, other: Union[type, None]) -> type: pass
    def mro(self) -> List['type']: pass

class tuple(Generic[T]): pass
class dict(Generic[T, S]): pass
class function: pass
class bool: pass
class int: pass
class str: pass
class ellipsis: pass
class float: pass

if sys.version_info >= (3, 10):  # type: ignore
    def isinstance(obj: object, class_or_tuple: type | types.UnionType, /) -> bool: ...
else:
    def isinstance(obj: object, class_or_tuple: type, /) -> bool: ...