Conditions | 5 |
Total Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 2 |
CRAP Score | 17.8 |
1 | 1 | from plugin.core.backup.constants import BACKUP_PATH |
|
17 | 1 | @classmethod |
|
18 | 1 | def list(cls, search_path=BACKUP_PATH, max_depth=0): |
|
19 | names = os.listdir(search_path) |
||
20 | |||
21 | for name in names: |
||
22 | path = os.path.join(search_path, name) |
||
23 | |||
24 | if path.endswith('.bgr'): |
||
25 | # Load backup group |
||
26 | yield cls.load(path) |
||
27 | elif max_depth > 0: |
||
28 | # Search sub-directory for backup groups |
||
29 | for p in cls.list(path, max_depth - 1): |
||
30 | yield p |
||
31 | |||
34 |