mirror of
https://github.com/davidhalter/django-stubs.git
synced 2026-09-22 03:33:18 +08:00
reformat with black
This commit is contained in:
@@ -6,6 +6,7 @@ from django.core.files.utils import FileProxyMixin
|
||||
from typing import Any, Optional
|
||||
|
||||
from typing import Any, Iterator, Optional, Union
|
||||
|
||||
class File(FileProxyMixin):
|
||||
DEFAULT_CHUNK_SIZE: Any = ...
|
||||
file: Any = ...
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
from io import BufferedRandom
|
||||
from typing import Union
|
||||
|
||||
|
||||
def _fd(f: Union[BufferedRandom, int]) -> int: ...
|
||||
|
||||
|
||||
def lock(f: Union[BufferedRandom, int], flags: int) -> bool: ...
|
||||
|
||||
|
||||
def unlock(f: int) -> bool: ...
|
||||
def unlock(f: int) -> bool: ...
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
def _samefile(src: str, dst: str) -> bool: ...
|
||||
|
||||
|
||||
def file_move_safe(
|
||||
old_file_name: str,
|
||||
new_file_name: str,
|
||||
chunk_size: int = ...,
|
||||
allow_overwrite: bool = ...
|
||||
) -> None: ...
|
||||
allow_overwrite: bool = ...,
|
||||
) -> None: ...
|
||||
|
||||
@@ -1,35 +1,24 @@
|
||||
from io import StringIO
|
||||
from datetime import datetime
|
||||
from django.core.files.base import File
|
||||
from typing import (
|
||||
Any,
|
||||
List,
|
||||
Optional,
|
||||
Tuple,
|
||||
Type,
|
||||
Union,
|
||||
)
|
||||
|
||||
from typing import Any, List, Optional, Tuple, Type, Union
|
||||
|
||||
def get_storage_class(import_path: Optional[str] = ...) -> Type[Storage]: ...
|
||||
|
||||
|
||||
class FileSystemStorage:
|
||||
def __init__(
|
||||
self,
|
||||
location: Optional[str] = ...,
|
||||
base_url: Optional[str] = ...,
|
||||
file_permissions_mode: Optional[int] = ...,
|
||||
directory_permissions_mode: Optional[int] = ...
|
||||
directory_permissions_mode: Optional[int] = ...,
|
||||
) -> None: ...
|
||||
def _clear_cached_properties(self, setting: str, **kwargs) -> None: ...
|
||||
def _datetime_from_timestamp(self, ts: float) -> datetime: ...
|
||||
def _open(self, name: str, mode: str = ...) -> File: ...
|
||||
def _save(self, name: str, content: File) -> str: ...
|
||||
def _value_or_setting(
|
||||
self,
|
||||
value: Optional[Union[str, int]],
|
||||
setting: Optional[Union[str, int]]
|
||||
self, value: Optional[Union[str, int]], setting: Optional[Union[str, int]]
|
||||
) -> Optional[Union[str, int]]: ...
|
||||
@cached_property
|
||||
def base_location(self) -> str: ...
|
||||
@@ -45,16 +34,19 @@ class FileSystemStorage:
|
||||
def get_created_time(self, name: str) -> datetime: ...
|
||||
def get_modified_time(self, name: str) -> datetime: ...
|
||||
def listdir(
|
||||
self,
|
||||
path: str
|
||||
) -> Union[Tuple[List[str], List[Any]], Tuple[List[Any], List[Any]], Tuple[List[Any], List[str]], Tuple[List[str], List[str]]]: ...
|
||||
self, path: str
|
||||
) -> Union[
|
||||
Tuple[List[str], List[Any]],
|
||||
Tuple[List[Any], List[Any]],
|
||||
Tuple[List[Any], List[str]],
|
||||
Tuple[List[str], List[str]],
|
||||
]: ...
|
||||
@cached_property
|
||||
def location(self) -> str: ...
|
||||
def path(self, name: str) -> str: ...
|
||||
def size(self, name: str) -> int: ...
|
||||
def url(self, name: str) -> str: ...
|
||||
|
||||
|
||||
class Storage:
|
||||
def generate_filename(self, filename: str) -> str: ...
|
||||
def get_available_name(self, name: str, max_length: Optional[int] = ...) -> str: ...
|
||||
@@ -64,5 +56,5 @@ class Storage:
|
||||
self,
|
||||
name: Optional[str],
|
||||
content: Union[StringIO, File],
|
||||
max_length: Optional[int] = ...
|
||||
) -> str: ...
|
||||
max_length: Optional[int] = ...,
|
||||
) -> str: ...
|
||||
|
||||
@@ -8,12 +8,21 @@ from typing import Any, Optional
|
||||
from io import BytesIO, StringIO
|
||||
from tempfile import _TemporaryFileWrapper
|
||||
from typing import Iterator, Optional, Union
|
||||
|
||||
class UploadedFile(File):
|
||||
size: Any = ...
|
||||
content_type: Any = ...
|
||||
charset: Any = ...
|
||||
content_type_extra: Any = ...
|
||||
def __init__(self, file: Optional[Union[StringIO, _TemporaryFileWrapper, BytesIO]] = ..., name: str = ..., content_type: str = ..., size: Optional[int] = ..., charset: Optional[str] = ..., content_type_extra: None = ...) -> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
file: Optional[Union[StringIO, _TemporaryFileWrapper, BytesIO]] = ...,
|
||||
name: str = ...,
|
||||
content_type: str = ...,
|
||||
size: Optional[int] = ...,
|
||||
charset: Optional[str] = ...,
|
||||
content_type_extra: None = ...,
|
||||
) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def _get_name(self) -> str: ...
|
||||
_name: Any = ...
|
||||
@@ -21,18 +30,36 @@ class UploadedFile(File):
|
||||
name: Any = ...
|
||||
|
||||
class TemporaryUploadedFile(UploadedFile):
|
||||
def __init__(self, name: str, content_type: str, size: int, charset: str, content_type_extra: None = ...) -> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
name: str,
|
||||
content_type: str,
|
||||
size: int,
|
||||
charset: str,
|
||||
content_type_extra: None = ...,
|
||||
) -> None: ...
|
||||
def temporary_file_path(self) -> str: ...
|
||||
def close(self) -> None: ...
|
||||
|
||||
class InMemoryUploadedFile(UploadedFile):
|
||||
field_name: Any = ...
|
||||
def __init__(self, file: Union[StringIO, BytesIO], field_name: Optional[str], name: str, content_type: str, size: int, charset: Optional[str], content_type_extra: None = ...) -> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
file: Union[StringIO, BytesIO],
|
||||
field_name: Optional[str],
|
||||
name: str,
|
||||
content_type: str,
|
||||
size: int,
|
||||
charset: Optional[str],
|
||||
content_type_extra: None = ...,
|
||||
) -> None: ...
|
||||
def open(self, mode: None = ...) -> InMemoryUploadedFile: ...
|
||||
def chunks(self, chunk_size: None = ...) -> Iterator[Union[str, bytes]]: ...
|
||||
def multiple_chunks(self, chunk_size: Optional[Any] = ...): ...
|
||||
|
||||
class SimpleUploadedFile(InMemoryUploadedFile):
|
||||
def __init__(self, name: str, content: Optional[bytes], content_type: str = ...) -> None: ...
|
||||
def __init__(
|
||||
self, name: str, content: Optional[bytes], content_type: str = ...
|
||||
) -> None: ...
|
||||
@classmethod
|
||||
def from_dict(cls, file_dict: Any): ...
|
||||
|
||||
@@ -8,6 +8,7 @@ from io import BytesIO
|
||||
from django.core.files.uploadedfile import InMemoryUploadedFile, TemporaryUploadedFile
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
class UploadFileException(Exception): ...
|
||||
|
||||
class StopUpload(UploadFileException):
|
||||
@@ -27,9 +28,24 @@ class FileUploadHandler:
|
||||
content_type_extra: Any = ...
|
||||
request: Any = ...
|
||||
def __init__(self, request: WSGIRequest = ...) -> None: ...
|
||||
def handle_raw_input(self, input_data: WSGIRequest, META: Dict[str, Any], content_length: int, boundary: bytes, encoding: str = ...) -> None: ...
|
||||
def handle_raw_input(
|
||||
self,
|
||||
input_data: WSGIRequest,
|
||||
META: Dict[str, Any],
|
||||
content_length: int,
|
||||
boundary: bytes,
|
||||
encoding: str = ...,
|
||||
) -> None: ...
|
||||
field_name: Any = ...
|
||||
def new_file(self, field_name: str, file_name: str, content_type: str, content_length: None, charset: None = ..., content_type_extra: Dict[Any, Any] = ...) -> None: ...
|
||||
def new_file(
|
||||
self,
|
||||
field_name: str,
|
||||
file_name: str,
|
||||
content_type: str,
|
||||
content_length: None,
|
||||
charset: None = ...,
|
||||
content_type_extra: Dict[Any, Any] = ...,
|
||||
) -> None: ...
|
||||
def receive_data_chunk(self, raw_data: Any, start: Any) -> None: ...
|
||||
def file_complete(self, file_size: Any) -> None: ...
|
||||
def upload_complete(self) -> None: ...
|
||||
@@ -42,7 +58,14 @@ class TemporaryFileUploadHandler(FileUploadHandler):
|
||||
|
||||
class MemoryFileUploadHandler(FileUploadHandler):
|
||||
activated: Any = ...
|
||||
def handle_raw_input(self, input_data: Union[BytesIO, WSGIRequest], META: Dict[str, Any], content_length: int, boundary: bytes, encoding: str = ...) -> None: ...
|
||||
def handle_raw_input(
|
||||
self,
|
||||
input_data: Union[BytesIO, WSGIRequest],
|
||||
META: Dict[str, Any],
|
||||
content_length: int,
|
||||
boundary: bytes,
|
||||
encoding: str = ...,
|
||||
) -> None: ...
|
||||
file: Any = ...
|
||||
def new_file(self, *args: Any, **kwargs: Any) -> None: ...
|
||||
def receive_data_chunk(self, raw_data: bytes, start: int) -> Optional[bytes]: ...
|
||||
|
||||
Reference in New Issue
Block a user