mirror of
https://github.com/elliotnunn/machfs.git
synced 2024-06-11 02:29:46 +00:00
15 lines
455 B
Python
15 lines
455 B
Python
class AbstractFolder(dict):
|
|
def paths(self):
|
|
for name, child in self.items():
|
|
yield ((name,), child)
|
|
try:
|
|
childs_children = child.paths()
|
|
except AttributeError:
|
|
pass
|
|
else:
|
|
for each_path, each_child in childs_children:
|
|
yield (name,) + each_path, each_child
|
|
|
|
def __str__(self):
|
|
return 'Folder valence=%d' % len(self)
|