summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/concepts.rst6
-rw-r--r--docs/index.rst1
-rw-r--r--docs/interface.rst13
-rw-r--r--fs/base.py5
-rw-r--r--fs/contrib/tahoefs/__init__.py4
-rw-r--r--fs/errors.py2
-rw-r--r--fs/remote.py5
7 files changed, 24 insertions, 12 deletions
diff --git a/docs/concepts.rst b/docs/concepts.rst
index 1205998..0a911be 100644
--- a/docs/concepts.rst
+++ b/docs/concepts.rst
@@ -6,7 +6,7 @@ It is generally quite easy to get in to the mind-set of using PyFilesystem inter
Sandboxing
----------
-FS objects are not permitted to work with any files / directories outside of the Filesystem they represent. If you attempt to open a file or directory outside the root of the FS (by using "../" in the path, you will get a ValueError).
+FS objects are not permitted to work with any files / directories outside of the Filesystem they represent. If you attempt to open a file or directory outside the root of the FS (e.g. by using "../" in the path) you will get a ValueError.
There is no concept of a current working directory in PyFilesystem, since it is a common source of bugs and not all filesytems even have such a notion. If you want to work with a sub-directory of a FS object, you can use the `opendir` method which returns another FS object representing the sub-directory.
@@ -55,6 +55,8 @@ When working with paths in FS objects, keep in mind the following:
Note that paths used by the FS interface will use this format, but the constructor or additional methods may not. Notably the ``osfs.OSFS`` constructor which requires an OS path -- the format of which can be platform-dependant.
+There are many helpful functions for working with paths in the :mod:`fs.path` module.
+
System Paths
++++++++++++
@@ -72,7 +74,7 @@ Not all FS implementation will map to a valid system path (e.g. the FTP FS objec
Errors
------
-PyFilesystem converts all exceptions to a common type, so that you need only write your exception handling code once. For example, if you try to open a file that doesn't exist, PyFilesystem will throw a ``fs.errors.ResourceNotFoundError`` regardless of wether the filesystem is local, on a ftp server or in a zip file::
+PyFilesystem converts all exceptions to a common type, so that you need only write your exception handling code once. For example, if you try to open a file that doesn't exist, PyFilesystem will throw a ``fs.errors.ResourceNotFoundError`` regardless of whether the filesystem is local, on a ftp server or in a zip file::
>>> from fs.osfs import OSFS
>>> root_fs = OSFS('/')
diff --git a/docs/index.rst b/docs/index.rst
index 7dad2e6..f245219 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -21,6 +21,7 @@ Guide
filesystems.rst
contrib.rst
expose.rst
+ utilities.rst
Code Documentation
------------------
diff --git a/docs/interface.rst b/docs/interface.rst
index f2ba77c..0b4af59 100644
--- a/docs/interface.rst
+++ b/docs/interface.rst
@@ -5,9 +5,9 @@ It requires a relatively small number of methods to implement a working FS objec
If you are looking to implement a working FS object, derive a class from fs.base.FS and implement the essential methods (below). Be sure to convert all exceptions to instances of :class:`fs.errors.FSError`.
-It may also be worthwhile implementing some of the non-essential methods, as the default implementations may not be optimal. For example, the method :meth:`fs.base.FS.move` is implemeneted as a file copy followed by a delete, but may filesystems can move a file without copying data.
+It may also be worthwhile implementing some of the non-essential methods, as the default implementations may not be optimal. For example, the method :meth:`fs.base.FS.move` is implemeneted as a file copy followed by a delete, but many filesystems can move a file without copying data.
-If the filesystem you are implementing maps path to the native filesystem, be sure to implement `getsyspath`. Doing so will improve performance, especialy when copying / moving files between FS objects.
+If the filesystem you are implementing maps paths to the native filesystem, be sure to implement `getsyspath`. Doing so will improve performance, especialy when copying / moving files between FS objects.
Essential Methods
-----------------
@@ -35,8 +35,14 @@ The following methods have default implementations in fs.base.FS and aren't requ
* :meth:`~fs.base.FS.desc` Return a short destriptive text regarding a path
* :meth:`~fs.base.FS.exists` Check whether a path exists as file or directory
* :meth:`~fs.base.FS.listdirinfo` Get a directory listing along with the info dict for each entry
+ * :meth:`~fs.base.FS.ilistdir` Generator version of the listdir method
+ * :meth:`~fs.base.FS.ilistdirinfo` Generator version of the listdirinfo method
* :meth:`~fs.base.FS.getsyspath` Get a file's name in the local filesystem, if possible
* :meth:`~fs.base.FS.hassyspath` Check if a path maps to a system path (recognised by the OS)
+ * :meth:`~fs.base.FS.getpathurl` Get an external URL at which the given file can be accessed, if possible
+ * :meth:`~fs.base.FS.haspathurl` Check if a path maps to an external URL
+ * :meth:`~fs.base.FS.getmeta` Get the value of a filesystem meta value, if it exists
+ * :meth:`~fs.base.FS.hasmeta` Check if a filesystem meta value exists
* :meth:`~fs.base.FS.move` Move a file to a new location
* :meth:`~fs.base.FS.movedir` Recursively move a directory to a new location
* :meth:`~fs.base.FS.opendir` Opens a directory and returns an FS object that represents it
@@ -47,10 +53,11 @@ The following methods have default implementations in fs.base.FS and aren't requ
Utility Methods
---------------
-The following members have implementations in fs.base.FS but will probably never require a non-default implementation, although there is nothing to prevent a derived class from implementing these:
+The following members have implementations in fs.base.FS and will probably never require a non-default implementation, although there is nothing to prevent a derived class from implementing these:
* :meth:`~fs.base.FS.createfile` Create a file with data
* :meth:`~fs.base.FS.getcontents` Returns the contents of a file as a string
+ * :meth:`~fs.base.FS.setcontents` Sets the contents of a file as a string or file-like object
* :meth:`~fs.base.FS.getsize` Returns the number of bytes used for a given file or directory
* :meth:`~fs.base.FS.isdirempty` Checks if a directory contains no files
* :meth:`~fs.base.FS.makeopendir` Creates a directroy (if it exists) and returns an FS object for that directory
diff --git a/fs/base.py b/fs/base.py
index 2194682..22038d7 100644
--- a/fs/base.py
+++ b/fs/base.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
"""
-
- fs.base: base class defining the FS abstraction.
+fs.base
+=======
This module defines the most basic filesystem abstraction, the FS class.
Instances of FS represent a filesystem containing files and directories
@@ -139,7 +139,6 @@ class FS(object):
An instance of a class derived from FS is an abstraction on some kind
of filesytem, such as the OS filesystem or a zip file.
-
"""
_meta = {}
diff --git a/fs/contrib/tahoefs/__init__.py b/fs/contrib/tahoefs/__init__.py
index c9eec02..4ae555e 100644
--- a/fs/contrib/tahoefs/__init__.py
+++ b/fs/contrib/tahoefs/__init__.py
@@ -1,4 +1,8 @@
'''
+fs.contrib.tahoefs
+==================
+
+
Example (it will use publicly available, but slow-as-hell Tahoe-LAFS cloud):
from fs.contrib.tahoefs import TahoeFS, Connection
diff --git a/fs/errors.py b/fs/errors.py
index 53c92ee..e6b29a3 100644
--- a/fs/errors.py
+++ b/fs/errors.py
@@ -1,6 +1,6 @@
"""
Defines the Exception classes thrown by PyFilesystem objects. Exceptions relating
-to the underling filesystem are translated in to one of the following Exceptions.
+to the underlying filesystem are translated in to one of the following Exceptions.
Exceptions that relate to a path store that path in `self.path`.
All Exception classes are derived from `FSError` which can be used as a
diff --git a/fs/remote.py b/fs/remote.py
index 9364e64..a008c9b 100644
--- a/fs/remote.py
+++ b/fs/remote.py
@@ -1,5 +1,4 @@
"""
-
fs.remote
=========
@@ -16,8 +15,8 @@ FS subclasses interfacing with a remote filesystem. These include:
of a remote FS, and allows client code to wait for
a connection to be re-established.
- * CacheFS: a WrapFS subclass that caches file and directory meta-data in
- memory, to speed access to a remote FS.
+ * CacheFS: a WrapFS subclass that caches file and directory meta-data in
+ memory, to speed access to a remote FS.
"""