Skip to content

Commit 45b6e01

Browse files
committed
Added type hints to storage
1 parent a88004e commit 45b6e01

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

shared-bindings/storage/__init__.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
//| directly."""
4444
//|
4545

46-
//| def mount(filesystem: Any, mount_path: Any, *, readonly: bool = False) -> Any:
46+
//| def mount(filesystem: VfsFat, mount_path: string, *, readonly: bool = False) -> None:
4747
//| """Mounts the given filesystem object at the given path.
4848
//|
4949
//| This is the CircuitPython analog to the UNIX ``mount`` command.
@@ -80,7 +80,7 @@ mp_obj_t storage_mount(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_arg
8080
}
8181
MP_DEFINE_CONST_FUN_OBJ_KW(storage_mount_obj, 2, storage_mount);
8282

83-
//| def umount(mount: Any) -> Any:
83+
//| def umount(mount: Union[string, VfsFat]) -> None:
8484
//| """Unmounts the given filesystem object or if *mount* is a path, then unmount
8585
//| the filesystem mounted at that location.
8686
//|
@@ -98,7 +98,7 @@ mp_obj_t storage_umount(mp_obj_t mnt_in) {
9898
}
9999
MP_DEFINE_CONST_FUN_OBJ_1(storage_umount_obj, storage_umount);
100100

101-
//| def remount(mount_path: Any, readonly: bool = False, *, disable_concurrent_write_protection: bool = False) -> Any:
101+
//| def remount(mount_path: string, readonly: bool = False, *, disable_concurrent_write_protection: bool = False) -> None:
102102
//| """Remounts the given path with new parameters.
103103
//|
104104
//| :param bool readonly: True when the filesystem should be readonly to CircuitPython.
@@ -128,7 +128,7 @@ mp_obj_t storage_remount(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_a
128128
}
129129
MP_DEFINE_CONST_FUN_OBJ_KW(storage_remount_obj, 1, storage_remount);
130130

131-
//| def getmount(mount_path: Any) -> Any:
131+
//| def getmount(mount_path: string) -> VfsFat:
132132
//| """Retrieves the mount object associated with the mount path"""
133133
//| ...
134134
//|
@@ -137,7 +137,7 @@ mp_obj_t storage_getmount(const mp_obj_t mnt_in) {
137137
}
138138
MP_DEFINE_CONST_FUN_OBJ_1(storage_getmount_obj, storage_getmount);
139139

140-
//| def erase_filesystem() -> Any:
140+
//| def erase_filesystem() -> None:
141141
//| """Erase and re-create the ``CIRCUITPY`` filesystem.
142142
//|
143143
//| On boards that present USB-visible ``CIRCUITPY`` drive (e.g., SAMD21 and SAMD51),
@@ -168,51 +168,51 @@ STATIC const mp_rom_map_elem_t storage_module_globals_table[] = {
168168
{ MP_ROM_QSTR(MP_QSTR_erase_filesystem), MP_ROM_PTR(&storage_erase_filesystem_obj) },
169169

170170
//| class VfsFat:
171-
//| def __init__(self, block_device: Any) -> None:
171+
//| def __init__(self, block_device: string) -> None:
172172
//| """Create a new VfsFat filesystem around the given block device.
173173
//|
174174
//| :param block_device: Block device the the filesystem lives on"""
175175
//|
176-
//| label: Any = ...
176+
//| label: string = ...
177177
//| """The filesystem label, up to 11 case-insensitive bytes. Note that
178178
//| this property can only be set when the device is writable by the
179179
//| microcontroller."""
180180
//| ...
181181
//|
182-
//| def mkfs(self) -> Any:
182+
//| def mkfs(self) -> None:
183183
//| """Format the block device, deleting any data that may have been there"""
184184
//| ...
185185
//|
186-
//| def open(self, path: Any, mode: Any) -> Any:
186+
//| def open(self, path: string, mode: string) -> None:
187187
//| """Like builtin ``open()``"""
188188
//| ...
189189
//|
190-
//| def ilistdir(self, path: Any) -> Any:
190+
//| def ilistdir(self, path: string) -> iterator:
191191
//| """Return an iterator whose values describe files and folders within
192192
//| ``path``"""
193193
//| ...
194194
//|
195-
//| def mkdir(self, path: Any) -> Any:
195+
//| def mkdir(self, path: string) -> None:
196196
//| """Like `os.mkdir`"""
197197
//| ...
198198
//|
199-
//| def rmdir(self, path: Any) -> Any:
199+
//| def rmdir(self, path: string) -> None:
200200
//| """Like `os.rmdir`"""
201201
//| ...
202202
//|
203-
//| def stat(self, path: Any) -> Any:
203+
//| def stat(self, path: string) -> string:
204204
//| """Like `os.stat`"""
205205
//| ...
206206
//|
207-
//| def statvfs(self, path: Any) -> Any:
207+
//| def statvfs(self, path: string) -> Tuple[string, string, string, string, string, string, string, string, string, string]:
208208
//| """Like `os.statvfs`"""
209209
//| ...
210210
//|
211-
//| def mount(self, readonly: Any, mkfs: Any) -> Any:
211+
//| def mount(self, readonly: bool, mkfs: VfsFat) -> None:
212212
//| """Don't call this directly, call `storage.mount`."""
213213
//| ...
214214
//|
215-
//| def umount(self) -> Any:
215+
//| def umount(self) -> None:
216216
//| """Don't call this directly, call `storage.umount`."""
217217
//| ...
218218
//|

0 commit comments

Comments
 (0)