mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-08 04:54:48 +08:00
fix classonlymethod, replace with six from typeshed
This commit is contained in:
@@ -1,18 +1,10 @@
|
||||
from typing import Any, Callable, Optional, Set, Tuple, Type, Union
|
||||
|
||||
from django.contrib.auth.mixins import AccessMixin
|
||||
from django.contrib.messages.views import SuccessMessageMixin
|
||||
from django.middleware.cache import CacheMiddleware
|
||||
from django.test.testcases import LiveServerTestCase
|
||||
from django.utils.deprecation import MiddlewareMixin
|
||||
from django.views.generic.base import TemplateResponseMixin, View
|
||||
|
||||
class classonlymethod(classmethod):
|
||||
def __get__(
|
||||
self,
|
||||
instance: Optional[View],
|
||||
cls: Type[Union[AccessMixin, SuccessMessageMixin, TemplateResponseMixin, View]] = ...,
|
||||
) -> Callable: ...
|
||||
class classonlymethod(classmethod): ...
|
||||
|
||||
def method_decorator(
|
||||
decorator: Union[Callable, Set[Callable], Tuple[Callable, Callable]], name: str = ...
|
||||
|
||||
@@ -1,144 +1,106 @@
|
||||
import types
|
||||
from typing import Any, Optional
|
||||
from __future__ import print_function
|
||||
|
||||
PY2: Any
|
||||
PY3: Any
|
||||
PY34: Any
|
||||
string_types: Any
|
||||
integer_types: Any
|
||||
class_types: Any
|
||||
import types
|
||||
import typing
|
||||
import unittest
|
||||
from typing import (
|
||||
Any,
|
||||
AnyStr,
|
||||
Callable,
|
||||
Dict,
|
||||
ItemsView,
|
||||
Iterable,
|
||||
KeysView,
|
||||
Mapping,
|
||||
NoReturn,
|
||||
Optional,
|
||||
Pattern,
|
||||
Text,
|
||||
Tuple,
|
||||
Type,
|
||||
TypeVar,
|
||||
Union,
|
||||
ValuesView,
|
||||
overload,
|
||||
)
|
||||
|
||||
# Exports
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_K = TypeVar("_K")
|
||||
_V = TypeVar("_V")
|
||||
|
||||
# TODO make constant, then move this stub to 2and3
|
||||
# https://github.com/python/typeshed/issues/17
|
||||
PY2 = False
|
||||
PY3 = True
|
||||
PY34 = ... # type: bool
|
||||
|
||||
string_types = (str,)
|
||||
integer_types = (int,)
|
||||
class_types = (type,)
|
||||
text_type = str
|
||||
binary_type = bytes
|
||||
MAXSIZE: Any
|
||||
text_type = unicode
|
||||
binary_type = str
|
||||
|
||||
class X:
|
||||
def __len__(self): ...
|
||||
MAXSIZE = ... # type: int
|
||||
|
||||
class _LazyDescr:
|
||||
name: Any = ...
|
||||
def __init__(self, name: Any) -> None: ...
|
||||
def __get__(self, obj: Any, tp: Any): ...
|
||||
# def add_move
|
||||
# def remove_move
|
||||
|
||||
class MovedModule(_LazyDescr):
|
||||
mod: Any = ...
|
||||
def __init__(self, name: Any, old: Any, new: Optional[Any] = ...) -> None: ...
|
||||
def __getattr__(self, attr: Any): ...
|
||||
|
||||
class _LazyModule(types.ModuleType):
|
||||
__doc__: Any = ...
|
||||
def __init__(self, name: Any) -> None: ...
|
||||
def __dir__(self): ...
|
||||
|
||||
class MovedAttribute(_LazyDescr):
|
||||
mod: Any = ...
|
||||
attr: Any = ...
|
||||
def __init__(
|
||||
self, name: Any, old_mod: Any, new_mod: Any, old_attr: Optional[Any] = ..., new_attr: Optional[Any] = ...
|
||||
) -> None: ...
|
||||
|
||||
class _SixMetaPathImporter:
|
||||
name: Any = ...
|
||||
known_modules: Any = ...
|
||||
def __init__(self, six_module_name: Any) -> None: ...
|
||||
def find_module(self, fullname: Any, path: Optional[Any] = ...): ...
|
||||
def load_module(self, fullname: Any): ...
|
||||
def is_package(self, fullname: Any): ...
|
||||
def get_code(self, fullname: Any): ...
|
||||
get_source: Any = ...
|
||||
|
||||
class _MovedItems(_LazyModule):
|
||||
__path__: Any = ...
|
||||
|
||||
moves: Any
|
||||
|
||||
class Module_six_moves_urllib_parse(_LazyModule): ...
|
||||
class Module_six_moves_urllib_error(_LazyModule): ...
|
||||
class Module_six_moves_urllib_request(_LazyModule): ...
|
||||
class Module_six_moves_urllib_response(_LazyModule): ...
|
||||
class Module_six_moves_urllib_robotparser(_LazyModule): ...
|
||||
|
||||
class Module_six_moves_urllib(types.ModuleType):
|
||||
__path__: Any = ...
|
||||
parse: Any = ...
|
||||
error: Any = ...
|
||||
request: Any = ...
|
||||
response: Any = ...
|
||||
robotparser: Any = ...
|
||||
def __dir__(self): ...
|
||||
|
||||
def add_move(move: Any) -> None: ...
|
||||
def remove_move(name: Any) -> None: ...
|
||||
|
||||
advance_iterator = next
|
||||
next = advance_iterator
|
||||
callable = callable
|
||||
|
||||
def get_unbound_function(unbound: Any): ...
|
||||
|
||||
create_bound_method: Any
|
||||
|
||||
def create_unbound_method(func: Any, cls: Any): ...
|
||||
def callable(obj: object) -> bool: ...
|
||||
def get_unbound_function(unbound: types.FunctionType) -> types.FunctionType: ...
|
||||
def create_bound_method(func: types.FunctionType, obj: object) -> types.MethodType: ...
|
||||
def create_unbound_method(func: types.FunctionType, cls: type) -> types.FunctionType: ...
|
||||
|
||||
Iterator = object
|
||||
|
||||
class Iterator:
|
||||
def next(self): ...
|
||||
def get_method_function(meth: types.MethodType) -> types.FunctionType: ...
|
||||
def get_method_self(meth: types.MethodType) -> Optional[object]: ...
|
||||
def get_function_closure(fun: types.FunctionType) -> Optional[Tuple[types._Cell, ...]]: ...
|
||||
def get_function_code(fun: types.FunctionType) -> types.CodeType: ...
|
||||
def get_function_defaults(fun: types.FunctionType) -> Optional[Tuple[Any, ...]]: ...
|
||||
def get_function_globals(fun: types.FunctionType) -> Dict[str, Any]: ...
|
||||
def iterkeys(d: Mapping[_K, _V]) -> typing.Iterator[_K]: ...
|
||||
def itervalues(d: Mapping[_K, _V]) -> typing.Iterator[_V]: ...
|
||||
def iteritems(d: Mapping[_K, _V]) -> typing.Iterator[Tuple[_K, _V]]: ...
|
||||
|
||||
callable = callable
|
||||
get_method_function: Any
|
||||
get_method_self: Any
|
||||
get_function_closure: Any
|
||||
get_function_code: Any
|
||||
get_function_defaults: Any
|
||||
get_function_globals: Any
|
||||
# def iterlists
|
||||
|
||||
def iterkeys(d: Any, **kw: Any): ...
|
||||
def itervalues(d: Any, **kw: Any): ...
|
||||
def iteritems(d: Any, **kw: Any): ...
|
||||
def iterlists(d: Any, **kw: Any): ...
|
||||
|
||||
viewkeys: Any
|
||||
viewvalues: Any
|
||||
viewitems: Any
|
||||
|
||||
def b(s: Any): ...
|
||||
def u(s: Any): ...
|
||||
def viewkeys(d: Mapping[_K, _V]) -> KeysView[_K]: ...
|
||||
def viewvalues(d: Mapping[_K, _V]) -> ValuesView[_V]: ...
|
||||
def viewitems(d: Mapping[_K, _V]) -> ItemsView[_K, _V]: ...
|
||||
def b(s: str) -> binary_type: ...
|
||||
def u(s: str) -> text_type: ...
|
||||
|
||||
unichr = chr
|
||||
int2byte: Any
|
||||
byte2int: Any
|
||||
indexbytes: Any
|
||||
iterbytes = iter
|
||||
StringIO: Any
|
||||
BytesIO: Any
|
||||
unichr = unichr
|
||||
int2byte = chr
|
||||
|
||||
def assertCountEqual(self, *args: Any, **kwargs: Any): ...
|
||||
def assertRaisesRegex(self, *args: Any, **kwargs: Any): ...
|
||||
def assertRegex(self, *args: Any, **kwargs: Any): ...
|
||||
def int2byte(i: int) -> bytes: ...
|
||||
def byte2int(bs: binary_type) -> int: ...
|
||||
def indexbytes(buf: binary_type, i: int) -> int: ...
|
||||
def iterbytes(buf: binary_type) -> typing.Iterator[int]: ...
|
||||
def assertCountEqual(
|
||||
self: unittest.TestCase, first: Iterable[_T], second: Iterable[_T], msg: Optional[str] = ...
|
||||
) -> None: ...
|
||||
@overload
|
||||
def assertRaisesRegex(self: unittest.TestCase, msg: Optional[str] = ...) -> Any: ...
|
||||
@overload
|
||||
def assertRaisesRegex(self: unittest.TestCase, callable_obj: Callable[..., Any], *args: Any, **kwargs: Any) -> Any: ...
|
||||
def assertRegex(
|
||||
self: unittest.TestCase, text: AnyStr, expected_regex: Union[AnyStr, Pattern[AnyStr]], msg: Optional[str] = ...
|
||||
) -> None: ...
|
||||
|
||||
exec_: Any
|
||||
exec_ = exec
|
||||
|
||||
def reraise(tp: Any, value: Any, tb: Optional[Any] = ...) -> None: ...
|
||||
def raise_from(value: Any, from_value: Any) -> None: ...
|
||||
def reraise(
|
||||
tp: Optional[Type[BaseException]], value: Optional[BaseException], tb: Optional[types.TracebackType] = ...
|
||||
) -> NoReturn: ...
|
||||
def raise_from(value: Union[BaseException, Type[BaseException]], from_value: Optional[BaseException]) -> NoReturn: ...
|
||||
|
||||
print_: Any
|
||||
_print = print_
|
||||
print_ = print
|
||||
|
||||
def wraps(wrapped: Any, assigned: Any = ..., updated: Any = ...): ...
|
||||
|
||||
wraps: Any
|
||||
|
||||
def with_metaclass(meta: Any, *bases: Any): ...
|
||||
def add_metaclass(metaclass: Any): ...
|
||||
def python_2_unicode_compatible(klass: Any): ...
|
||||
|
||||
__path__: Any
|
||||
__package__ = __name__
|
||||
memoryview = memoryview
|
||||
buffer_types: Any
|
||||
memoryview = memoryview
|
||||
memoryview = buffer
|
||||
def with_metaclass(meta: type, *bases: type) -> type: ...
|
||||
def add_metaclass(metaclass: type) -> Callable[[_T], _T]: ...
|
||||
def ensure_binary(s: Union[bytes, Text], encoding: str = ..., errors: str = ...) -> bytes: ...
|
||||
def ensure_str(s: Union[bytes, Text], encoding: str = ..., errors: str = ...) -> str: ...
|
||||
def ensure_text(s: Union[bytes, Text], encoding: str = ..., errors: str = ...) -> Text: ...
|
||||
def python_2_unicode_compatible(klass: _T) -> _T: ...
|
||||
|
||||
Reference in New Issue
Block a user