Get list of available models from the models directory.
(self)
| 123 | self.main_py = os.path.join(project_root, "src", "main.py") |
| 124 | self.cli_sh = os.path.join(project_root, "src", "cli.sh") |
| 125 | self.lockfile = os.path.join(project_root, "src", "nyarchlinux-desktop-puppet.lock") |
| 126 | |
| 127 | def get_available_models(self): |
| 128 | """Get list of available models from the models directory.""" |
| 129 | models = [] |
| 130 | if not os.path.isdir(self.models_dir): |
| 131 | return models |
| 132 | |
| 133 | for root, _, files in os.walk(self.models_dir): |
| 134 | for file in files: |
| 135 | if file.endswith('.model3.json') or file.endswith('.model.json'): |
| 136 | file_name = file.rstrip('.model3.json').rstrip('.model.json') |
| 137 | relative_path = os.path.relpath(os.path.join(root, file), self.models_dir) |
| 138 | models.append((file_name, relative_path)) |
| 139 | return models |
| 140 |