File: base.pyi

package info (click to toggle)
python-django-stubs 5.2.9-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,832 kB
  • sloc: python: 5,185; makefile: 15; sh: 8
file content (53 lines) | stat: -rw-r--r-- 1,902 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
from collections.abc import Callable, Iterator
from types import TracebackType
from typing import IO, AnyStr, type_check_only

from django.core.files.utils import FileProxyMixin
from django.utils.functional import cached_property
from typing_extensions import Self

class File(FileProxyMixin[AnyStr], IO[AnyStr]):
    DEFAULT_CHUNK_SIZE: int
    file: IO[AnyStr] | None
    name: str | None
    mode: str
    def __init__(self, file: IO[AnyStr] | None, name: str | None = None) -> None: ...
    def __bool__(self) -> bool: ...
    def __len__(self) -> int: ...
    @cached_property
    def size(self) -> int: ...
    def chunks(self, chunk_size: int | None = None) -> Iterator[AnyStr]: ...
    def multiple_chunks(self, chunk_size: int | None = None) -> bool | None: ...
    def __iter__(self) -> Iterator[AnyStr]: ...
    def __enter__(self) -> Self: ...
    def __exit__(
        self,
        exc_type: type[BaseException] | None,
        exc_value: BaseException | None,
        exc_tb: TracebackType | None,
    ) -> None: ...
    def open(
        self,
        mode: str | None = None,
        buffering: int = -1,
        encoding: str | None = None,
        errors: str | None = None,
        newline: str | None = None,
        closefd: bool = True,
        opener: Callable[[str, int], int] | None = None,
    ) -> Self: ...
    def close(self) -> None: ...
    @type_check_only
    def __next__(self) -> AnyStr: ...

class ContentFile(File[AnyStr]):
    file: IO[AnyStr]
    def __init__(self, content: AnyStr, name: str | None = None) -> None: ...
    def __bool__(self) -> bool: ...
    def open(self, mode: str | None = None) -> Self: ...  # type: ignore[override]
    def close(self) -> None: ...
    def write(self, data: AnyStr) -> int: ...

def endswith_cr(line: bytes | str) -> bool: ...
def endswith_lf(line: bytes | str) -> bool: ...
def equals_lf(line: bytes | str) -> bool: ...