initial commit

This commit is contained in:
Maxim Kurnikov
2018-07-29 18:12:23 +03:00
commit a9f215bf64
311 changed files with 13433 additions and 0 deletions

43
django/core/cache/backends/base.pyi vendored Normal file
View File

@@ -0,0 +1,43 @@
from collections import OrderedDict
from typing import (
Any,
Callable,
Dict,
List,
Optional,
Union,
)
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: ...
class BaseCache:
def __contains__(self, key: str) -> bool: ...
def __init__(self, params: Dict[str, Any]) -> None: ...
def close(self, **kwargs) -> None: ...
def decr(self, key: str, delta: int = ..., version: Optional[int] = ...) -> int: ...
def decr_version(self, key: str, delta: int = ..., version: Optional[int] = ...) -> int: ...
def delete_many(self, keys: List[str], version: None = ...) -> None: ...
def get_backend_timeout(self, timeout: object = ...) -> Optional[float]: ...
def get_many(self, keys: List[str], version: Optional[int] = ...) -> Dict[str, Union[str, int]]: ...
def get_or_set(
self,
key: str,
default: Optional[Union[str, Callable, int]],
timeout: object = ...,
version: Optional[int] = ...
) -> Optional[Union[str, int]]: ...
def incr(self, key: str, delta: int = ..., version: Optional[int] = ...) -> int: ...
def incr_version(self, key: str, delta: int = ..., version: Optional[int] = ...) -> int: ...
def make_key(self, key: Union[str, int], version: Optional[Union[str, int]] = ...) -> str: ...
def set_many(
self,
data: Union[Dict[str, str], Dict[str, Union[Dict[str, int], str]], Dict[str, int], OrderedDict],
timeout: object = ...,
version: Optional[int] = ...
) -> List[Any]: ...
def validate_key(self, key: str) -> None: ...

35
django/core/cache/backends/db.pyi vendored Normal file
View File

@@ -0,0 +1,35 @@
from datetime import datetime
from django.db.backends.utils import CursorWrapper
from typing import (
Any,
Callable,
Dict,
Optional,
Union,
)
class BaseDatabaseCache:
def __init__(self, table: str, params: Dict[str, Union[int, Callable, str, Dict[str, int]]]) -> None: ...
class DatabaseCache:
def _base_set(self, mode: str, key: str, value: Any, timeout: object = ...): ...
def _cull(self, db: str, cursor: CursorWrapper, now: datetime) -> None: ...
def add(
self,
key: str,
value: Union[str, bytes, Dict[str, int], int],
timeout: object = ...,
version: Optional[int] = ...
) -> bool: ...
def clear(self) -> None: ...
def delete(self, key: str, version: Optional[int] = ...) -> None: ...
def get(self, key: str, default: Optional[Union[str, int]] = ..., version: Optional[int] = ...) -> Any: ...
def has_key(self, key: str, version: Optional[int] = ...): ...
def set(self, key: str, value: Any, timeout: object = ..., version: Optional[int] = ...) -> None: ...
def touch(self, key: str, timeout: Optional[int] = ..., version: None = ...) -> bool: ...
class Options:
def __init__(self, table: str) -> None: ...

20
django/core/cache/backends/dummy.pyi vendored Normal file
View File

@@ -0,0 +1,20 @@
from typing import (
Any,
Dict,
Optional,
Union,
)
class DummyCache:
def __init__(self, host: str, *args, **kwargs) -> None: ...
def add(self, key: str, value: str, timeout: object = ..., version: None = ...) -> bool: ...
def get(self, key: str, default: Optional[str] = ..., version: Optional[int] = ...) -> Optional[str]: ...
def has_key(self, key: str, version: None = ...) -> bool: ...
def set(
self,
key: str,
value: Union[str, int, Dict[str, Any]],
timeout: object = ...,
version: Optional[str] = ...
) -> None: ...

View File

@@ -0,0 +1,44 @@
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: Any) -> None: ...
class FileBasedCache:
def __init__(self, dir: str, params: Dict[str, Union[Callable, int]]) -> None: ...
def _createdir(self) -> None: ...
def _cull(self) -> None: ...
def _delete(self, fname: str) -> None: ...
def _is_expired(self, f: BufferedReader) -> bool: ...
def _key_to_file(self, key: str, version: Optional[int] = ...) -> str: ...
def _list_cache_files(self) -> List[str]: ...
def add(
self,
key: str,
value: Union[str, bytes, int],
timeout: object = ...,
version: Optional[int] = ...
) -> bool: ...
def clear(self) -> None: ...
def delete(self, key: str, version: Optional[int] = ...) -> None: ...
def get(
self,
key: str,
default: Optional[Union[str, int]] = ...,
version: Optional[int] = ...
) -> Optional[str]: ...
def has_key(self, key: str, version: Optional[int] = ...) -> bool: ...
def set(self, key: str, value: Any, timeout: object = ..., version: Optional[int] = ...) -> None: ...
def touch(self, key: str, timeout: object = ..., version: None = ...): ...

38
django/core/cache/backends/locmem.pyi vendored Normal file
View File

@@ -0,0 +1,38 @@
from typing import (
Any,
Dict,
Optional,
Union,
)
class LocMemCache:
def __init__(self, name: str, params: Dict[str, Any]) -> None: ...
def _delete(self, key: str) -> None: ...
def _has_expired(self, key: str) -> bool: ...
def _set(self, key: str, value: bytes, timeout: object = ...) -> None: ...
def add(
self,
key: str,
value: Union[int, Dict[str, int], str, Dict[str, str]],
timeout: object = ...,
version: Optional[int] = ...
): ...
def clear(self) -> None: ...
def delete(self, key: str, version: Optional[int] = ...) -> None: ...
def get(
self,
key: Union[str, int],
default: Optional[Union[str, int]] = ...,
version: Optional[int] = ...
) -> Any: ...
def has_key(self, key: str, version: Optional[int] = ...): ...
def incr(self, key: Union[str, int], delta: int = ..., version: Optional[int] = ...) -> int: ...
def set(
self,
key: Union[str, int],
value: Any,
timeout: object = ...,
version: Optional[int] = ...
) -> None: ...
def touch(self, key: str, timeout: object = ..., version: None = ...): ...