Added type hints to storage
This commit is contained in:
parent
a88004e509
commit
45b6e0174e
|
@ -43,7 +43,7 @@
|
||||||
//| directly."""
|
//| directly."""
|
||||||
//|
|
//|
|
||||||
|
|
||||||
//| def mount(filesystem: Any, mount_path: Any, *, readonly: bool = False) -> Any:
|
//| def mount(filesystem: VfsFat, mount_path: string, *, readonly: bool = False) -> None:
|
||||||
//| """Mounts the given filesystem object at the given path.
|
//| """Mounts the given filesystem object at the given path.
|
||||||
//|
|
//|
|
||||||
//| This is the CircuitPython analog to the UNIX ``mount`` command.
|
//| 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
|
||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_KW(storage_mount_obj, 2, storage_mount);
|
MP_DEFINE_CONST_FUN_OBJ_KW(storage_mount_obj, 2, storage_mount);
|
||||||
|
|
||||||
//| def umount(mount: Any) -> Any:
|
//| def umount(mount: Union[string, VfsFat]) -> None:
|
||||||
//| """Unmounts the given filesystem object or if *mount* is a path, then unmount
|
//| """Unmounts the given filesystem object or if *mount* is a path, then unmount
|
||||||
//| the filesystem mounted at that location.
|
//| the filesystem mounted at that location.
|
||||||
//|
|
//|
|
||||||
|
@ -98,7 +98,7 @@ mp_obj_t storage_umount(mp_obj_t mnt_in) {
|
||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_1(storage_umount_obj, storage_umount);
|
MP_DEFINE_CONST_FUN_OBJ_1(storage_umount_obj, storage_umount);
|
||||||
|
|
||||||
//| def remount(mount_path: Any, readonly: bool = False, *, disable_concurrent_write_protection: bool = False) -> Any:
|
//| def remount(mount_path: string, readonly: bool = False, *, disable_concurrent_write_protection: bool = False) -> None:
|
||||||
//| """Remounts the given path with new parameters.
|
//| """Remounts the given path with new parameters.
|
||||||
//|
|
//|
|
||||||
//| :param bool readonly: True when the filesystem should be readonly to CircuitPython.
|
//| :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
|
||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_KW(storage_remount_obj, 1, storage_remount);
|
MP_DEFINE_CONST_FUN_OBJ_KW(storage_remount_obj, 1, storage_remount);
|
||||||
|
|
||||||
//| def getmount(mount_path: Any) -> Any:
|
//| def getmount(mount_path: string) -> VfsFat:
|
||||||
//| """Retrieves the mount object associated with the mount path"""
|
//| """Retrieves the mount object associated with the mount path"""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
|
@ -137,7 +137,7 @@ mp_obj_t storage_getmount(const mp_obj_t mnt_in) {
|
||||||
}
|
}
|
||||||
MP_DEFINE_CONST_FUN_OBJ_1(storage_getmount_obj, storage_getmount);
|
MP_DEFINE_CONST_FUN_OBJ_1(storage_getmount_obj, storage_getmount);
|
||||||
|
|
||||||
//| def erase_filesystem() -> Any:
|
//| def erase_filesystem() -> None:
|
||||||
//| """Erase and re-create the ``CIRCUITPY`` filesystem.
|
//| """Erase and re-create the ``CIRCUITPY`` filesystem.
|
||||||
//|
|
//|
|
||||||
//| On boards that present USB-visible ``CIRCUITPY`` drive (e.g., SAMD21 and SAMD51),
|
//| 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[] = {
|
||||||
{ MP_ROM_QSTR(MP_QSTR_erase_filesystem), MP_ROM_PTR(&storage_erase_filesystem_obj) },
|
{ MP_ROM_QSTR(MP_QSTR_erase_filesystem), MP_ROM_PTR(&storage_erase_filesystem_obj) },
|
||||||
|
|
||||||
//| class VfsFat:
|
//| class VfsFat:
|
||||||
//| def __init__(self, block_device: Any) -> None:
|
//| def __init__(self, block_device: string) -> None:
|
||||||
//| """Create a new VfsFat filesystem around the given block device.
|
//| """Create a new VfsFat filesystem around the given block device.
|
||||||
//|
|
//|
|
||||||
//| :param block_device: Block device the the filesystem lives on"""
|
//| :param block_device: Block device the the filesystem lives on"""
|
||||||
//|
|
//|
|
||||||
//| label: Any = ...
|
//| label: string = ...
|
||||||
//| """The filesystem label, up to 11 case-insensitive bytes. Note that
|
//| """The filesystem label, up to 11 case-insensitive bytes. Note that
|
||||||
//| this property can only be set when the device is writable by the
|
//| this property can only be set when the device is writable by the
|
||||||
//| microcontroller."""
|
//| microcontroller."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def mkfs(self) -> Any:
|
//| def mkfs(self) -> None:
|
||||||
//| """Format the block device, deleting any data that may have been there"""
|
//| """Format the block device, deleting any data that may have been there"""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def open(self, path: Any, mode: Any) -> Any:
|
//| def open(self, path: string, mode: string) -> None:
|
||||||
//| """Like builtin ``open()``"""
|
//| """Like builtin ``open()``"""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def ilistdir(self, path: Any) -> Any:
|
//| def ilistdir(self, path: string) -> iterator:
|
||||||
//| """Return an iterator whose values describe files and folders within
|
//| """Return an iterator whose values describe files and folders within
|
||||||
//| ``path``"""
|
//| ``path``"""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def mkdir(self, path: Any) -> Any:
|
//| def mkdir(self, path: string) -> None:
|
||||||
//| """Like `os.mkdir`"""
|
//| """Like `os.mkdir`"""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def rmdir(self, path: Any) -> Any:
|
//| def rmdir(self, path: string) -> None:
|
||||||
//| """Like `os.rmdir`"""
|
//| """Like `os.rmdir`"""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def stat(self, path: Any) -> Any:
|
//| def stat(self, path: string) -> string:
|
||||||
//| """Like `os.stat`"""
|
//| """Like `os.stat`"""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def statvfs(self, path: Any) -> Any:
|
//| def statvfs(self, path: string) -> Tuple[string, string, string, string, string, string, string, string, string, string]:
|
||||||
//| """Like `os.statvfs`"""
|
//| """Like `os.statvfs`"""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def mount(self, readonly: Any, mkfs: Any) -> Any:
|
//| def mount(self, readonly: bool, mkfs: VfsFat) -> None:
|
||||||
//| """Don't call this directly, call `storage.mount`."""
|
//| """Don't call this directly, call `storage.mount`."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
//| def umount(self) -> Any:
|
//| def umount(self) -> None:
|
||||||
//| """Don't call this directly, call `storage.umount`."""
|
//| """Don't call this directly, call `storage.umount`."""
|
||||||
//| ...
|
//| ...
|
||||||
//|
|
//|
|
||||||
|
|
Loading…
Reference in New Issue