mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-17 08:35:03 +08:00
Add complete annotations to builtins.compile. (#2606)
This commit is contained in:
committed by
Sebastian Rittau
parent
45d4e88175
commit
7685462672
@@ -9,9 +9,10 @@ from typing import (
|
||||
Sequence, Mapping, Tuple, List, Any, Dict, Callable, Generic, Set,
|
||||
AbstractSet, FrozenSet, Sized, Reversible, SupportsInt, SupportsFloat, SupportsAbs,
|
||||
SupportsComplex, SupportsRound, IO, BinaryIO, Union, AnyStr, MutableSequence, MutableMapping,
|
||||
MutableSet, ItemsView, KeysView, ValuesView, Optional, Container, Type
|
||||
MutableSet, ItemsView, KeysView, ValuesView, Optional, Container, Type, Text
|
||||
)
|
||||
from abc import ABCMeta
|
||||
from ast import mod
|
||||
|
||||
_T = TypeVar('_T')
|
||||
_T_co = TypeVar('_T_co', covariant=True)
|
||||
@@ -745,7 +746,8 @@ def any(i: Iterable[object]) -> bool: ...
|
||||
def bin(number: int) -> str: ...
|
||||
def callable(o: object) -> bool: ...
|
||||
def chr(code: int) -> str: ...
|
||||
def compile(source: Any, filename: unicode, mode: str, flags: int = ...,
|
||||
def compile(source: Union[Text, mod], filename: Text,
|
||||
mode: Text, flags: int = ...,
|
||||
dont_inherit: int = ...) -> Any: ...
|
||||
def delattr(o: Any, name: unicode) -> None: ...
|
||||
def dir(o: object = ...) -> List[str]: ...
|
||||
|
||||
@@ -9,9 +9,10 @@ from typing import (
|
||||
Sequence, Mapping, Tuple, List, Any, Dict, Callable, Generic, Set,
|
||||
AbstractSet, FrozenSet, Sized, Reversible, SupportsInt, SupportsFloat, SupportsAbs,
|
||||
SupportsComplex, SupportsRound, IO, BinaryIO, Union, AnyStr, MutableSequence, MutableMapping,
|
||||
MutableSet, ItemsView, KeysView, ValuesView, Optional, Container, Type
|
||||
MutableSet, ItemsView, KeysView, ValuesView, Optional, Container, Type, Text
|
||||
)
|
||||
from abc import ABCMeta
|
||||
from ast import mod
|
||||
|
||||
_T = TypeVar('_T')
|
||||
_T_co = TypeVar('_T_co', covariant=True)
|
||||
@@ -745,7 +746,8 @@ def any(i: Iterable[object]) -> bool: ...
|
||||
def bin(number: int) -> str: ...
|
||||
def callable(o: object) -> bool: ...
|
||||
def chr(code: int) -> str: ...
|
||||
def compile(source: Any, filename: unicode, mode: str, flags: int = ...,
|
||||
def compile(source: Union[Text, mod], filename: Text,
|
||||
mode: Text, flags: int = ...,
|
||||
dont_inherit: int = ...) -> Any: ...
|
||||
def delattr(o: Any, name: unicode) -> None: ...
|
||||
def dir(o: object = ...) -> List[str]: ...
|
||||
|
||||
@@ -9,6 +9,7 @@ from typing import (
|
||||
)
|
||||
from abc import abstractmethod, ABCMeta
|
||||
from types import TracebackType, CodeType
|
||||
from ast import mod
|
||||
import sys
|
||||
|
||||
# Note that names imported above are not automatically made visible via the
|
||||
@@ -802,9 +803,9 @@ if sys.version_info >= (3, 6):
|
||||
# See https://github.com/python/typeshed/pull/991#issuecomment-288160993
|
||||
class _PathLike(Generic[AnyStr]):
|
||||
def __fspath__(self) -> AnyStr: ...
|
||||
def compile(source: Any, filename: Union[str, bytes, _PathLike], mode: str, flags: int = ..., dont_inherit: int = ..., optimize: int = ...) -> CodeType: ...
|
||||
def compile(source: Union[str, bytes, mod], filename: Union[str, bytes, _PathLike], mode: str, flags: int = ..., dont_inherit: int = ..., optimize: int = ...) -> Any: ...
|
||||
else:
|
||||
def compile(source: Any, filename: Union[str, bytes], mode: str, flags: int = ..., dont_inherit: int = ..., optimize: int = ...) -> CodeType: ...
|
||||
def compile(source: Union[str, bytes, mod], filename: Union[str, bytes], mode: str, flags: int = ..., dont_inherit: int = ..., optimize: int = ...) -> Any: ...
|
||||
def copyright() -> None: ...
|
||||
def credits() -> None: ...
|
||||
def delattr(o: Any, name: str) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user