mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-21 03:11:17 +08:00
initial commit
This commit is contained in:
2
django/contrib/staticfiles/apps.pyi
Normal file
2
django/contrib/staticfiles/apps.pyi
Normal file
@@ -0,0 +1,2 @@
|
||||
class StaticFilesConfig:
|
||||
def ready(self) -> None: ...
|
||||
7
django/contrib/staticfiles/checks.pyi
Normal file
7
django/contrib/staticfiles/checks.pyi
Normal file
@@ -0,0 +1,7 @@
|
||||
from typing import (
|
||||
Any,
|
||||
List,
|
||||
)
|
||||
|
||||
|
||||
def check_finders(app_configs: None = ..., **kwargs) -> List[Any]: ...
|
||||
55
django/contrib/staticfiles/finders.pyi
Normal file
55
django/contrib/staticfiles/finders.pyi
Normal file
@@ -0,0 +1,55 @@
|
||||
from django.contrib.staticfiles.storage import StaticFilesStorage
|
||||
from django.core.checks.messages import Error
|
||||
from django.core.files.storage import (
|
||||
DefaultStorage,
|
||||
FileSystemStorage,
|
||||
)
|
||||
from typing import (
|
||||
Iterator,
|
||||
List,
|
||||
Optional,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def find(path: str, all: bool = ...) -> Optional[str]: ...
|
||||
|
||||
|
||||
def get_finder(import_path: str) -> BaseFinder: ...
|
||||
|
||||
|
||||
def get_finders() -> Iterator[BaseFinder]: ...
|
||||
|
||||
|
||||
class AppDirectoriesFinder:
|
||||
def __init__(self, app_names: None = ..., *args, **kwargs) -> None: ...
|
||||
def find(self, path: str, all: bool = ...) -> str: ...
|
||||
def find_in_app(self, app: str, path: str) -> Optional[str]: ...
|
||||
def list(self, ignore_patterns: List[str]) -> Iterator[Tuple[str, FileSystemStorage]]: ...
|
||||
|
||||
|
||||
class BaseFinder:
|
||||
def check(self, **kwargs): ...
|
||||
|
||||
|
||||
class BaseStorageFinder:
|
||||
def __init__(
|
||||
self,
|
||||
storage: Optional[StaticFilesStorage] = ...,
|
||||
*args,
|
||||
**kwargs
|
||||
) -> None: ...
|
||||
def list(self, ignore_patterns: List[str]) -> Iterator[Tuple[str, DefaultStorage]]: ...
|
||||
|
||||
|
||||
class DefaultStorageFinder:
|
||||
def __init__(self, *args, **kwargs) -> None: ...
|
||||
|
||||
|
||||
class FileSystemFinder:
|
||||
def __init__(self, app_names: None = ..., *args, **kwargs) -> None: ...
|
||||
def check(self, **kwargs) -> List[Error]: ...
|
||||
def find(self, path: str, all: bool = ...) -> Union[str, List[str]]: ...
|
||||
def find_location(self, root: str, path: str, prefix: str = ...) -> Optional[str]: ...
|
||||
def list(self, ignore_patterns: List[str]) -> Iterator[Tuple[str, FileSystemStorage]]: ...
|
||||
7
django/contrib/staticfiles/handlers.pyi
Normal file
7
django/contrib/staticfiles/handlers.pyi
Normal file
@@ -0,0 +1,7 @@
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
|
||||
|
||||
class StaticFilesHandler:
|
||||
def file_path(self, url: str) -> str: ...
|
||||
def get_response(self, request: WSGIRequest): ...
|
||||
def load_middleware(self) -> None: ...
|
||||
@@ -0,0 +1,42 @@
|
||||
from django.core.files.storage import (
|
||||
DefaultStorage,
|
||||
FileSystemStorage,
|
||||
)
|
||||
from django.core.management.base import CommandParser
|
||||
from typing import (
|
||||
Dict,
|
||||
List,
|
||||
Optional,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class Command:
|
||||
def __init__(self, *args, **kwargs) -> None: ...
|
||||
def add_arguments(self, parser: CommandParser) -> None: ...
|
||||
def clear_dir(self, path: str) -> None: ...
|
||||
def collect(self) -> Dict[str, List[str]]: ...
|
||||
def copy_file(
|
||||
self,
|
||||
path: str,
|
||||
prefixed_path: str,
|
||||
source_storage: Union[FileSystemStorage, DefaultStorage]
|
||||
) -> None: ...
|
||||
def delete_file(
|
||||
self,
|
||||
path: str,
|
||||
prefixed_path: str,
|
||||
source_storage: Union[FileSystemStorage, DefaultStorage]
|
||||
) -> bool: ...
|
||||
def handle(self, **options) -> Optional[str]: ...
|
||||
def is_local_storage(self) -> bool: ...
|
||||
def link_file(
|
||||
self,
|
||||
path: str,
|
||||
prefixed_path: str,
|
||||
source_storage: Union[FileSystemStorage, DefaultStorage]
|
||||
) -> None: ...
|
||||
@cached_property
|
||||
def local(self) -> bool: ...
|
||||
def log(self, msg: str, level: int = ...) -> None: ...
|
||||
def set_options(self, **options) -> None: ...
|
||||
@@ -0,0 +1,6 @@
|
||||
from django.core.management.base import CommandParser
|
||||
|
||||
|
||||
class Command:
|
||||
def add_arguments(self, parser: CommandParser) -> None: ...
|
||||
def handle_label(self, path: str, **options) -> str: ...
|
||||
@@ -0,0 +1,5 @@
|
||||
from django.contrib.staticfiles.handlers import StaticFilesHandler
|
||||
|
||||
|
||||
class Command:
|
||||
def get_handler(self, *args, **options) -> StaticFilesHandler: ...
|
||||
82
django/contrib/staticfiles/storage.pyi
Normal file
82
django/contrib/staticfiles/storage.pyi
Normal file
@@ -0,0 +1,82 @@
|
||||
from collections import OrderedDict
|
||||
from django.core.cache import DefaultCacheProxy
|
||||
from django.core.files.base import File
|
||||
from django.core.files.storage import FileSystemStorage
|
||||
from django.utils.safestring import SafeText
|
||||
from typing import (
|
||||
Callable,
|
||||
Dict,
|
||||
Iterator,
|
||||
List,
|
||||
Optional,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class CachedFilesMixin:
|
||||
def __init__(self, *args, **kwargs) -> None: ...
|
||||
def hash_key(self, name: str) -> str: ...
|
||||
|
||||
|
||||
class ConfiguredStorage:
|
||||
def _setup(self) -> None: ...
|
||||
|
||||
|
||||
class HashedFilesMixin:
|
||||
def __init__(self, *args, **kwargs) -> None: ...
|
||||
def _post_process(
|
||||
self,
|
||||
paths: Union[OrderedDict, Dict[str, Tuple[FileSystemStorage, str]]],
|
||||
adjustable_paths: List[str],
|
||||
hashed_files: OrderedDict
|
||||
) -> Iterator[Tuple[str, str, bool, bool]]: ...
|
||||
def _stored_name(self, name: str, hashed_files: OrderedDict) -> str: ...
|
||||
def _url(
|
||||
self,
|
||||
hashed_name_func: Callable,
|
||||
name: str,
|
||||
force: bool = ...,
|
||||
hashed_files: Optional[OrderedDict] = ...
|
||||
) -> str: ...
|
||||
def clean_name(self, name: str) -> str: ...
|
||||
def file_hash(self, name: str, content: File = ...) -> str: ...
|
||||
def hash_key(self, name: str) -> str: ...
|
||||
def hashed_name(
|
||||
self,
|
||||
name: str,
|
||||
content: Optional[File] = ...,
|
||||
filename: Optional[str] = ...
|
||||
) -> str: ...
|
||||
def post_process(
|
||||
self,
|
||||
paths: OrderedDict,
|
||||
dry_run: bool = ...,
|
||||
**options
|
||||
) -> Iterator[Tuple[str, str, bool]]: ...
|
||||
def stored_name(self, name: SafeText) -> str: ...
|
||||
def url(self, name: SafeText, force: bool = ...) -> str: ...
|
||||
def url_converter(self, name: str, hashed_files: OrderedDict, template: str = ...) -> Callable: ...
|
||||
|
||||
|
||||
class ManifestFilesMixin:
|
||||
def __init__(self, *args, **kwargs) -> None: ...
|
||||
def load_manifest(self) -> OrderedDict: ...
|
||||
def post_process(self, *args, **kwargs) -> None: ...
|
||||
def read_manifest(self) -> None: ...
|
||||
def save_manifest(self) -> None: ...
|
||||
def stored_name(self, name: SafeText) -> str: ...
|
||||
|
||||
|
||||
class StaticFilesStorage:
|
||||
def __init__(self, location: Optional[str] = ..., base_url: None = ..., *args, **kwargs) -> None: ...
|
||||
def path(self, name: str) -> str: ...
|
||||
|
||||
|
||||
class _MappingCache:
|
||||
def __getitem__(self, key: str) -> str: ...
|
||||
def __init__(self, cache: DefaultCacheProxy) -> None: ...
|
||||
def __setitem__(self, key: str, value: str) -> None: ...
|
||||
def clear(self) -> None: ...
|
||||
def get(self, key: str, default: None = ...) -> Optional[str]: ...
|
||||
def update(self, data: OrderedDict) -> None: ...
|
||||
11
django/contrib/staticfiles/templatetags/staticfiles.pyi
Normal file
11
django/contrib/staticfiles/templatetags/staticfiles.pyi
Normal file
@@ -0,0 +1,11 @@
|
||||
from django.template.base import (
|
||||
Parser,
|
||||
Token,
|
||||
)
|
||||
from django.templatetags.static import StaticNode
|
||||
|
||||
|
||||
def do_static(
|
||||
parser: Parser,
|
||||
token: Token
|
||||
) -> StaticNode: ...
|
||||
5
django/contrib/staticfiles/urls.pyi
Normal file
5
django/contrib/staticfiles/urls.pyi
Normal file
@@ -0,0 +1,5 @@
|
||||
from django.urls.resolvers import URLPattern
|
||||
from typing import List
|
||||
|
||||
|
||||
def staticfiles_urlpatterns(prefix: None = ...) -> List[URLPattern]: ...
|
||||
24
django/contrib/staticfiles/utils.pyi
Normal file
24
django/contrib/staticfiles/utils.pyi
Normal file
@@ -0,0 +1,24 @@
|
||||
from collections import OrderedDict
|
||||
from django.core.files.storage import (
|
||||
DefaultStorage,
|
||||
FileSystemStorage,
|
||||
)
|
||||
from typing import (
|
||||
Iterator,
|
||||
List,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def check_settings(base_url: str = ...) -> None: ...
|
||||
|
||||
|
||||
def get_files(
|
||||
storage: Union[FileSystemStorage, DefaultStorage],
|
||||
ignore_patterns: List[str] = ...,
|
||||
location: str = ...
|
||||
) -> Iterator[str]: ...
|
||||
|
||||
|
||||
def matches_patterns(path: str, patterns: Union[OrderedDict, Tuple[str], List[str]] = ...) -> bool: ...
|
||||
10
django/contrib/staticfiles/views.pyi
Normal file
10
django/contrib/staticfiles/views.pyi
Normal file
@@ -0,0 +1,10 @@
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.http.response import FileResponse
|
||||
|
||||
|
||||
def serve(
|
||||
request: WSGIRequest,
|
||||
path: str,
|
||||
insecure: bool = ...,
|
||||
**kwargs
|
||||
) -> FileResponse: ...
|
||||
Reference in New Issue
Block a user