mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-20 10:51:16 +08:00
move django.core stubs
This commit is contained in:
21
django-stubs/core/cache/__init__.pyi
vendored
Normal file
21
django-stubs/core/cache/__init__.pyi
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
from collections import OrderedDict
|
||||
from typing import Any, Callable, Dict, Union
|
||||
|
||||
from django.core.cache.backends.base import BaseCache as BaseCache
|
||||
|
||||
DEFAULT_CACHE_ALIAS: str
|
||||
|
||||
class CacheHandler:
|
||||
def __init__(self) -> None: ...
|
||||
def __getitem__(self, alias: str) -> BaseCache: ...
|
||||
def all(self): ...
|
||||
|
||||
class DefaultCacheProxy:
|
||||
def __getattr__(self, name: str) -> Union[Callable, Dict[str, float], OrderedDict, int]: ...
|
||||
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
|
||||
caches: CacheHandler
|
||||
0
django-stubs/core/cache/backends/__init__.pyi
vendored
Normal file
0
django-stubs/core/cache/backends/__init__.pyi
vendored
Normal file
47
django-stubs/core/cache/backends/base.pyi
vendored
Normal file
47
django-stubs/core/cache/backends/base.pyi
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
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): ...
|
||||
|
||||
DEFAULT_TIMEOUT: Any
|
||||
MEMCACHE_MAX_KEY_LENGTH: int
|
||||
|
||||
def default_key_func(key: Union[int, str], key_prefix: str, version: Union[int, str]) -> str: ...
|
||||
def get_key_func(key_func: Optional[Union[Callable, str]]) -> Callable: ...
|
||||
|
||||
class BaseCache:
|
||||
default_timeout: int = ...
|
||||
key_prefix: str = ...
|
||||
version: int = ...
|
||||
key_func: Callable = ...
|
||||
def __init__(self, params: Dict[str, Optional[Union[Callable, Dict[str, int], int, str]]]) -> None: ...
|
||||
def get_backend_timeout(self, timeout: Any = ...) -> Optional[float]: ...
|
||||
def make_key(self, key: Union[int, str], version: Optional[Union[int, str]] = ...) -> 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[int, str]]: ...
|
||||
def get_or_set(
|
||||
self, key: str, default: Optional[Union[Callable, int, str]], timeout: Any = ..., version: Optional[int] = ...
|
||||
) -> Optional[Union[int, str]]: ...
|
||||
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, bytes], Dict[str, int], Dict[str, str], OrderedDict],
|
||||
timeout: Any = ...,
|
||||
version: Optional[Union[int, str]] = ...,
|
||||
) -> List[Any]: ...
|
||||
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(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: ...
|
||||
39
django-stubs/core/cache/backends/db.pyi
vendored
Normal file
39
django-stubs/core/cache/backends/db.pyi
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
from typing import Any, Callable, Dict, Optional, Union
|
||||
|
||||
from django.core.cache.backends.base import BaseCache
|
||||
|
||||
class Options:
|
||||
db_table: str = ...
|
||||
app_label: str = ...
|
||||
model_name: str = ...
|
||||
verbose_name: str = ...
|
||||
verbose_name_plural: str = ...
|
||||
object_name: str = ...
|
||||
abstract: bool = ...
|
||||
managed: bool = ...
|
||||
proxy: bool = ...
|
||||
swapped: bool = ...
|
||||
def __init__(self, table: str) -> None: ...
|
||||
|
||||
class BaseDatabaseCache(BaseCache):
|
||||
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], int, str]]) -> None: ...
|
||||
|
||||
class DatabaseCache(BaseDatabaseCache):
|
||||
default_timeout: int
|
||||
key_func: Callable
|
||||
key_prefix: str
|
||||
version: int
|
||||
def get(self, key: str, default: Optional[Union[int, str]] = ..., version: Optional[int] = ...) -> Any: ...
|
||||
def set(self, key: str, value: Any, timeout: Any = ..., version: Optional[int] = ...) -> None: ...
|
||||
def add(
|
||||
self, key: str, value: Union[Dict[str, int], bytes, int, str], timeout: Any = ..., version: Optional[int] = ...
|
||||
) -> bool: ...
|
||||
def touch(self, key: str, timeout: Any = ..., version: None = ...) -> bool: ...
|
||||
def delete(self, key: str, version: Optional[int] = ...) -> None: ...
|
||||
def has_key(self, key: str, version: Optional[int] = ...) -> Any: ...
|
||||
def clear(self) -> None: ...
|
||||
19
django-stubs/core/cache/backends/dummy.pyi
vendored
Normal file
19
django-stubs/core/cache/backends/dummy.pyi
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
from django.core.cache.backends.base import BaseCache
|
||||
|
||||
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: Any = ..., version: None = ...) -> bool: ...
|
||||
def get(self, key: str, default: Optional[str] = ..., version: Optional[int] = ...) -> Optional[str]: ...
|
||||
def set(
|
||||
self, key: str, value: Union[Dict[str, Any], int, str], timeout: Any = ..., version: Optional[str] = ...
|
||||
) -> 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: ...
|
||||
22
django-stubs/core/cache/backends/filebased.pyi
vendored
Normal file
22
django-stubs/core/cache/backends/filebased.pyi
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
from typing import Any, Callable, Dict, Optional, Union
|
||||
|
||||
from django.core.cache.backends.base import BaseCache
|
||||
|
||||
class FileBasedCache(BaseCache):
|
||||
default_timeout: int
|
||||
key_func: Callable
|
||||
key_prefix: str
|
||||
version: int
|
||||
cache_suffix: str = ...
|
||||
def __init__(self, dir: str, params: Dict[str, Union[Callable, Dict[str, int], int, str]]) -> None: ...
|
||||
def add(
|
||||
self, key: str, value: Union[Dict[str, int], bytes, int, str], timeout: Any = ..., version: Optional[int] = ...
|
||||
) -> bool: ...
|
||||
def get(
|
||||
self, key: str, default: Optional[Union[int, str]] = ..., version: Optional[int] = ...
|
||||
) -> Optional[str]: ...
|
||||
def set(self, key: str, value: Any, timeout: Any = ..., version: Optional[int] = ...) -> None: ...
|
||||
def touch(self, key: str, timeout: Any = ..., version: None = ...) -> bool: ...
|
||||
def delete(self, key: str, version: Optional[int] = ...) -> None: ...
|
||||
def has_key(self, key: str, version: Optional[int] = ...) -> bool: ...
|
||||
def clear(self) -> None: ...
|
||||
26
django-stubs/core/cache/backends/locmem.pyi
vendored
Normal file
26
django-stubs/core/cache/backends/locmem.pyi
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
from typing import Any, Callable, Dict, Optional, Union
|
||||
|
||||
from django.core.cache.backends.base import BaseCache
|
||||
|
||||
class LocMemCache(BaseCache):
|
||||
default_timeout: int
|
||||
key_func: Callable
|
||||
key_prefix: str
|
||||
version: int
|
||||
def __init__(self, name: str, params: Dict[str, Optional[Union[Callable, Dict[str, int], int, str]]]) -> None: ...
|
||||
def add(
|
||||
self,
|
||||
key: str,
|
||||
value: Union[Dict[str, int], Dict[str, str], bytes, int, str],
|
||||
timeout: Any = ...,
|
||||
version: Optional[int] = ...,
|
||||
) -> Any: ...
|
||||
def get(
|
||||
self, key: Union[int, str], default: Optional[Union[int, str]] = ..., version: Optional[int] = ...
|
||||
) -> Any: ...
|
||||
def set(self, key: Union[int, str], value: Any, timeout: Any = ..., version: Optional[int] = ...) -> None: ...
|
||||
def touch(self, key: str, timeout: Any = ..., version: None = ...) -> Any: ...
|
||||
def incr(self, key: Union[int, str], delta: int = ..., version: Optional[int] = ...) -> int: ...
|
||||
def has_key(self, key: str, version: Optional[int] = ...) -> Any: ...
|
||||
def delete(self, key: str, version: Optional[int] = ...) -> None: ...
|
||||
def clear(self) -> None: ...
|
||||
5
django-stubs/core/cache/utils.pyi
vendored
Normal file
5
django-stubs/core/cache/utils.pyi
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
from typing import Any, 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: ...
|
||||
Reference in New Issue
Block a user