| Conditions | 4 |
| Total Lines | 26 |
| Code Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | #!/usr/bin/env python |
||
| 12 | @click.command() |
||
| 13 | @click.argument('dataset') |
||
| 14 | @click.option('-m', '--model') |
||
| 15 | def main(dataset, model): |
||
| 16 | collections_dir = os.getenv('COLLECTIONS_DIR') |
||
| 17 | if not collections_dir: |
||
| 18 | raise RuntimeError( |
||
| 19 | "Please set the COLLECTIONS_DIR environment variable with the path to a directory containing collections/datasets") |
||
| 20 | reporter = PsiReporter() |
||
| 21 | dataset_path = os.path.join(collections_dir, dataset) |
||
| 22 | reporter.dataset = dataset_path |
||
| 23 | |||
| 24 | print("Classes: [{}]".format(', '.join("'{}'".format(x) for x in reporter.dataset.class_names))) |
||
| 25 | |||
| 26 | models_dir = os.path.join(dataset_path, 'models') |
||
| 27 | if not os.path.isdir(models_dir): |
||
| 28 | print("No models found") |
||
| 29 | sys.exit(0) |
||
| 30 | if model: |
||
| 31 | phi_file_names = [model] |
||
| 32 | else: |
||
| 33 | phi_file_names = os.listdir(models_dir) |
||
| 34 | |||
| 35 | # b = pr.pformat(glob('{}/*.phi'.format(models_dir)), topics_set='domain', show_class_names=True) |
||
| 36 | b = reporter.pformat(phi_file_names, topics_set='domain', show_model_name=True, show_class_names=True) |
||
| 37 | print(b) |
||
| 38 | |||
| 41 | main() |