diff options
author | willmcgugan <willmcgugan@67cdc799-7952-0410-af00-57a81ceafa0f> | 2008-09-16 16:37:51 +0000 |
---|---|---|
committer | willmcgugan <willmcgugan@67cdc799-7952-0410-af00-57a81ceafa0f> | 2008-09-16 16:37:51 +0000 |
commit | b5ee6f2458a9e60490e3438d74da28d7d82c28ee (patch) | |
tree | 268f9222c5e33523f7ae086077f570c5c8d2115f /fs/zipfs.py | |
parent | 612ef35ec9747893b60dd27f685a8193dc53cf97 (diff) | |
download | pyfilesystem-git-b5ee6f2458a9e60490e3438d74da28d7d82c28ee.tar.gz |
A few docs
Diffstat (limited to 'fs/zipfs.py')
-rw-r--r-- | fs/zipfs.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/zipfs.py b/fs/zipfs.py index 18761be..3b163f2 100644 --- a/fs/zipfs.py +++ b/fs/zipfs.py @@ -14,6 +14,8 @@ import tempfs class _TempWriteFile(object): + """Proxies a file object and calls a callback when the file is closed.""" + def __init__(self, fs, filename, close_callback): self.fs = fs self.filename = filename @@ -32,6 +34,8 @@ class _TempWriteFile(object): class _ExceptionProxy(object): + """A placeholder for an object that may no longer be used.""" + def __getattr__(self, name): raise ValueError("Zip file has been closed") @@ -43,7 +47,18 @@ class _ExceptionProxy(object): class ZipFS(FS): + """A FileSystem that represents a zip file.""" + def __init__(self, zip_file, mode="r", compression="deflated", allowZip64=False, thread_syncronize=True): + """Create a FS that maps on to a zip file. + + zip_file -- A (system) path, or a file-like object + mode -- Mode to open zip file: 'r' for reading, 'w' for writing or 'a' for appending + compression -- Can be 'deflated' (default) to compress data or 'stored' to just store date + allowZip64 -- Set to True to use zip files greater than 2 MB, default is False + thread_syncronize -- Set to True (default) to enable thread-safety + + """ FS.__init__(self, thread_syncronize=thread_syncronize) if compression == "deflated": compression_type = ZIP_DEFLATED |