add missing files throughout the codebase (#102)

This commit is contained in:
Maxim Kurnikov
2019-07-09 05:18:15 +03:00
committed by GitHub
parent d8230a4147
commit 2799646723
67 changed files with 748 additions and 120 deletions

View File

@@ -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: ...

View File

@@ -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: ...

View File

@@ -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: ...