better stubs

This commit is contained in:
Maxim Kurnikov
2018-08-05 03:13:19 +03:00
parent 4013fe4d03
commit fa718b8e55
380 changed files with 11805 additions and 8503 deletions

View File

@@ -1,14 +1,25 @@
from collections import OrderedDict
from django.core.cache.backends.base import BaseCache
from typing import Callable, Dict, Union
from typing import Any, Callable, Dict, Optional, Union
def _create_cache(backend: str, **kwargs) -> BaseCache: ...
def close_caches(**kwargs) -> None: ...
from django.core.cache.backends.base import BaseCache as BaseCache
from django.core.cache.backends.base import CacheKeyWarning as CacheKeyWarning
from django.core.cache.backends.base import \
InvalidCacheBackendError as InvalidCacheBackendError
DEFAULT_CACHE_ALIAS: str
class CacheHandler:
def __init__(self) -> None: ...
def __getitem__(self, alias: str) -> BaseCache: ...
def all(self): ...
class DefaultCacheProxy:
def __contains__(self, key: str) -> bool: ...
def __getattr__(self, name: str) -> Union[OrderedDict, Dict[str, float], Callable]: ...
def __getattr__(
self, name: str
) -> Union[Callable, Dict[str, float], int, OrderedDict]: ...
def __setattr__(self, name: str, value: Callable) -> None: ...
def __delattr__(self, name: Any): ...
def __contains__(self, key: str) -> bool: ...
def __eq__(self, other: Any): ...
cache: Any

View File

