-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add type hints for typechecked and no_type_check
- Loading branch information
Showing
3 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Generated using mypy stubgen, then editing to add types for some definitions. | ||
|
||
import __builtin__ as builtins | ||
from . import type_util, util | ||
from .exceptions import InputTypeError, OverrideError, ReturnTypeError | ||
from .type_util import TypeAgent, deep_type, get_orig_class, has_type_hints, is_Tuple, is_builtin_type, type_str | ||
from .util import getargspecs | ||
from types import ModuleType | ||
from typing import Any, Optional, Callable, TypeVar, Union | ||
from warnings import warn | ||
|
||
_python___import__ = builtins.__import__ | ||
|
||
# Placeholders typed as Any just declare they exist to avoid "no such attribute" | ||
# errors from attempts to reference names missing from pyi. | ||
# TODO: Fill in proper types. | ||
def _pytypes___import__(name: Any, globls: Optional[Any] = ..., locls: Optional[Any] = ..., fromlist: Any = ..., level: int = ...): ... | ||
|
||
class _DelayedCheck: | ||
func: Any = ... | ||
method: Any = ... | ||
class_name: Any = ... | ||
base_method: Any = ... | ||
base_class: Any = ... | ||
exc_info: Any = ... | ||
raising_module_name: Any = ... | ||
def __init__(self, func: Any, method: Any, class_name: Any, base_method: Any, base_class: Any, exc_info: Any) -> None: ... | ||
def run_check(self, raise_NameError: bool = ...) -> None: ... | ||
|
||
T_Callable = TypeVar('T_Callable', bound=Callable) | ||
def override(func: T_Callable, auto: bool = ...) -> T_Callable: ... | ||
def typechecked_func(func: T_Callable, force: bool = ..., argType: Optional[Any] = ..., resType: Optional[Any] = ..., prop_getter: bool = ...): ... | ||
def typechecked_class(cls, force: bool = ..., force_recursive: bool = ...): ... | ||
def typechecked_module(md: Any, force_recursive: bool = ...): ... | ||
|
||
T = TypeVar('T', Callable, property, type, str, ModuleType) | ||
def typechecked(memb: T) -> T: ... | ||
T_Class = TypeVar('T_Class', bound=type) | ||
def auto_override_class(cls: T_Class, force: bool = ..., force_recursive: bool = ...) -> T_Class: ... | ||
def auto_override_module(md: Any, force_recursive: bool = ...): ... | ||
def auto_override(memb: T) -> T: ... | ||
def no_type_check(memb: T) -> T: ... | ||
def is_no_type_check(memb: T) -> bool: ... | ||
def check_argument_types(cllable: Optional[Callable] = ..., call_args: Optional[Any] = ..., clss: Optional[type] = ..., caller_level: int = ...) -> Callable: ... | ||
def check_return_type(value: Any, cllable: Optional[Callable] = ..., clss: Optional[type] = ..., caller_level: int = ...) -> Callable: ... | ||
|
||
class TypeChecker(TypeAgent): | ||
def __init__(self, all_threads: bool = ...) -> None: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,6 @@ max-line-length = 99 | |
|
||
[wheel] | ||
universal = 1 | ||
|
||
[options.package_data] | ||
pytypes = py.typed, *.pyi |