Commit bec7b020 by willmcgugan

Tidy up

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