mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-15 16:27:09 +08:00
some stubs
This commit is contained in:
@@ -1,27 +1,34 @@
|
||||
# Stubs for django.core.files.base (Python 3.5)
|
||||
from io import StringIO
|
||||
from typing import Any, Iterator, Optional, Union
|
||||
|
||||
from typing import Any, Iterable, Iterator, Optional, Sized, Union
|
||||
from django.core.files.utils import FileProxyMixin
|
||||
|
||||
class File(FileProxyMixin, Sized, Iterable[bytes]):
|
||||
DEFAULT_CHUNK_SIZE = ... # type: int
|
||||
file = ... # type: Any
|
||||
name: Optional[str] = ... # type: ignore
|
||||
mode = ... # type: str
|
||||
size = ... # type: int
|
||||
def __init__(self, file: Any, name: str = None) -> None: ...
|
||||
@property
|
||||
def closed(self) -> bool: ...
|
||||
def chunks(self, chunk_size: int = None) -> Iterator[bytes]: ...
|
||||
def multiple_chunks(self, chunk_size: int = None) -> bool: ...
|
||||
def __enter__(self) -> "File": ...
|
||||
def __exit__(self, t: type = None, value: BaseException = None, traceback: Any = None) -> bool: ...
|
||||
def open(self, mode: str = None) -> None: ...
|
||||
class File(FileProxyMixin):
|
||||
DEFAULT_CHUNK_SIZE: Any = ...
|
||||
file: StringIO = ...
|
||||
name: Optional[str] = ...
|
||||
mode: str = ...
|
||||
def __init__(self, file: Any, name: Optional[str] = ...) -> None: ...
|
||||
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 __iter__(self) -> Iterator[Union[bytes, str]]: ...
|
||||
def __enter__(self) -> File: ...
|
||||
def __exit__(self, exc_type: None, exc_value: None, tb: None) -> None: ...
|
||||
def open(self, mode: Optional[str] = ...) -> File: ...
|
||||
def close(self) -> None: ...
|
||||
|
||||
class ContentFile(File):
|
||||
def __init__(self, content: Union[str, bytes], name: Optional[str] = None) -> None: ...
|
||||
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: Union[str, bytes]) -> bool: ...
|
||||
def endswith_lf(line: Union[str, bytes]) -> bool: ...
|
||||
def equals_lf(line: Union[str, bytes]) -> bool: ...
|
||||
def endswith_cr(line: bytes) -> bool: ...
|
||||
def endswith_lf(line: Union[bytes, str]) -> bool: ...
|
||||
def equals_lf(line: bytes) -> bool: ...
|
||||
|
||||
@@ -1,7 +1,23 @@
|
||||
from typing import BinaryIO, Any, Optional, Tuple, Union
|
||||
from typing import Any
|
||||
|
||||
class FileProxyMixin(BinaryIO):
|
||||
|
||||
newlines = ... # type: Union[str, Tuple[str, ...], None]
|
||||
softspace = ... # type: bool
|
||||
def readinto(self, b: Any) -> Optional[int]: ...
|
||||
class FileProxyMixin:
|
||||
encoding: Any = ...
|
||||
fileno: Any = ...
|
||||
flush: Any = ...
|
||||
isatty: Any = ...
|
||||
newlines: Any = ...
|
||||
read: Any = ...
|
||||
readinto: Any = ...
|
||||
readline: Any = ...
|
||||
readlines: Any = ...
|
||||
seek: Any = ...
|
||||
tell: Any = ...
|
||||
truncate: Any = ...
|
||||
write: Any = ...
|
||||
writelines: Any = ...
|
||||
@property
|
||||
def closed(self) -> bool: ...
|
||||
def readable(self) -> bool: ...
|
||||
def writable(self) -> bool: ...
|
||||
def seekable(self) -> bool: ...
|
||||
def __iter__(self): ...
|
||||
|
||||
Reference in New Issue
Block a user