reformat with black

This commit is contained in:
Maxim Kurnikov
2018-07-29 23:34:58 +03:00
parent 4866354600
commit cf85607969
343 changed files with 6054 additions and 2158 deletions

View File

@@ -1,23 +1,14 @@
from collections import OrderedDict
from django.core.cache.backends.base import BaseCache
from typing import (
Callable,
Dict,
Union,
)
from typing import Callable, Dict, Union
def _create_cache(backend: str, **kwargs) -> BaseCache: ...
def close_caches(**kwargs) -> None: ...
class CacheHandler:
def __getitem__(self, alias: str) -> BaseCache: ...
class DefaultCacheProxy:
def __contains__(self, key: str) -> bool: ...
def __getattr__(self, name: str) -> Union[OrderedDict, Dict[str, float], Callable]: ...
def __setattr__(self, name: str, value: Callable) -> None: ...
def __setattr__(self, name: str, value: Callable) -> None: ...

View File

@@ -7,13 +7,16 @@ from typing import Any, Optional
from collections import OrderedDict
from typing import Any, Callable, Dict, List, Optional, Union
class InvalidCacheBackendError(ImproperlyConfigured): ...
class CacheKeyWarning(RuntimeWarning): ...
DEFAULT_TIMEOUT: Any
MEMCACHE_MAX_KEY_LENGTH: int
def default_key_func(key: Union[str, int], key_prefix: str, version: Union[str, int]) -> str: ...
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:
@@ -25,22 +28,52 @@ class BaseCache:
key_func: Any = ...
def __init__(self, params: Dict[str, Any]) -> None: ...
def get_backend_timeout(self, timeout: object = ...) -> 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] = ...) -> None: ...
def get(self, key: Any, default: Optional[Any] = ..., version: Optional[Any] = ...) -> None: ...
def set(self, key: Any, value: Any, timeout: Any = ..., version: Optional[Any] = ...) -> None: ...
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] = ...
) -> None: ...
def get(
self, key: Any, default: Optional[Any] = ..., version: Optional[Any] = ...
) -> None: ...
def set(
self, key: Any, value: 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] = ...) -> Dict[str, Union[str, int]]: ...
def get_or_set(self, key: str, default: Optional[Union[str, int, Callable]], timeout: object = ..., version: Optional[int] = ...) -> Optional[Union[str, int]]: ...
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, int, Callable]],
timeout: object = ...,
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 __contains__(self, key: str) -> bool: ...
def set_many(self, data: Union[Dict[str, Union[Dict[str, int], str]], OrderedDict, Dict[str, str], Dict[str, int]], timeout: object = ..., version: Optional[int] = ...) -> List[Any]: ...
def set_many(
self,
data: Union[
Dict[str, Union[Dict[str, int], str]],
OrderedDict,
Dict[str, str],
Dict[str, int],
],
timeout: object = ...,
version: Optional[int] = ...,
) -> List[Any]: ...
def delete_many(self, keys: List[str], version: None = ...) -> None: ...
def clear(self) -> None: ...
def validate_key(self, key: str) -> None: ...
def incr_version(self, key: str, delta: int = ..., version: Optional[int] = ...) -> int: ...
def decr_version(self, key: str, delta: int = ..., version: Optional[int] = ...) -> int: ...
def incr_version(
self, key: str, delta: int = ..., version: Optional[int] = ...
) -> int: ...
def decr_version(
self, key: str, delta: int = ..., version: Optional[int] = ...
) -> int: ...
def close(self, **kwargs: Any) -> None: ...

View File

@@ -8,6 +8,7 @@ from typing import Any, Optional
from datetime import datetime
from django.db.backends.utils import CursorWrapper
from typing import Any, Callable, Dict, Optional, Union
class Options:
db_table: Any = ...
app_label: str = ...
@@ -24,13 +25,30 @@ class Options:
class BaseDatabaseCache(BaseCache):
_table: Any = ...
cache_model_class: Any = ...
def __init__(self, table: str, params: Dict[str, Union[Callable, Dict[str, int], str, int]]) -> None: ...
def __init__(
self, table: str, params: Dict[str, Union[Callable, Dict[str, int], str, int]]
) -> None: ...
class DatabaseCache(BaseDatabaseCache):
def get(self, key: str, default: Optional[Union[str, int]] = ..., version: Optional[int] = ...) -> Any: ...
def set(self, key: str, value: Any, timeout: object = ..., version: Optional[int] = ...) -> None: ...
def add(self, key: str, value: Union[str, bytes, Dict[str, int], int], timeout: object = ..., version: Optional[int] = ...) -> bool: ...
def touch(self, key: str, timeout: Optional[int] = ..., version: None = ...) -> bool: ...
def get(
self,
key: str,
default: Optional[Union[str, int]] = ...,
version: Optional[int] = ...,
) -> Any: ...
def set(
self, key: str, value: Any, timeout: object = ..., version: Optional[int] = ...
) -> None: ...
def add(
self,
key: str,
value: Union[str, bytes, Dict[str, int], int],
timeout: object = ...,
version: Optional[int] = ...,
) -> bool: ...
def touch(
self, key: str, timeout: Optional[int] = ..., 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] = ...): ...

