third iteration of stubs

This commit is contained in:
Maxim Kurnikov
2018-08-11 00:19:50 +03:00
parent fa718b8e55
commit c6bceb19f4
216 changed files with 16306 additions and 3006 deletions

View File

@@ -1,4 +1,3 @@
from collections import OrderedDict
from typing import Any, Callable, Dict, Optional, Union
from django.core.cache.backends.base import BaseCache as BaseCache
@@ -16,7 +15,7 @@ class CacheHandler:
class DefaultCacheProxy:
def __getattr__(
self, name: str
) -> Union[Callable, Dict[str, float], int, OrderedDict]: ...
) -> Union[Callable, Dict[str, float], int]: ...
def __setattr__(self, name: str, value: Callable) -> None: ...
def __delattr__(self, name: Any): ...
def __contains__(self, key: str) -> bool: ...

View File

@@ -1,4 +1,3 @@
from collections import OrderedDict
from typing import Any, Callable, Dict, List, Optional, Union
from django.core.exceptions import ImproperlyConfigured
@@ -11,7 +10,7 @@ DEFAULT_TIMEOUT: Any
MEMCACHE_MAX_KEY_LENGTH: int
def default_key_func(
key: Union[str, int], key_prefix: str, version: Union[str, int]
key: Union[int, str], key_prefix: str, version: Union[int, str]
) -> str: ...
def get_key_func(key_func: Optional[Union[Callable, str]]) -> Callable: ...
@@ -22,11 +21,17 @@ class BaseCache:
key_func: Callable = ...
def __init__(
self,
params: Dict[str, Optional[Union[Dict[str, int], Callable, str, int]]],
params: Union[
Dict[str, Callable],
Dict[str, Dict[str, int]],
Dict[str, None],
Dict[str, int],
Dict[str, str],
],
) -> None: ...
def get_backend_timeout(self, timeout: Any = ...) -> Optional[float]: ...
def make_key(
self, key: Union[str, int], version: Optional[Union[str, int]] = ...
self, key: Union[int, str], version: Optional[Union[int, str]] = ...
) -> str: ...
def add(
self,
@@ -54,14 +59,14 @@ class BaseCache:
def delete(self, key: Any, version: Optional[Any] = ...) -> None: ...
def get_many(
self, keys: List[str], version: Optional[int] = ...
) -> Dict[str, Union[str, int]]: ...
) -> Union[Dict[str, int], Dict[str, str]]: ...
def get_or_set(
self,
key: str,
default: Optional[Union[Callable, int, str]],
timeout: Any = ...,
version: Optional[int] = ...,
) -> Optional[Union[str, int]]: ...
) -> Optional[Union[int, str]]: ...
def has_key(self, key: Any, version: Optional[Any] = ...): ...
def incr(
self, key: str, delta: int = ..., version: Optional[int] = ...
@@ -73,13 +78,12 @@ class BaseCache:
def set_many(
self,
data: Union[
Dict[str, bytes],
Dict[str, Union[Dict[str, int], str]],
Dict[str, bytes],
Dict[str, int],
OrderedDict,
],
timeout: Any = ...,
version: Optional[Union[str, int]] = ...,
version: Optional[Union[int, str]] = ...,
) -> List[Any]: ...
def delete_many(
self, keys: Union[Dict[str, str], List[str]], version: None = ...

View File

@@ -1,6 +1,9 @@
from typing import Any, Callable, Dict, Optional, Union
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
from django.core.cache.backends.base import BaseCache
from django.db.models.base import Model
from django.db.models.query import QuerySet
from django.http.response import HttpResponse
class Options:
@@ -25,7 +28,12 @@ class BaseDatabaseCache(BaseCache):
def __init__(
self,
table: str,
params: Dict[str, Union[Dict[str, int], Callable, str, int]],
params: Union[
Dict[str, Callable],
Dict[str, Dict[str, int]],
Dict[str, int],
Dict[str, str],
],
) -> None: ...
class DatabaseCache(BaseDatabaseCache):
@@ -36,20 +44,62 @@ class DatabaseCache(BaseDatabaseCache):
def get(
self,
key: str,
default: Optional[Union[str, int]] = ...,
default: Optional[Union[int, str]] = ...,
version: Optional[int] = ...,
) -> Any: ...
) -> Optional[
Union[
Dict[
str,
Union[
Callable,
Dict[str, int],
List[int],
Tuple[int, int, int, int],
Type[Any],
int,
str,
],
],
List[Any],
bytes,
Model,
QuerySet,
HttpResponse,
int,
str,
]
]: ...
def set(
self,
key: str,
value: Any,
value: Union[
Dict[
str,
Union[
Callable,
Dict[str, int],
List[int],
Tuple[int, int, int, int],
Type[Any],
int,
str,
],
],
List[Any],
bytes,
Model,
QuerySet,
HttpResponse,
int,
str,
],
timeout: Any = ...,
version: Optional[int] = ...,
) -> None: ...
def add(
self,
key: str,
value: Union[int, bytes, str, Dict[str, int]],
value: Union[Dict[str, int], bytes, int, str],
timeout: Any = ...,
version: Optional[int] = ...,
) -> bool: ...

View File

@@ -22,20 +22,20 @@ class DummyCache(BaseCache):
self,
key: str,
value: Union[
str,
Dict[
str,
Union[
str,
int,
Callable,
Dict[str, int],
List[int],
Tuple[int, int, int, int],
Dict[str, int],
Callable,
Type[Any],
int,
str,
],
],
int,
str,
],
timeout: Any = ...,
version: Optional[str] = ...,

View File

@@ -1,6 +1,9 @@
from typing import Any, Callable, Dict, Optional, Union
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
from django.core.cache.backends.base import BaseCache
from django.db.models.base import Model
from django.db.models.query import QuerySet
from django.http.response import HttpResponse
class FileBasedCache(BaseCache):
@@ -12,25 +15,50 @@ class FileBasedCache(BaseCache):
def __init__(
self,
dir: str,
params: Dict[str, Union[Dict[str, int], Callable, str, int]],
params: Union[
Dict[str, Callable],
Dict[str, Dict[str, int]],
Dict[str, int],
Dict[str, str],
],
) -> None: ...
def add(
self,
key: str,
value: Union[int, bytes, str, Dict[str, int]],
value: Union[Dict[str, int], bytes, int, str],
timeout: Any = ...,
version: Optional[int] = ...,
) -> bool: ...
def get(
self,
key: str,
default: Optional[Union[str, int]] = ...,
default: Optional[Union[int, str]] = ...,
version: Optional[int] = ...,
) -> Optional[str]: ...
def set(
self,
key: str,
value: Any,
value: Union[
Dict[
str,
Union[
Callable,
Dict[str, int],
List[int],
Tuple[int, int, int, int],
Type[Any],
int,
str,
],
],
List[Any],
bytes,
Model,
QuerySet,
HttpResponse,
int,
str,
],
timeout: Any = ...,
version: Optional[int] = ...,
) -> None: ...

View File

@@ -1,7 +1,10 @@
from datetime import datetime
from typing import Any, Callable, Dict, Optional, Union
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
from django.core.cache.backends.base import BaseCache
from django.db.models.base import Model
from django.db.models.query import QuerySet
from django.http.response import HttpResponse
class LocMemCache(BaseCache):
@@ -12,27 +15,74 @@ class LocMemCache(BaseCache):
def __init__(
self,
name: str,
params: Dict[str, Optional[Union[Dict[str, int], Callable, str, int]]],
params: Union[
Dict[str, Callable],
Dict[str, Dict[str, int]],
Dict[str, None],
Dict[str, int],
Dict[str, str],
],
) -> None: ...
def add(
self,
key: str,
value: Union[
Dict[str, Union[str, datetime]], int, bytes, str, Dict[str, int]
Dict[str, Union[datetime, str]], Dict[str, int], bytes, int, str
],
timeout: Any = ...,
version: Optional[int] = ...,
) -> Any: ...
def get(
self,
key: Union[str, int],
default: Optional[Union[str, int]] = ...,
key: Union[int, str],
default: Optional[Union[int, str]] = ...,
version: Optional[int] = ...,
) -> Any: ...
) -> Union[
Dict[
str,
Union[
Callable,
Dict[str, int],
List[int],
Tuple[int, int, int, int],
Type[Any],
int,
str,
],
],
List[str],
bytes,
Model,
QuerySet,
HttpResponse,
int,
str,
]: ...
def set(
self,
key: Union[str, int],
value: Any,
key: Union[int, str],
value: Union[
Dict[
str,
Union[
Callable,
Dict[str, int],
List[int],
Tuple[int, int, int, int],
Type[Any],
int,
str,
],
],
Dict[str, Union[datetime, str]],
List[str],
bytes,
Model,
QuerySet,
HttpResponse,
int,
str,
],
timeout: Any = ...,
version: Optional[int] = ...,
) -> None: ...
@@ -41,7 +91,7 @@ class LocMemCache(BaseCache):
) -> Any: ...
def incr(
self,
key: Union[str, int],
key: Union[int, str],
delta: int = ...,
version: Optional[int] = ...,
) -> int: ...