Skip to content

Commit

Permalink
Merge pull request #502 from PyFilesystem/update-docs
Browse files Browse the repository at this point in the history
Update documentation for `v2.4.14`
  • Loading branch information
althonos committed Nov 16, 2021
2 parents f3ffa94 + 86c5370 commit b71cacd
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Many thanks to the following developers for contributing to this project:
- [Andreas Tollkötter](https://github.com/atollk)
- [Andrew Scheller](https://github.com/lurch)
- [Andrey Serov](https://github.com/zmej-serow)
- [Ben Lindsay](https://github.com/benlindsay)
- [Bernhard M. Wiedemann](https://github.com/bmwiedemann)
- [@chfw](https://github.com/chfw)
- [Dafna Hirschfeld](https://github.com/kamomil)
Expand All @@ -17,6 +18,7 @@ Many thanks to the following developers for contributing to this project:
- [George Macon](https://github.com/gmacon)
- [Giampaolo Cimino](https://github.com/gpcimino)
- [@Hoboneer](https://github.com/Hoboneer)
- [Jon Hagg](https://github.com/jon-hagg)
- [Joseph Atkins-Turkish](https://github.com/Spacerat)
- [Joshua Tauberer](https://github.com/JoshData)
- [Justin Charlong](https://github.com/jcharlong)
Expand Down
3 changes: 2 additions & 1 deletion docs/source/extension.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ Here's an example taken from an Amazon S3 Filesystem::

__all__ = ['S3FSOpener']

from fs.opener import Opener, OpenerError
from fs.opener import Opener
from fs.opener.errors import OpenerError

from ._s3fs import S3FS

Expand Down
22 changes: 22 additions & 0 deletions docs/source/openers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,25 @@ To open a filesysem with a FS URL, you can use :meth:`~fs.opener.registry.Regist

from fs import open_fs
projects_fs = open_fs('osfs://~/projects')


Manually registering Openers
----------------------------

The ``fs.opener`` registry uses an entry point to install external openers
(see :ref:`extension`), and it does so once, when you import `fs` for the first
time. In some rare cases where entry points are not available (for instance,
when running an embedded interpreter) or when extensions are installed *after*
the interpreter has started (for instance in a notebook, see
`PyFilesystem2#485 <https://github.com/PyFilesystem/pyfilesystem2/issues/485>`_).

However, a new opener can be installed manually at any time with the
`fs.opener.registry.install` method. For instance, here's how the opener for
the `s3fs <https://github.com/PyFilesystem/s3fs>`_ extension can be added to
the registry::

import fs.opener
from fs_s3fs.opener import S3FSOpener

fs.opener.registry.install(S3FSOpener)
# fs.open_fs("s3fs://...") should now work
3 changes: 2 additions & 1 deletion fs/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -910,7 +910,8 @@ def geturl(self, path, purpose="download"):
to retrieve for the given path (if there is more than
one). The default is ``'download'``, which should return
a URL that serves the file. Other filesystems may support
other values for ``purpose``.
other values for ``purpose``: for instance, `OSFS` supports
``'fs'``, which returns a FS URL (see :ref:`fs-urls`).
Returns:
str: a URL.
Expand Down
2 changes: 1 addition & 1 deletion fs/subfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

@six.python_2_unicode_compatible
class SubFS(WrapFS[_F], typing.Generic[_F]):
"""A sub-directory on another filesystem.
"""A sub-directory on a parent filesystem.
A SubFS is a filesystem object that maps to a sub-directory of
another filesystem. This is the object that is returned by
Expand Down

0 comments on commit b71cacd

Please sign in to comment.