(self)
| 99 | self._children.append(File(ent)) |
| 100 | |
| 101 | def sort(self): |
| 102 | def _sort(x, y): |
| 103 | if x.name == y.name: |
| 104 | return 0 |
| 105 | elif x.name > y.name: |
| 106 | return 1 |
| 107 | else: |
| 108 | return -1 |
| 109 | from functools import cmp_to_key |
| 110 | self._children.sort(key=cmp_to_key(_sort)) |
| 111 | |
| 112 | # sort recursively |
| 113 | for c in self._children: |
| 114 | if isinstance(c, Folder): |
| 115 | c.sort() |
| 116 | |
| 117 | def dump(self, indent=0): |
| 118 | print('%s%s' % (' ' * indent, self._name)) |
no outgoing calls
no test coverage detected