View File

@@ -6,11 +6,22 @@ from django.core.cache.backends.base import BaseCache
from typing import Any, Optional
from typing import Any, Dict, Optional, Union
class DummyCache(BaseCache):
def __init__(self, host: str, *args: Any, **kwargs: Any) -> 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 set(self, key: str, value: Union[str, Dict[str, Any], int], timeout: object = ..., version: Optional[str] = ...) -> 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 set(
self,
key: str,
value: Union[str, Dict[str, Any], int],
timeout: object = ...,
version: Optional[str] = ...,
) -> None: ...
def touch(self, key: Any, timeout: Any = ..., version: Optional[Any] = ...): ...
def delete(self, key: Any, version: Optional[Any] = ...) -> None: ...
def has_key(self, key: str, version: None = ...) -> bool: ...

View File

@@ -7,15 +7,31 @@ 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: ...
def _write_content(
f: Union[BufferedRandom, BufferedWriter], expiry: float, value: object
) -> None: ...
class FileBasedCache(BaseCache):
cache_suffix: str = ...
_dir: Any = ...
def __init__(self, dir: str, params: Dict[str, Union[Callable, int]]) -> None: ...
def add(self, key: str, value: Union[str, bytes, int], timeout: object = ..., version: Optional[int] = ...) -> bool: ...
def get(self, key: str, default: Optional[Union[str, int]] = ..., version: Optional[int] = ...) -> Optional[str]: ...
def set(self, key: str, value: Any, timeout: object = ..., version: Optional[int] = ...) -> None: ...
def add(
self,
key: str,
value: Union[str, bytes, int],
timeout: object = ...,
version: Optional[int] = ...,
) -> bool: ...
def get(
self,
key: str,
default: Optional[Union[str, int]] = ...,
version: Optional[int] = ...,
) -> Optional[str]: ...
def set(
self, key: str, value: Any, timeout: object = ..., version: Optional[int] = ...
) -> None: ...
def touch(self, key: str, timeout: object = ..., version: None = ...): ...
def delete(self, key: str, version: Optional[int] = ...) -> None: ...
def _delete(self, fname: str) -> None: ...

View File

@@ -6,6 +6,7 @@ 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
@@ -15,12 +16,31 @@ class LocMemCache(BaseCache):
_expire_info: Any = ...
_lock: Any = ...
def __init__(self, name: str, params: Dict[str, Any]) -> None: ...
def add(self, key: str, value: Union[int, str, Dict[str, str], Dict[str, int]], timeout: object = ..., version: Optional[int] = ...): ...
def get(self, key: Union[str, int], default: Optional[Union[str, int]] = ..., version: Optional[int] = ...) -> Any: ...
def add(
self,
key: str,
value: Union[int, str, Dict[str, str], Dict[str, int]],
timeout: object = ...,
version: Optional[int] = ...,
): ...
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 = ..., version: Optional[int] = ...) -> None: ...
def set(
self,
key: Union[str, int],
value: object,
timeout: object = ...,
version: Optional[int] = ...,
) -> None: ...
def touch(self, key: str, timeout: object = ..., version: None = ...): ...
def incr(self, key: Union[str, int], delta: int = ..., version: Optional[int] = ...) -> int: ...
def incr(
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: ...

View File

@@ -5,6 +5,9 @@
from typing import Any, Optional
from typing import List, Optional, Union
TEMPLATE_FRAGMENT_KEY_TEMPLATE: str
def make_template_fragment_key(fragment_name: str, vary_on: Optional[Union[List[int], List[str]]] = ...) -> str: ...
def make_template_fragment_key(
fragment_name: str, vary_on: Optional[Union[List[int], List[str]]] = ...
) -> str: ...