summaryrefslogtreecommitdiff
path: root/fs/memoryfs.py
diff options
context:
space:
mode:
Diffstat (limited to 'fs/memoryfs.py')
-rw-r--r--fs/memoryfs.py29
1 files changed, 14 insertions, 15 deletions
diff --git a/fs/memoryfs.py b/fs/memoryfs.py
index d48cf9f..9a87db3 100644
--- a/fs/memoryfs.py
+++ b/fs/memoryfs.py
@@ -31,6 +31,7 @@ def _check_mode(mode, mode_chars):
return False
return True
+
class MemoryFile(object):
def seek_and_lock(f):
@@ -71,7 +72,6 @@ class MemoryFile(object):
finally:
lock.release()
-
assert self.mem_file is not None, "self.mem_file should have a value"
def __str__(self):
@@ -163,7 +163,7 @@ class MemoryFile(object):
def __enter__(self):
return self
- def __exit__(self,exc_type,exc_value,traceback):
+ def __exit__(self, exc_type, exc_value, traceback):
self.close()
return False
@@ -218,7 +218,7 @@ class DirEntry(object):
if self.isfile():
return "<file %s>" % self.name
elif self.isdir():
- return "<dir %s>" % "".join( "%s: %s" % (k, v.desc_contents()) for k, v in self.contents.iteritems())
+ return "<dir %s>" % "".join("%s: %s" % (k, v.desc_contents()) for k, v in self.contents.iteritems())
def isdir(self):
return self.type == "dir"
@@ -248,24 +248,23 @@ class DirEntry(object):
self.mem_file = StringIO()
self.mem_file.write(data)
-class MemoryFS(FS):
+class MemoryFS(FS):
"""An in-memory filesystem.
"""
- _meta = {'thread_safe' : True,
- 'network' : False,
+ _meta = {'thread_safe': True,
+ 'network': False,
'virtual': False,
- 'read_only' : False,
- 'unicode_paths' : True,
- 'case_insensitive_paths' : False,
- 'atomic.move' : False,
- 'atomic.copy' : False,
- 'atomic.makedir' : True,
- 'atomic.rename' : True,
- 'atomic.setcontents' : False,
- }
+ 'read_only': False,
+ 'unicode_paths': True,
+ 'case_insensitive_paths': False,
+ 'atomic.move': False,
+ 'atomic.copy': False,
+ 'atomic.makedir': True,
+ 'atomic.rename': True,
+ 'atomic.setcontents': False}
def _make_dir_entry(self, *args, **kwargs):
return self.dir_entry_factory(*args, **kwargs)