mirror of
https://github.com/elliotnunn/machfs.git
synced 2024-11-25 07:32:07 +00:00
Better dumping
This commit is contained in:
parent
eb847a97cd
commit
5dff862548
@ -51,6 +51,18 @@ class AbstractFolder(collections.MutableMapping):
|
|||||||
the_dict = {self._prefdict[k]: v for (k, v) in self._maindict.items()}
|
the_dict = {self._prefdict[k]: v for (k, v) in self._maindict.items()}
|
||||||
return repr(the_dict)
|
return repr(the_dict)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
lines = []
|
||||||
|
for k, v in self.items():
|
||||||
|
v = str(v)
|
||||||
|
if '\n' in v:
|
||||||
|
lines.append(k + ':')
|
||||||
|
for l in v.split('\n'):
|
||||||
|
lines.append(' ' + l)
|
||||||
|
else:
|
||||||
|
lines.append(k + ': ' + v)
|
||||||
|
return '\n'.join(lines)
|
||||||
|
|
||||||
def iter_paths(self):
|
def iter_paths(self):
|
||||||
for name, child in self.items():
|
for name, child in self.items():
|
||||||
yield ((name,), child)
|
yield ((name,), child)
|
||||||
|
Loading…
Reference in New Issue
Block a user