|
| 1 | +import io |
| 2 | +from typing import ( |
| 3 | + Iterator, |
| 4 | + List, |
| 5 | + Literal, |
| 6 | + Optional, |
| 7 | + Tuple, |
| 8 | + Union, |
| 9 | + overload, |
| 10 | +) |
| 11 | + |
| 12 | +from _typeshed import ( |
| 13 | + OpenBinaryMode, |
| 14 | + OpenBinaryModeReading, |
| 15 | + OpenBinaryModeUpdating, |
| 16 | + OpenBinaryModeWriting, |
| 17 | + OpenTextMode, |
| 18 | +) |
| 19 | +from littlefs.context import UserContext as UserContext |
| 20 | +from littlefs.errors import LittleFSError as LittleFSError |
| 21 | +from littlefs.lfs import LFSConfig as LFSConfig |
| 22 | +from littlefs.lfs import LFSFileFlag as LFSFileFlag |
| 23 | +from littlefs.lfs import LFSFSStat as LFSFSStat |
| 24 | +from littlefs.lfs import LFSStat as LFSStat |
| 25 | + |
| 26 | +class LittleFS: |
| 27 | + cfg: LFSConfig |
| 28 | + |
| 29 | + @property |
| 30 | + def block_count(self) -> int: ... |
| 31 | + @property |
| 32 | + def used_block_count(self) -> int: ... |
| 33 | + def __init__( |
| 34 | + self, context: Optional["UserContext"] = None, mount: bool = True, **kwargs: int |
| 35 | + ) -> None: ... |
| 36 | + @overload |
| 37 | + def open( |
| 38 | + self, |
| 39 | + fname: str, |
| 40 | + mode: OpenTextMode = "r", |
| 41 | + buffering: int = -1, |
| 42 | + encoding: Optional[str] = None, |
| 43 | + errors: Optional[str] = None, |
| 44 | + newline: Optional[str] = None, |
| 45 | + ) -> io.TextIOWrapper: ... |
| 46 | + @overload |
| 47 | + def open( |
| 48 | + self, |
| 49 | + fname: str, |
| 50 | + mode: OpenBinaryMode, |
| 51 | + buffering: Literal[0], |
| 52 | + encoding: None = None, |
| 53 | + errors: None = None, |
| 54 | + newline: None = None, |
| 55 | + ) -> io.RawIOBase: ... |
| 56 | + @overload |
| 57 | + def open( |
| 58 | + self, |
| 59 | + fname: str, |
| 60 | + mode: OpenBinaryModeUpdating, |
| 61 | + buffering: Literal[-1, 1] = -1, |
| 62 | + encoding: None = None, |
| 63 | + errors: None = None, |
| 64 | + newline: None = None, |
| 65 | + ) -> io.BufferedRandom: ... |
| 66 | + @overload |
| 67 | + def open( |
| 68 | + self, |
| 69 | + fname: str, |
| 70 | + mode: OpenBinaryModeWriting, |
| 71 | + buffering: Literal[-1, 1] = -1, |
| 72 | + encoding: None = None, |
| 73 | + errors: None = None, |
| 74 | + newline: None = None, |
| 75 | + ) -> io.BufferedWriter: ... |
| 76 | + @overload |
| 77 | + def open( |
| 78 | + self, |
| 79 | + fname: str, |
| 80 | + mode: OpenBinaryModeReading, |
| 81 | + buffering: Literal[-1, 1] = -1, |
| 82 | + encoding: None = None, |
| 83 | + errors: None = None, |
| 84 | + newline: None = None, |
| 85 | + ) -> io.BufferedReader: ... |
| 86 | + @overload |
| 87 | + def open( |
| 88 | + self, |
| 89 | + fname: str, |
| 90 | + mode: str = "r", |
| 91 | + buffering: int = -1, |
| 92 | + encoding: Optional[str] = None, |
| 93 | + errors: Optional[str] = None, |
| 94 | + newline: Optional[str] = None, |
| 95 | + ) -> Union[io.BufferedIOBase, io.TextIOWrapper, io.RawIOBase]: ... |
| 96 | + def stat(self, path: str) -> LFSStat: ... |
| 97 | + def remove(self, path: str, recursive: bool = False) -> None: ... |
| 98 | + def rename(self, oldpath: str, newpath: str) -> int: ... |
| 99 | + def mount(self) -> int: ... |
| 100 | + def unmount(self) -> int: ... |
| 101 | + def fs_stat(self) -> LFSFSStat: ... |
| 102 | + def fs_grow(self, block_count: int) -> int: ... |
| 103 | + def walk(self, top: str) -> Iterator[Tuple[str, List[str], List[str]]]: ... |
| 104 | + def makedirs(self, name: str, exist_ok: bool = False) -> None: ... |
| 105 | + def format(self) -> int: ... |
0 commit comments