littlefs-python 0.13.0__cp313-cp313-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
littlefs/__main__.py ADDED
@@ -0,0 +1,312 @@
1
+ import argparse
2
+ from contextlib import suppress
3
+ from pathlib import Path
4
+ import sys
5
+ import textwrap
6
+
7
+ from littlefs import LittleFS, __version__
8
+ from littlefs.errors import LittleFSError
9
+
10
+ # Dictionary mapping suffixes to their size in bytes
11
+ _suffix_map = {
12
+ "kb": 1024,
13
+ "mb": 1024**2,
14
+ "gb": 1024**3,
15
+ }
16
+
17
+
18
+ def _fs_from_args(args: argparse.Namespace, mount=True) -> LittleFS:
19
+ return LittleFS(
20
+ block_size=args.block_size,
21
+ block_count=getattr(args, "block_count", 0),
22
+ name_max=args.name_max,
23
+ mount=mount,
24
+ )
25
+
26
+
27
+ def size_parser(size_str):
28
+ """Parse filesystem / block size in different formats"""
29
+ size_str = str(size_str).lower()
30
+
31
+ # Check if the string starts with '0x', which indicates a hexadecimal number
32
+ if size_str.startswith("0x"):
33
+ base = 16
34
+ size_str = size_str[2:]
35
+ else:
36
+ base = 10
37
+
38
+ # Separate the size number and suffix
39
+ for suffix, multiplier in _suffix_map.items():
40
+ if size_str.endswith(suffix):
41
+ num_part = size_str[: -len(suffix)]
42
+ return int(num_part, base) * multiplier
43
+
44
+ # Handle base units; remove base suffix
45
+ if size_str.endswith("b"):
46
+ size_str = size_str[:-1]
47
+
48
+ # If no suffix, assume it's in bytes
49
+ return int(size_str, base)
50
+
51
+
52
+ def create(parser: argparse.ArgumentParser, args: argparse.Namespace) -> int:
53
+ """Create LittleFS image from file/directory contents."""
54
+ # fs_size OR block_count may be populated; make them consistent.
55
+ if args.block_count is None:
56
+ block_count = args.fs_size // args.block_size
57
+ if block_count * args.block_size != args.fs_size:
58
+ parser.error("fs-size must be a multiple of block-size.")
59
+ args.block_count = block_count
60
+ else:
61
+ args.fs_size = args.block_size * args.block_count
62
+
63
+ if args.verbose:
64
+ print("LittleFS Configuration:")
65
+ print(f" Block Size: {args.block_size:9d} / 0x{args.block_size:X}")
66
+ print(f" Image Size: {args.fs_size:9d} / 0x{args.fs_size:X}")
67
+ print(f" Block Count: {args.block_count:9d}")
68
+ print(f" Name Max: {args.name_max:9d}")
69
+ print(f" Image: {args.destination}")
70
+
71
+ source = Path(args.source).absolute()
72
+ if source.is_dir():
73
+ sources = source.rglob("*")
74
+ root = source
75
+ else:
76
+ sources = [source]
77
+ root = source.parent
78
+
79
+ fs = _fs_from_args(args)
80
+ for path in sources:
81
+ rel_path = path.relative_to(root)
82
+ if path.is_dir():
83
+ if args.verbose:
84
+ print("Adding Directory:", rel_path)
85
+ fs.mkdir(rel_path.as_posix())
86
+ else:
87
+ if args.verbose:
88
+ print("Adding File: ", rel_path)
89
+ with fs.open(rel_path.as_posix(), "wb") as dest:
90
+ dest.write(path.read_bytes())
91
+
92
+ if args.compact:
93
+ if args.verbose:
94
+ print(f"Compacting... {fs.used_block_count} / {args.block_count}")
95
+ compact_fs = LittleFS(
96
+ block_size=args.block_size,
97
+ block_count=fs.used_block_count,
98
+ name_max=args.name_max,
99
+ )
100
+ for root, dirs, files in fs.walk("/"):
101
+ if not root.endswith("/"):
102
+ root += "/"
103
+ for _dir in dirs:
104
+ compact_fs.makedirs(root + _dir, exist_ok=True)
105
+ for file in files:
106
+ path = root + file
107
+ print(path)
108
+ with fs.open(path, "rb") as src, compact_fs.open(path, "wb") as dest:
109
+ dest.write(src.read())
110
+ compact_fs.fs_grow(args.block_count)
111
+ data = compact_fs.context.buffer
112
+ if not args.no_pad:
113
+ data = data.ljust(args.fs_size, b"\xFF")
114
+ else:
115
+ data = fs.context.buffer
116
+
117
+ args.destination.parent.mkdir(exist_ok=True, parents=True)
118
+ args.destination.write_bytes(data)
119
+ return 0
120
+
121
+
122
+ def _list(parser: argparse.ArgumentParser, args: argparse.Namespace) -> int:
123
+ """List LittleFS image contents."""
124
+ fs = _fs_from_args(args, mount=False)
125
+ fs.context.buffer = bytearray(args.source.read_bytes())
126
+ fs.mount()
127
+
128
+ if args.verbose:
129
+ fs_size = len(fs.context.buffer)
130
+ print("LittleFS Configuration:")
131
+ print(f" Block Size: {args.block_size:9d} / 0x{args.block_size:X}")
132
+ print(f" Image Size: {fs_size:9d} / 0x{fs_size:X}")
133
+ print(f" Block Count: {fs.block_count:9d}")
134
+ print(f" Name Max: {args.name_max:9d}")
135
+ print(f" Image: {args.source}")
136
+
137
+ for root, dirs, files in fs.walk("/"):
138
+ if not root.endswith("/"):
139
+ root += "/"
140
+ for dir in dirs:
141
+ print(f"{root}{dir}")
142
+ for file in files:
143
+ print(f"{root}{file}")
144
+ return 0
145
+
146
+
147
+ def extract(parser: argparse.ArgumentParser, args: argparse.Namespace) -> int:
148
+ """Extract LittleFS image contents to a directory."""
149
+ fs = _fs_from_args(args, mount=False)
150
+ fs.context.buffer = bytearray(args.source.read_bytes())
151
+ fs.mount()
152
+
153
+ if args.verbose:
154
+ fs_size = len(fs.context.buffer)
155
+ print("LittleFS Configuration:")
156
+ print(f" Block Size: {args.block_size:9d} / 0x{args.block_size:X}")
157
+ print(f" Image Size: {fs_size:9d} / 0x{fs_size:X}")
158
+ print(f" Block Count: {fs.block_count:9d}")
159
+ print(f" Name Max: {args.name_max:9d}")
160
+ print(f" Image: {args.source}")
161
+
162
+ root_dest = args.destination.absolute()
163
+ if not root_dest.exists():
164
+ root_dest.mkdir(parents=True)
165
+ if not root_dest.is_dir():
166
+ print("Destination must be a directory.")
167
+ return 1
168
+
169
+ for root, dirs, files in fs.walk("/"):
170
+ if not root.endswith("/"):
171
+ root += "/"
172
+ for dir in dirs:
173
+ src_path = root + dir
174
+ dst_path = root_dest / src_path[1:]
175
+ if args.verbose:
176
+ print(src_path, dst_path)
177
+ assert root_dest in dst_path.parents
178
+ dst_path.mkdir(exist_ok=True)
179
+ for file in files:
180
+ src_path = root + file
181
+ dst_path = root_dest / src_path[1:]
182
+ if args.verbose:
183
+ print(src_path, dst_path)
184
+ assert root_dest in dst_path.parents
185
+ with fs.open(src_path, "rb") as src:
186
+ dst_path.write_bytes(src.read())
187
+
188
+ return 0
189
+
190
+
191
+ def get_parser():
192
+ if sys.argv[0].endswith("__main__.py"):
193
+ prog = f"python -m littlefs"
194
+ else:
195
+ prog = f"littlefs-python"
196
+
197
+ parser = argparse.ArgumentParser(
198
+ prog=prog,
199
+ description=textwrap.dedent(
200
+ """\
201
+ Create, extract and inspect LittleFS filesystem images. Use one of the
202
+ commands listed below, the '-h' / '--help' option can be used on each
203
+ command to learn more about the usage.
204
+ """
205
+ ),
206
+ # formatter_class=argparse.RawTextHelpFormatter,
207
+ )
208
+ parser.add_argument("--version", action="version", version=__version__)
209
+
210
+ common_parser = argparse.ArgumentParser(add_help=False)
211
+ common_parser.add_argument("-v", "--verbose", action="count", default=0)
212
+ common_parser.add_argument(
213
+ "--name-max",
214
+ type=size_parser,
215
+ default=255,
216
+ help="LittleFS max file path length. Defaults to LittleFS's default (255).",
217
+ )
218
+
219
+ subparsers = parser.add_subparsers(required=True, title="Available Commands", dest="command")
220
+
221
+ def add_command(handler, name="", help=""):
222
+ subparser = subparsers.add_parser(
223
+ name or handler.__name__, parents=[common_parser], help=help or handler.__doc__
224
+ )
225
+ subparser.set_defaults(func=handler)
226
+ return subparser
227
+
228
+ parser_create = add_command(create)
229
+ parser_create.add_argument(
230
+ "source",
231
+ type=Path,
232
+ help="Source file/directory-of-files to encode into a littlefs filesystem.",
233
+ )
234
+ parser_create.add_argument(
235
+ "destination",
236
+ type=Path,
237
+ nargs="?",
238
+ default=Path("lfs.bin"),
239
+ help="Output LittleFS filesystem binary image.",
240
+ )
241
+ parser_create.add_argument(
242
+ "--block-size",
243
+ type=size_parser,
244
+ required=True,
245
+ help="LittleFS block size.",
246
+ )
247
+ parser_create.add_argument(
248
+ "--compact",
249
+ action="store_true",
250
+ help="Store all data in the beginning blocks.",
251
+ )
252
+ parser_create.add_argument(
253
+ "--no-pad",
254
+ action="store_true",
255
+ help="Do not pad the binary to-size with 0xFF. Only valid with --compact.",
256
+ )
257
+ block_count_group = parser_create.add_mutually_exclusive_group(required=True)
258
+ block_count_group.add_argument(
259
+ "--block-count",
260
+ type=int,
261
+ help="LittleFS block count",
262
+ )
263
+ block_count_group.add_argument(
264
+ "--fs-size",
265
+ type=size_parser,
266
+ help="LittleFS filesystem size. Accepts byte units; e.g. 1MB and 1048576 are equivalent.",
267
+ )
268
+
269
+ parser_extract = add_command(extract)
270
+ parser_extract.add_argument(
271
+ "source",
272
+ type=Path,
273
+ help="Source LittleFS filesystem binary.",
274
+ )
275
+ parser_extract.add_argument(
276
+ "destination",
277
+ default=Path("."),
278
+ nargs="?",
279
+ type=Path,
280
+ help="Destination directory. Defaults to current directory.",
281
+ )
282
+ parser_extract.add_argument(
283
+ "--block-size",
284
+ type=size_parser,
285
+ required=True,
286
+ help="LittleFS block size.",
287
+ )
288
+
289
+ parser_list = add_command(_list, "list")
290
+ parser_list.add_argument(
291
+ "source",
292
+ type=Path,
293
+ help="Source LittleFS filesystem binary.",
294
+ )
295
+ parser_list.add_argument(
296
+ "--block-size",
297
+ type=size_parser,
298
+ help="LittleFS block size.",
299
+ )
300
+
301
+ return parser
302
+
303
+
304
+ def main():
305
+ parser = get_parser()
306
+ parser.parse_known_args(sys.argv[1:]) # Allows for ``littlefs-python --version``
307
+ args = parser.parse_args(sys.argv[1:])
308
+ return args.func(parser, args)
309
+
310
+
311
+ if __name__ == "__main__":
312
+ sys.exit(main())
littlefs/context.py ADDED
@@ -0,0 +1,171 @@
1
+ import logging
2
+ import typing
3
+ import ctypes
4
+
5
+ if typing.TYPE_CHECKING:
6
+ from .lfs import LFSConfig
7
+
8
+
9
+ class UserContext:
10
+ """Basic User Context Implementation"""
11
+
12
+ def __init__(self, buffsize: int) -> None:
13
+ self.buffer = bytearray([0xFF] * buffsize)
14
+
15
+ def read(self, cfg: "LFSConfig", block: int, off: int, size: int) -> bytearray:
16
+ """read data
17
+
18
+ Parameters
19
+ ----------
20
+ cfg : ~littlefs.lfs.LFSConfig
21
+ Filesystem configuration object
22
+ block : int
23
+ Block number to read
24
+ off : int
25
+ Offset from start of block
26
+ size : int
27
+ Number of bytes to read.
28
+ """
29
+ logging.getLogger(__name__).debug("LFS Read : Block: %d, Offset: %d, Size=%d" % (block, off, size))
30
+ start = block * cfg.block_size + off
31
+ end = start + size
32
+ return self.buffer[start:end]
33
+
34
+ def prog(self, cfg: "LFSConfig", block: int, off: int, data: bytes) -> int:
35
+ """program data
36
+
37
+ Parameters
38
+ ----------
39
+ cfg : ~littlefs.lfs.LFSConfig
40
+ Filesystem configuration object
41
+ block : int
42
+ Block number to program
43
+ off : int
44
+ Offset from start of block
45
+ data : bytes
46
+ Data to write
47
+ """
48
+ logging.getLogger(__name__).debug("LFS Prog : Block: %d, Offset: %d, Data=%r" % (block, off, data))
49
+ start = block * cfg.block_size + off
50
+ end = start + len(data)
51
+ self.buffer[start:end] = data
52
+ return 0
53
+
54
+ def erase(self, cfg: "LFSConfig", block: int) -> int:
55
+ """Erase a block
56
+
57
+ Parameters
58
+ ----------
59
+ cfg : ~littlefs.lfs.LFSConfig
60
+ Filesystem configuration object
61
+ block : int
62
+ Block number to read
63
+ """
64
+ logging.getLogger(__name__).debug("LFS Erase: Block: %d" % block)
65
+ start = block * cfg.block_size
66
+ end = start + cfg.block_size
67
+ self.buffer[start:end] = [0xFF] * cfg.block_size
68
+ return 0
69
+
70
+ def sync(self, cfg: "LFSConfig") -> int:
71
+ """Sync cached data
72
+
73
+ Parameters
74
+ ----------
75
+ cfg : ~littlefs.lfs.LFSConfig
76
+ Filesystem configuration object
77
+ """
78
+ return 0
79
+
80
+
81
+ try:
82
+ import win32file
83
+ except ImportError:
84
+ win32file = None
85
+
86
+
87
+ class UserContextWinDisk(UserContext):
88
+ """Windows disk/file context"""
89
+
90
+ def __init__(self, disk_path: str) -> None:
91
+ self.device = None #
92
+ # if the user does not have the pywin
93
+ if win32file == None:
94
+ raise ImportError(
95
+ "Unable to import 'win32file'. This module is required for Windows-specific functionality. Please ensure you are running on a Windows platform or install 'pywin32' using: 'pip install pywin32'."
96
+ )
97
+ self.device = win32file.CreateFile(
98
+ disk_path, win32file.GENERIC_READ, win32file.FILE_SHARE_READ, None, win32file.OPEN_EXISTING, 0, None
99
+ )
100
+ if self.device == win32file.INVALID_HANDLE_VALUE:
101
+ raise IOError("Could not open disk %s" % disk_path)
102
+
103
+ def read(self, cfg: "LFSConfig", block: int, off: int, size: int) -> bytearray:
104
+ """read data
105
+
106
+ Parameters
107
+ ----------
108
+ cfg : ~littlefs.lfs.LFSConfig
109
+ Filesystem configuration object
110
+ block : int
111
+ Block number to read
112
+ off : int
113
+ Offset from start of block
114
+ size : int
115
+ Number of bytes to read.
116
+ """
117
+ logging.getLogger(__name__).debug("LFS Read : Block: %d, Offset: %d, Size=%d" % (block, off, size))
118
+ start = block * cfg.block_size + off
119
+
120
+ win32file.SetFilePointer(self.device, start, win32file.FILE_BEGIN)
121
+ buffer = ctypes.create_string_buffer(size)
122
+ win32file.ReadFile(self.device, buffer)
123
+ # store the data in the buffer and close the buffer
124
+ data = buffer.raw
125
+ return data
126
+
127
+ def prog(self, cfg: "LFSConfig", block: int, off: int, data: bytes) -> int:
128
+ """program data
129
+
130
+ Parameters
131
+ ----------
132
+ cfg : ~littlefs.lfs.LFSConfig
133
+ Filesystem configuration object
134
+ block : int
135
+ Block number to program
136
+ off : int
137
+ Offset from start of block
138
+ data : bytes
139
+ Data to write
140
+ """
141
+ logging.getLogger(__name__).debug("LFS Prog : Block: %d, Offset: %d, Data=%r" % (block, off, data))
142
+ start = block * cfg.block_size + off
143
+
144
+ win32file.SetFilePointer(self.device, start, win32file.FILE_BEGIN)
145
+ win32file.WriteFile(self.device, data)
146
+ return 0
147
+
148
+ def erase(self, cfg: "LFSConfig", block: int) -> int:
149
+ """Erase a block
150
+
151
+ Parameters
152
+ ----------
153
+ cfg : ~littlefs.lfs.LFSConfig
154
+ Filesystem configuration object
155
+ block : int
156
+ Block number to read
157
+ """
158
+ logging.getLogger(__name__).debug("LFS Erase: Block: %d" % block)
159
+ start = block * cfg.block_size
160
+
161
+ win32file.SetFilePointer(self.device, start, win32file.FILE_BEGIN)
162
+ win32file.WriteFile(self.device, [0xFF] * cfg.block_size)
163
+ return 0
164
+
165
+ def sync(self, cfg: "LFSConfig") -> int:
166
+ win32file.FlushFileBuffers(self.device)
167
+ return 0
168
+
169
+ def __del__(self):
170
+ if self.device != None:
171
+ win32file.CloseHandle(self.device)
littlefs/errors.py ADDED
@@ -0,0 +1,37 @@
1
+ from enum import IntEnum
2
+
3
+
4
+ class LittleFSError(Exception):
5
+ class Error(IntEnum):
6
+ LFS_ERR_OK = 0 # No error
7
+ LFS_ERR_IO = -5 # Error during device operation
8
+ LFS_ERR_CORRUPT = -84 # Corrupted
9
+ LFS_ERR_NOENT = -2 # No directory entry
10
+ LFS_ERR_EXIST = -17 # Entry already exists
11
+ LFS_ERR_NOTDIR = -20 # Entry is not a dir
12
+ LFS_ERR_ISDIR = -21 # Entry is a dir
13
+ LFS_ERR_NOTEMPTY = -39 # Dir is not empty
14
+ LFS_ERR_BADF = -9 # Bad file number
15
+ LFS_ERR_FBIG = -27 # File too large
16
+ LFS_ERR_INVAL = -22 # Invalid parameter
17
+ LFS_ERR_NOSPC = -28 # No space left on device
18
+ LFS_ERR_NOMEM = -12 # No more memory available
19
+ LFS_ERR_NOATTR = -61 # No data/attr available
20
+ LFS_ERR_NAMETOOLONG = -36 # File name too long
21
+
22
+ def __init__(self, code: int):
23
+ super().__init__()
24
+ self.code = code
25
+
26
+ @property
27
+ def name(self) -> str:
28
+ try:
29
+ return self.Error(self.code).name
30
+ except ValueError:
31
+ return "ERR_UNKNOWN"
32
+
33
+ def __repr__(self) -> str:
34
+ return "<%s(%d)>" % (self.__class__.__name__, self.code)
35
+
36
+ def __str__(self) -> str:
37
+ return "LittleFSError %d: %s" % (self.code, self.name)
Binary file
littlefs/lfs.pyi ADDED
@@ -0,0 +1,114 @@
1
+ import enum
2
+ from typing import Tuple, NamedTuple, Optional, Union
3
+ from littlefs.context import UserContext
4
+
5
+ FILENAME_ENCODING: str = ...
6
+ __LFS_VERSION__: Tuple[int, int] = ...
7
+ __LFS_DISK_VERSION__: Tuple[int, int] = ...
8
+
9
+ class LFSStat(NamedTuple):
10
+ type: int
11
+ size: int
12
+ name: str
13
+
14
+ # Constants
15
+ TYPE_REG: int = ...
16
+ TYPE_DIR: int = ...
17
+
18
+ class LFSFSStat(NamedTuple):
19
+ """Littlefs filesystem status."""
20
+
21
+ disk_version: int
22
+ name_max: int
23
+ file_max: int
24
+ attr_max: int
25
+ block_count: int
26
+ block_size: int
27
+
28
+ class LFSFileFlag(enum.IntFlag): ...
29
+
30
+ class LFSConfig:
31
+ user_context: UserContext = ...
32
+
33
+ def __init__(
34
+ self,
35
+ context=None,
36
+ *,
37
+ block_size: int = 128,
38
+ block_count: int = 64,
39
+ read_size: int = 0,
40
+ prog_size: int = 0,
41
+ block_cycles: int = -1,
42
+ cache_size: int = 0,
43
+ lookahead_size: int = 8,
44
+ name_max: int = 255,
45
+ file_max: int = 0,
46
+ attr_max: int = 0,
47
+ metadata_max: int = 0,
48
+ disk_version: int = 0,
49
+ ) -> None: ...
50
+ @property
51
+ def read_size(self) -> int: ...
52
+ @property
53
+ def prog_size(self) -> int: ...
54
+ @property
55
+ def block_size(self) -> int: ...
56
+ @property
57
+ def block_count(self) -> int: ...
58
+ @property
59
+ def cache_size(self) -> int: ...
60
+ @property
61
+ def lookahead_size(self) -> int: ...
62
+ @property
63
+ def name_max(self) -> int: ...
64
+ @property
65
+ def file_max(self) -> int: ...
66
+ @property
67
+ def attr_max(self) -> int: ...
68
+
69
+ class LFSFilesystem:
70
+ @property
71
+ def block_count(self) -> int: ...
72
+
73
+ # The following classes are opaque wrappers around the actual handles
74
+ class LFSFile: ...
75
+ class LFSDirectory: ...
76
+
77
+ def fs_stat(fs: LFSFilesystem) -> LFSFSStat: ...
78
+ def fs_size(fs: LFSFilesystem) -> int: ...
79
+ def fs_gc(fs: LFSFilesystem) -> int: ...
80
+ def format(fs: LFSFilesystem, cfg: LFSConfig) -> int: ...
81
+ def mount(fs: LFSFilesystem, cfg: LFSConfig) -> int: ...
82
+ def unmount(fs: LFSFilesystem) -> int: ...
83
+ def fs_mkconsistent(fs: LFSFilesystem) -> int: ...
84
+ def fs_grow(fs: LFSFilesystem, block_count) -> int: ...
85
+ def remove(fs: LFSFilesystem, path: str) -> int: ...
86
+ def rename(fs: LFSFilesystem, oldpath: str, newpath: str) -> int: ...
87
+ def stat(fs: LFSFilesystem, path: str) -> LFSStat: ...
88
+
89
+ # Attributes
90
+ def getattr(fs: LFSFilesystem, path: str, typ) -> bytes: ...
91
+ def setattr(fs: LFSFilesystem, path: str, typ, data) -> None: ...
92
+ def removeattr(fs: LFSFilesystem, path: str, typ) -> None: ...
93
+
94
+ # File Handling
95
+ def file_open(fs: LFSFilesystem, path: str, flags: Union[str, LFSFileFlag]) -> LFSFile: ...
96
+
97
+ # def file_open_cfg(self, path, flags, config): ...
98
+ def file_close(fs: LFSFilesystem, fh: LFSFile) -> int: ...
99
+ def file_sync(fs: LFSFilesystem, fh: LFSFile) -> int: ...
100
+ def file_read(fs: LFSFilesystem, fh: LFSFile, size) -> bytes: ...
101
+ def file_write(fs: LFSFilesystem, fh: LFSFile, data) -> int: ...
102
+ def file_seek(fs: LFSFilesystem, fh: LFSFile, off, whence) -> int: ...
103
+ def file_truncate(fs: LFSFilesystem, fh: LFSFile, size) -> int: ...
104
+ def file_tell(fs: LFSFilesystem, fh: LFSFile) -> int: ...
105
+ def file_rewind(fs: LFSFilesystem, fh: LFSFile) -> int: ...
106
+ def file_size(fs: LFSFilesystem, fh: LFSFile) -> int: ...
107
+
108
+ # Directory Handling
109
+ def mkdir(fs: LFSFilesystem, path: str) -> int: ...
110
+ def dir_open(fs: LFSFilesystem, path: str) -> LFSDirectory: ...
111
+ def dir_close(fs: LFSFilesystem, dh: LFSDirectory) -> int: ...
112
+ def dir_read(fs: LFSFilesystem, dh: LFSDirectory) -> LFSStat: ...
113
+ def dir_tell(fs: LFSFilesystem, dh: LFSDirectory) -> int: ...
114
+ def dir_rewind(fs: LFSFilesystem, dh: LFSDirectory) -> int: ...
littlefs/py.typed ADDED
File without changes
@@ -0,0 +1,29 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2019, Jürg Rast
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ 3. Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.