diff options
| author | dherrada <dylan.herrada@gmail.com> | 2020-05-11 13:40:02 -0400 |
|---|---|---|
| committer | dherrada <dylan.herrada@gmail.com> | 2020-05-11 13:40:02 -0400 |
| commit | 603df58f971743bc36b9e391cd5fb04812262533 (patch) | |
| tree | 1ea3eefab2ba5f8d133cde5996a1244c159579df /shared-bindings/storage | |
| parent | c7a9d49cba38499ec6701fdfef0c14e1dd5503a8 (diff) | |
Did stage, socket, storage
Diffstat (limited to 'shared-bindings/storage')
| -rw-r--r-- | shared-bindings/storage/__init__.c | 138 |
1 files changed, 69 insertions, 69 deletions
diff --git a/shared-bindings/storage/__init__.c b/shared-bindings/storage/__init__.c index ba439b951..feb1a9bd7 100644 --- a/shared-bindings/storage/__init__.c +++ b/shared-bindings/storage/__init__.c @@ -35,7 +35,7 @@ #include "shared-bindings/storage/__init__.h" #include "supervisor/shared/translate.h" -//| :mod:`storage` --- storage management +//| """:mod:`storage` --- storage management //| ======================================================== //| //| .. module:: storage @@ -45,16 +45,16 @@ //| The `storage` provides storage management functionality such as mounting and //| unmounting which is typically handled by the operating system hosting Python. //| CircuitPython does not have an OS, so this module provides this functionality -//| directly. +//| directly.""" //| -//| .. function:: mount(filesystem, mount_path, *, readonly=False) +//| def mount(filesystem: Any, mount_path: Any, *, readonly: bool = False) -> Any: +//| """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. -//| -//| :param bool readonly: True when the filesystem should be readonly to CircuitPython. +//| :param bool readonly: True when the filesystem should be readonly to CircuitPython.""" +//| ... //| mp_obj_t storage_mount(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_readonly }; @@ -85,12 +85,12 @@ 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); -//| .. function:: umount(mount) -//| -//| Unmounts the given filesystem object or if *mount* is a path, then unmount -//| the filesystem mounted at that location. +//| def umount(mount: Any) -> Any: +//| """Unmounts the given filesystem object or if *mount* is a path, then unmount +//| the filesystem mounted at that location. //| -//| This is the CircuitPython analog to the UNIX ``umount`` command. +//| This is the CircuitPython analog to the UNIX ``umount`` command.""" +//| ... //| mp_obj_t storage_umount(mp_obj_t mnt_in) { if (MP_OBJ_IS_STR(mnt_in)) { @@ -103,15 +103,15 @@ mp_obj_t storage_umount(mp_obj_t mnt_in) { } MP_DEFINE_CONST_FUN_OBJ_1(storage_umount_obj, storage_umount); -//| .. function:: remount(mount_path, readonly=False, *, disable_concurrent_write_protection=False) +//| def remount(mount_path: Any, readonly: bool = False, *, disable_concurrent_write_protection: bool = False) -> Any: +//| """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 disable_concurrent_write_protection: When True, the check that makes sure the -//| underlying filesystem data is written by one computer is disabled. Disabling the protection -//| allows CircuitPython and a host to write to the same filesystem with the risk that the -//| filesystem will be corrupted. +//| :param bool readonly: True when the filesystem should be readonly to CircuitPython. +//| :param bool disable_concurrent_write_protection: When True, the check that makes sure the +//| underlying filesystem data is written by one computer is disabled. Disabling the protection +//| allows CircuitPython and a host to write to the same filesystem with the risk that the +//| filesystem will be corrupted.""" +//| ... //| mp_obj_t storage_remount(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_readonly, ARG_disable_concurrent_write_protection }; @@ -133,28 +133,29 @@ 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); -//| .. function:: getmount(mount_path) -//| -//| Retrieves the mount object associated with the mount path +//| def getmount(mount_path: Any) -> Any: +//| """Retrieves the mount object associated with the mount path""" +//| ... //| mp_obj_t storage_getmount(const mp_obj_t mnt_in) { return common_hal_storage_getmount(mp_obj_str_get_str(mnt_in)); } MP_DEFINE_CONST_FUN_OBJ_1(storage_getmount_obj, storage_getmount); -//| .. function:: erase_filesystem() +//| def erase_filesystem() -> Any: +//| """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), +//| then call `microcontroller.reset()` to restart CircuitPython and have the +//| host computer remount CIRCUITPY. //| -//| On boards that present USB-visible ``CIRCUITPY`` drive (e.g., SAMD21 and SAMD51), -//| then call `microcontroller.reset()` to restart CircuitPython and have the -//| host computer remount CIRCUITPY. +//| This function can be called from the REPL when ``CIRCUITPY`` +//| has become corrupted. //| -//| This function can be called from the REPL when ``CIRCUITPY`` -//| has become corrupted. +//| .. warning:: All the data on ``CIRCUITPY`` will be lost, and +//| CircuitPython will restart on certain boards.""" +//| ... //| -//| .. warning:: All the data on ``CIRCUITPY`` will be lost, and -//| CircuitPython will restart on certain boards. mp_obj_t storage_erase_filesystem(void) { common_hal_storage_erase_filesystem(); @@ -171,54 +172,53 @@ STATIC const mp_rom_map_elem_t storage_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_getmount), MP_ROM_PTR(&storage_getmount_obj) }, { MP_ROM_QSTR(MP_QSTR_erase_filesystem), MP_ROM_PTR(&storage_erase_filesystem_obj) }, - //| .. class:: VfsFat(block_device) - //| - //| Create a new VfsFat filesystem around the given block device. - //| - //| :param block_device: Block device the the filesystem lives on - //| - //| .. attribute:: label - //| - //| The filesystem label, up to 11 case-insensitive bytes. Note that - //| this property can only be set when the device is writable by the - //| microcontroller. - //| - //| .. method:: mkfs() - //| - //| Format the block device, deleting any data that may have been there - //| - //| .. method:: open(path, mode) - //| - //| Like builtin ``open()`` - //| - //| .. method:: ilistdir([path]) - //| - //| Return an iterator whose values describe files and folders within - //| ``path`` - //| - //| .. method:: mkdir(path) + //| class VfsFat: + //| def __init__(self, block_device: Any): ... + //| """Create a new VfsFat filesystem around the given block device. //| - //| Like `os.mkdir` + //| :param block_device: Block device the the filesystem lives on""" //| - //| .. method:: rmdir(path) + //| label: Any = ... + //| """The filesystem label, up to 11 case-insensitive bytes. Note that + //| this property can only be set when the device is writable by the + //| microcontroller.""" //| - //| Like `os.rmdir` + //| def mkfs(self, ) -> Any: + //| """Format the block device, deleting any data that may have been there""" + //| ... //| - //| .. method:: stat(path) + //| def open(self, path: Any, mode: Any) -> Any: + //| """Like builtin ``open()``""" + //| ... //| - //| Like `os.stat` + //| def ilistdir(self, path: Any) -> Any: + //| """Return an iterator whose values describe files and folders within + //| ``path``""" + //| ... //| - //| .. method:: statvfs(path) + //| def mkdir(self, path: Any) -> Any: + //| """Like `os.mkdir`""" + //| ... //| - //| Like `os.statvfs` + //| def rmdir(self, path: Any) -> Any: + //| """Like `os.rmdir`""" + //| ... //| - //| .. method:: mount(readonly, mkfs) + //| def stat(self, path: Any) -> Any: + //| """Like `os.stat`""" + //| ... //| - //| Don't call this directly, call `storage.mount`. + //| def statvfs(self, path: Any) -> Any: + //| """Like `os.statvfs`""" + //| ... //| - //| .. method:: umount() + //| def mount(self, readonly: Any, mkfs: Any) -> Any: + //| """Don't call this directly, call `storage.mount`.""" + //| ... //| - //| Don't call this directly, call `storage.umount`. + //| def umount(self, ) -> Any: + //| """Don't call this directly, call `storage.umount`.""" + //| ... //| { MP_ROM_QSTR(MP_QSTR_VfsFat), MP_ROM_PTR(&mp_fat_vfs_type) }, }; |