@@ -1,13 +1,9 @@
# Stubs for django.core.cache.backends.base (Python 3.6)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from django.core.exceptions import ImproperlyConfigured
from typing import Any, Optional
from collections import OrderedDict
from typing import Any, Callable, Dict, List, Optional, Union
from django.core.exceptions import ImproperlyConfigured
class InvalidCacheBackendError(ImproperlyConfigured): ...
class CacheKeyWarning(RuntimeWarning): ...
@@ -17,30 +13,44 @@ MEMCACHE_MAX_KEY_LENGTH: int
def default_key_func(
key: Union[str, int], key_prefix: str, version: Union[str, int]
) -> str: ...
def get_key_func(key_func: Optional[Union[str, Callable]]) -> Callable: ...
def get_key_func(key_func: Optional[Union[Callable, str]]) -> Callable: ...
class BaseCache:
default_timeout: Any = ...
_max_entries: Any = ...
_cull_frequency: Any = ...
key_prefix: Any = ...
version: Any = ...
key_func: Any = ...
def __init__(self, params: Dict[str, Any]) -> None: ...
def get_backend_timeout(self, timeout: object = ...) -> Optional[float]: ...
default_timeout: int = ...
key_prefix: str = ...
version: int = ...
key_func: Callable = ...
def __init__(
self,
params: Dict[str, Optional[Union[Dict[str, int], Callable, str, int]]],
) -> None: ...
def get_backend_timeout(self, timeout: Any = ...) -> Optional[float]: ...
def make_key(
self, key: Union[str, int], version: Optional[Union[str, int]] = ...
) -> str: ...
def add(
self, key: Any, value: Any, timeout: Any = ..., version: Optional[Any] = ...
self,
key: Any,
value: Any,
timeout: Any = ...,
version: Optional[Any] = ...,
) -> None: ...
def get(
self, key: Any, default: Optional[Any] = ..., version: Optional[Any] = ...
self,
key: Any,
default: Optional[Any] = ...,
version: Optional[Any] = ...,
) -> None: ...
def set(
self, key: Any, value: Any, timeout: Any = ..., version: Optional[Any] = ...
self,
key: Any,
value: Any,
timeout: Any = ...,
version: Optional[Any] = ...,
) -> None: ...
def touch(
self, key: Any, timeout: Any = ..., version: Optional[Any] = ...
) -> None: ...
def touch(self, key: Any, timeout: Any = ..., version: Optional[Any] = ...) -> None: ...
def delete(self, key: Any, version: Optional[Any] = ...) -> None: ...
def get_many(
self, keys: List[str], version: Optional[int] = ...
@@ -48,26 +58,32 @@ class BaseCache:
def get_or_set(
self,
key: str,
default: Optional[Union[str, int, Callable]],
timeout: object = ...,
default: Optional[Union[Callable, int, str]],
timeout: Any = ...,
version: Optional[int] = ...,
) -> Optional[Union[str, int]]: ...
def has_key(self, key: Any, version: Optional[Any] = ...): ...
def incr(self, key: str, delta: int = ..., version: Optional[int] = ...) -> int: ...
def decr(self, key: str, delta: int = ..., version: Optional[int] = ...) -> int: ...
def incr(
self, key: str, delta: int = ..., version: Optional[int] = ...
) -> int: ...
def decr(
self, key: str, delta: int = ..., version: Optional[int] = ...
) -> int: ...
def __contains__(self, key: str) -> bool: ...
def set_many(
self,
data: Union[
Dict[str, bytes],
Dict[str, Union[Dict[str, int], str]],
OrderedDict,
Dict[str, str],
Dict[str, int],
OrderedDict,
],
timeout: object = ...,
version: Optional[int] = ...,
timeout: Any = ...,
version: Optional[Union[str, int]] = ...,
) -> List[Any]: ...
def delete_many(self, keys: List[str], version: None = ...) -> None: ...
def delete_many(
self, keys: Union[Dict[str, str], List[str]], version: None = ...
) -> None: ...
def clear(self) -> None: ...
def validate_key(self, key: str) -> None: ...
def incr_version(

View File

@@ -1,16 +1,10 @@
# Stubs for django.core.cache.backends.db (Python 3.6)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from django.core.cache.backends.base import BaseCache
from typing import Any, Optional
from datetime import datetime
from django.db.backends.utils import CursorWrapper
from typing import Any, Callable, Dict, Optional, Union
from django.core.cache.backends.base import BaseCache
class Options:
db_table: Any = ...
db_table: str = ...
app_label: str = ...
model_name: str = ...
verbose_name: str = ...
@@ -23,13 +17,22 @@ class Options:
def __init__(self, table: str) -> None: ...
class BaseDatabaseCache(BaseCache):
_table: Any = ...
default_timeout: int
key_func: Callable
key_prefix: str
version: int
cache_model_class: Any = ...
def __init__(
self, table: str, params: Dict[str, Union[Callable, Dict[str, int], str, int]]
self,
table: str,
params: Dict[str, Union[Dict[str, int], Callable, str, int]],
) -> None: ...
class DatabaseCache(BaseDatabaseCache):
default_timeout: int
key_func: Callable
key_prefix: str
version: int
def get(
self,
key: str,
@@ -37,20 +40,22 @@ class DatabaseCache(BaseDatabaseCache):
version: Optional[int] = ...,
) -> Any: ...
def set(
self, key: str, value: Any, timeout: object = ..., version: Optional[int] = ...
self,
key: str,
value: Any,
timeout: Any = ...,
version: Optional[int] = ...,
) -> None: ...
def add(
self,
key: str,
value: Union[str, bytes, Dict[str, int], int],
timeout: object = ...,
value: Union[int, bytes, str, Dict[str, int]],
timeout: Any = ...,
version: Optional[int] = ...,
) -> bool: ...
def touch(
self, key: str, timeout: Optional[int] = ..., version: None = ...
self, key: str, timeout: Any = ..., version: None = ...
) -> bool: ...
def _base_set(self, mode: str, key: str, value: object, timeout: object = ...): ...
def delete(self, key: str, version: Optional[int] = ...) -> None: ...
def has_key(self, key: str, version: Optional[int] = ...): ...
def _cull(self, db: str, cursor: CursorWrapper, now: datetime) -> None: ...
def has_key(self, key: str, version: Optional[int] = ...) -> Any: ...
def clear(self) -> None: ...

View File

@@ -1,28 +1,48 @@
# Stubs for django.core.cache.backends.dummy (Python 3.6)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
from django.core.cache.backends.base import BaseCache
from typing import Any, Optional
from typing import Any, Dict, Optional, Union
class DummyCache(BaseCache):
default_timeout: int
key_func: Callable
key_prefix: str
version: int
def __init__(self, host: str, *args: Any, **kwargs: Any) -> None: ...
def add(
self, key: str, value: str, timeout: object = ..., version: None = ...
self, key: str, value: str, timeout: Any = ..., version: None = ...
) -> bool: ...
def get(
self, key: str, default: Optional[str] = ..., version: Optional[int] = ...
self,
key: str,
default: Optional[str] = ...,
version: Optional[int] = ...,
) -> Optional[str]: ...
def set(
self,
key: str,
value: Union[str, Dict[str, Any], int],
timeout: object = ...,
value: Union[
str,
Dict[
str,
Union[
str,
int,
List[int],
Tuple[int, int, int, int],
Dict[str, int],
Callable,
Type[Any],
],
],
int,
],
timeout: Any = ...,
version: Optional[str] = ...,
) -> None: ...
def touch(self, key: Any, timeout: Any = ..., version: Optional[Any] = ...): ...
def delete(self, key: Any, version: Optional[Any] = ...) -> None: ...
def touch(
self, key: str, timeout: Any = ..., version: None = ...
) -> bool: ...
def delete(self, key: str, version: None = ...) -> None: ...
def has_key(self, key: str, version: None = ...) -> bool: ...
def clear(self) -> None: ...

View File

@@ -1,26 +1,24 @@
# Stubs for django.core.cache.backends.filebased (Python 3.6)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any, Callable, Dict, Optional, Union
from django.core.cache.backends.base import BaseCache
from typing import Any, Optional
from io import BufferedRandom, BufferedReader, BufferedWriter
from typing import Any, Callable, Dict, List, Optional, Union
def _write_content(
f: Union[BufferedRandom, BufferedWriter], expiry: float, value: object
) -> None: ...
class FileBasedCache(BaseCache):
default_timeout: int
key_func: Callable
key_prefix: str
version: int
cache_suffix: str = ...
_dir: Any = ...
def __init__(self, dir: str, params: Dict[str, Union[Callable, int]]) -> None: ...
def __init__(
self,
dir: str,
params: Dict[str, Union[Dict[str, int], Callable, str, int]],
) -> None: ...
def add(
self,
key: str,
value: Union[str, bytes, int],
timeout: object = ...,
value: Union[int, bytes, str, Dict[str, int]],
timeout: Any = ...,
version: Optional[int] = ...,
) -> bool: ...
def get(
@@ -30,15 +28,15 @@ class FileBasedCache(BaseCache):
version: Optional[int] = ...,
) -> Optional[str]: ...
def set(
self, key: str, value: Any, timeout: object = ..., version: Optional[int] = ...
self,
key: str,
value: Any,
timeout: Any = ...,
version: Optional[int] = ...,
) -> None: ...
def touch(self, key: str, timeout: object = ..., version: None = ...): ...
def touch(
self, key: str, timeout: Any = ..., version: None = ...
) -> bool: ...
def delete(self, key: str, version: Optional[int] = ...) -> None: ...
def _delete(self, fname: str) -> None: ...
def has_key(self, key: str, version: Optional[int] = ...) -> bool: ...
def _cull(self) -> None: ...
def _createdir(self) -> None: ...
def _key_to_file(self, key: str, version: Optional[int] = ...) -> str: ...
def clear(self) -> None: ...
def _is_expired(self, f: BufferedReader) -> bool: ...
def _list_cache_files(self) -> List[str]: ...

View File

@@ -1,49 +1,50 @@
# Stubs for django.core.cache.backends.locmem (Python 3.6)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from datetime import datetime
from typing import Any, Callable, Dict, Optional, Union
from django.core.cache.backends.base import BaseCache
from typing import Any, Optional
from typing import Any, Dict, Optional, Union
_caches: Any
_expire_info: Any
_locks: Any
class LocMemCache(BaseCache):
_cache: Any = ...
_expire_info: Any = ...
_lock: Any = ...
def __init__(self, name: str, params: Dict[str, Any]) -> None: ...
default_timeout: int
key_func: Callable
key_prefix: str
version: int
def __init__(
self,
name: str,
params: Dict[str, Optional[Union[Dict[str, int], Callable, str, int]]],
) -> None: ...
def add(
self,
key: str,
value: Union[int, str, Dict[str, str], Dict[str, int]],
timeout: object = ...,
value: Union[
Dict[str, Union[str, datetime]], int, bytes, str, Dict[str, int]
],
timeout: Any = ...,
version: Optional[int] = ...,
): ...
) -> Any: ...
def get(
self,
key: Union[str, int],
default: Optional[Union[str, int]] = ...,
version: Optional[int] = ...,
) -> Any: ...
def _set(self, key: str, value: bytes, timeout: object = ...) -> None: ...
def set(
self,
key: Union[str, int],
value: object,
timeout: object = ...,
value: Any,
timeout: Any = ...,
version: Optional[int] = ...,
) -> None: ...
def touch(self, key: str, timeout: object = ..., version: None = ...): ...
def touch(
self, key: str, timeout: Any = ..., version: None = ...
) -> Any: ...
def incr(
self, key: Union[str, int], delta: int = ..., version: Optional[int] = ...
self,
key: Union[str, int],
delta: int = ...,
version: Optional[int] = ...,
) -> int: ...
def has_key(self, key: str, version: Optional[int] = ...): ...
def _has_expired(self, key: str) -> bool: ...
def _cull(self) -> None: ...
def _delete(self, key: str) -> None: ...
def has_key(self, key: str, version: Optional[int] = ...) -> Any: ...
def delete(self, key: str, version: Optional[int] = ...) -> None: ...
def clear(self) -> None: ...

View File

@@ -1,10 +1,4 @@
# Stubs for django.core.cache.utils (Python 3.6)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any, Optional
from typing import List, Optional, Union
from typing import Any, List, Optional, Union
TEMPLATE_FRAGMENT_KEY_TEMPLATE: str