mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-16 00:37:11 +08:00
add missing files throughout the codebase (#102)
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
from .messages import Warning as Warning, Info as Info, Debug as Debug, Error as Error, Critical as Critical
|
||||
|
||||
from .registry import run_checks as run_checks, Tags as Tags, register as register
|
||||
|
||||
from . import model_checks as model_checks
|
||||
|
||||
7
django-stubs/core/checks/translation.pyi
Normal file
7
django-stubs/core/checks/translation.pyi
Normal file
@@ -0,0 +1,7 @@
|
||||
from typing import Any, List
|
||||
|
||||
from . import Error
|
||||
|
||||
E001: Error = ...
|
||||
|
||||
def check_setting_language_code(app_configs: Any, **kwargs: Any) -> List[Error]: ...
|
||||
@@ -1,9 +1,11 @@
|
||||
import types
|
||||
from io import StringIO
|
||||
from typing import Any, Iterator, Optional, Union, IO, Type
|
||||
from types import TracebackType
|
||||
from typing import Any, IO, Iterator, Optional, Type, TypeVar, Union
|
||||
|
||||
from django.core.files.utils import FileProxyMixin
|
||||
|
||||
_T = TypeVar("_T", bound="File")
|
||||
|
||||
class File(FileProxyMixin, IO[Any]):
|
||||
DEFAULT_CHUNK_SIZE: Any = ...
|
||||
file: StringIO = ...
|
||||
@@ -13,24 +15,24 @@ class File(FileProxyMixin, IO[Any]):
|
||||
def __bool__(self) -> bool: ...
|
||||
def __len__(self) -> int: ...
|
||||
def size(self) -> int: ...
|
||||
def chunks(self, chunk_size: Optional[int] = ...) -> Iterator[Union[bytes, bytearray]]: ...
|
||||
def multiple_chunks(self, chunk_size: Optional[Any] = ...): ...
|
||||
def chunks(self, chunk_size: Optional[int] = ...) -> Iterator[bytes]: ...
|
||||
def multiple_chunks(self, chunk_size: Optional[int] = ...) -> bool: ...
|
||||
def __iter__(self) -> Iterator[Union[bytes, str]]: ...
|
||||
def __next__(self) -> Union[bytes, str]: ...
|
||||
def __enter__(self) -> File: ...
|
||||
def __enter__(self: _T) -> _T: ...
|
||||
def __exit__(
|
||||
self, exc_type: Optional[Type[BaseException]], exc_value: Optional[BaseException], tb: Optional[TracebackType]
|
||||
self,
|
||||
exc_type: Optional[Type[BaseException]],
|
||||
exc_value: Optional[BaseException],
|
||||
tb: Optional[types.TracebackType],
|
||||
) -> bool: ...
|
||||
def open(self, mode: Optional[str] = ...) -> File: ...
|
||||
def open(self: _T, mode: Optional[str] = ...) -> _T: ...
|
||||
def close(self) -> None: ...
|
||||
|
||||
class ContentFile(File):
|
||||
file: StringIO
|
||||
size: Any = ...
|
||||
def __init__(self, content: Union[bytes, str], name: Optional[str] = ...) -> None: ...
|
||||
def __bool__(self) -> bool: ...
|
||||
def open(self, mode: Optional[str] = ...) -> ContentFile: ...
|
||||
def close(self) -> None: ...
|
||||
def write(self, data: str) -> int: ...
|
||||
|
||||
def endswith_cr(line: bytes) -> bool: ...
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from datetime import datetime
|
||||
from typing import Any, List, Optional, Tuple, IO
|
||||
from typing import Any, IO, List, Optional, Tuple
|
||||
|
||||
from django.core.files.base import File
|
||||
from django.utils.functional import LazyObject
|
||||
@@ -13,7 +13,7 @@ class Storage:
|
||||
def path(self, name: str) -> str: ...
|
||||
def delete(self, name: str) -> None: ...
|
||||
def exists(self, name: str) -> bool: ...
|
||||
def listdir(self, path: Any) -> Optional[Tuple[List[str], List[str]]]: ...
|
||||
def listdir(self, path: str) -> Tuple[List[str], List[str]]: ...
|
||||
def size(self, name: str) -> int: ...
|
||||
def url(self, name: Optional[str]) -> str: ...
|
||||
def get_accessed_time(self, name: str) -> datetime: ...
|
||||
@@ -21,6 +21,7 @@ class Storage:
|
||||
def get_modified_time(self, name: str) -> datetime: ...
|
||||
|
||||
class FileSystemStorage(Storage):
|
||||
OS_OPEN_FLAGS: int = ...
|
||||
def __init__(
|
||||
self,
|
||||
location: Optional[str] = ...,
|
||||
@@ -42,3 +43,5 @@ class FileSystemStorage(Storage):
|
||||
class DefaultStorage(LazyObject): ...
|
||||
|
||||
default_storage: Any
|
||||
|
||||
def get_storage_class(import_path: Optional[str] = ...) -> Storage: ...
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from typing import Any, Dict, IO, Iterator, Optional, Union
|
||||
from django.core.files import temp as tempfile
|
||||
from typing import Any, Dict, IO, Optional, Union
|
||||
|
||||
from django.core.files.base import File
|
||||
|
||||
class UploadedFile(File):
|
||||
@@ -39,8 +39,6 @@ class InMemoryUploadedFile(UploadedFile):
|
||||
charset: Optional[str],
|
||||
content_type_extra: Dict[str, str] = ...,
|
||||
) -> None: ...
|
||||
def chunks(self, chunk_size: Optional[int] = ...) -> Iterator[bytes]: ...
|
||||
def multiple_chunks(self, chunk_size: Optional[int] = ...) -> bool: ...
|
||||
|
||||
class SimpleUploadedFile(InMemoryUploadedFile):
|
||||
def __init__(self, name: str, content: Optional[Union[bytes, str]], content_type: str = ...) -> None: ...
|
||||
|
||||
0
django-stubs/core/mail/backends/__init__.pyi
Normal file
0
django-stubs/core/mail/backends/__init__.pyi
Normal file
16
django-stubs/core/mail/backends/base.pyi
Normal file
16
django-stubs/core/mail/backends/base.pyi
Normal file
@@ -0,0 +1,16 @@
|
||||
import types
|
||||
from typing import Any, TypeVar, Type, Iterable
|
||||
|
||||
from django.core.mail.message import EmailMessage
|
||||
|
||||
_T = TypeVar("_T", bound="BaseEmailBackend")
|
||||
|
||||
class BaseEmailBackend:
|
||||
def __init__(self, fail_silently: bool = ..., **kwargs: Any) -> None: ...
|
||||
def open(self) -> bool: ...
|
||||
def close(self) -> None: ...
|
||||
def __enter__(self: _T) -> _T: ...
|
||||
def __exit__(
|
||||
self, exc_type: Type[BaseException], exc_value: BaseException, traceback: types.TracebackType
|
||||
) -> None: ...
|
||||
def send_messages(self, email_messages: Iterable[EmailMessage]) -> int: ...
|
||||
@@ -1,7 +1,14 @@
|
||||
from collections import Callable
|
||||
|
||||
def supports_color() -> bool: ...
|
||||
|
||||
class Style: ...
|
||||
class Style:
|
||||
def DEBUG(self, text: str) -> str: ...
|
||||
def INFO(self, text: str) -> str: ...
|
||||
def SUCCESS(self, text: str) -> str: ...
|
||||
def WARNING(self, text: str) -> str: ...
|
||||
def ERROR(self, text: str) -> str: ...
|
||||
|
||||
def make_style(config_string: str = ...) -> Style: ...
|
||||
def no_style(): ...
|
||||
def no_style() -> Style: ...
|
||||
def color_style() -> Style: ...
|
||||
|
||||
0
django-stubs/core/management/commands/__init__.pyi
Normal file
0
django-stubs/core/management/commands/__init__.pyi
Normal file
4
django-stubs/core/management/commands/dumpdata.pyi
Normal file
4
django-stubs/core/management/commands/dumpdata.pyi
Normal file
@@ -0,0 +1,4 @@
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
class ProxyModelWarning(Warning): ...
|
||||
class Command(BaseCommand): ...
|
||||
19
django-stubs/core/management/commands/loaddata.pyi
Normal file
19
django-stubs/core/management/commands/loaddata.pyi
Normal file
@@ -0,0 +1,19 @@
|
||||
import zipfile
|
||||
from typing import Iterable, List, Optional, Tuple
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
READ_STDIN: str = ...
|
||||
|
||||
class Command(BaseCommand):
|
||||
missing_args_message: str = ...
|
||||
def loaddata(self, fixture_labels: Iterable[str]) -> None: ...
|
||||
def load_label(self, fixture_label: str) -> None: ...
|
||||
def find_fixtures(self, fixture_label: str) -> List[Optional[str]]: ...
|
||||
@property
|
||||
def fixture_dirs(self) -> List[str]: ...
|
||||
def parse_name(self, fixture_name: str) -> Tuple[str, str, str]: ...
|
||||
|
||||
class SingleZipReader(zipfile.ZipFile): ...
|
||||
|
||||
def humanize(dirname: str) -> str: ...
|
||||
3
django-stubs/core/management/commands/runserver.pyi
Normal file
3
django-stubs/core/management/commands/runserver.pyi
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
class Command(BaseCommand): ...
|
||||
3
django-stubs/core/management/commands/testserver.pyi
Normal file
3
django-stubs/core/management/commands/testserver.pyi
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
class Command(BaseCommand): ...
|
||||
Reference in New Issue
Block a user