Commit bec7b020 by willmcgugan

Tidy up

parent 7b27ba8b
from fs import *
from helpers import *
__all__ = ['browserwin',
'memoryfs',
__all__ = ['memoryfs',
'mountfs',
'multifs',
'osfs',
......
......@@ -732,7 +732,12 @@ class SubFS(FS):
self.sub_dir = parent._abspath(sub_dir)
def __str__(self):
return "<SubFS: \"%s\" in %s>" % (self.sub_dir, self.parent)
return "<SubFS: %s in %s>" % (self.sub_dir, self.parent)
__repr__ = __str__
def __unicode__(self):
return unicode(self.__str__())
def desc(self, path):
if self.isdir(path):
......
......@@ -54,6 +54,11 @@ class MemoryFile(object):
def __str__(self):
return "<MemoryFile in %s %s>" % (self.memory_fs, self.path)
__repr__ = __str__
def __unicode__(self):
return unicode(self.__str__())
def __del__(self):
if not self.closed:
self.close()
......@@ -156,6 +161,8 @@ class MemoryFS(FS):
def __str__(self):
return "<MemoryFS>"
__repr__ = __str__
def __unicode__(self):
return unicode(self.__str__())
......
......@@ -28,6 +28,11 @@ class MountFS(FS):
def __str__(self):
return "<MountFS>"
__repr__ = __str__
def __unicode__(self):
return unicode(self.__str__())
def _delegate(self, path):
path = normpath(path)
head_path, object, tail_path = self.mount_tree.partialget(path)
......
......@@ -24,6 +24,12 @@ class MultiFS(FS):
finally:
self._lock.release()
__repr__ = __str__
def __unicode__(self):
return unicode(self.__str__())
def addfs(self, name, fs):
"""Adds a filesystem to the MultiFS.
......
......@@ -17,7 +17,9 @@ class OSFS(FS):
self.root_path = normpath(os.path.abspath(expanded_path))
def __str__(self):
return "<OSFS \"%s\">" % self.root_path
return "<OSFS %s>" % self.root_path
__repr__ = __str__
def getsyspath(self, path, allow_none=False):
sys_path = os.path.join(self.root_path, makerelative(self._resolve(path)))
......
......@@ -21,10 +21,12 @@ class TempFS(OSFS):
OSFS.__init__(self, self._temp_dir, thread_syncronize=thread_syncronize)
def __str__(self):
return '<TempFS: "%s">' % self._temp_dir
return '<TempFS: %s>' % self._temp_dir
__repr__ = __str__
def __unicode__(self):
return uncode(self.__str__())
return unicode(self.__str__())
def _cleanup(self):
"""Called by __del__ to remove the temporary directory. Can be called directly,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment