Skip to content

Commit 5f62328

Browse files
committed
move model listing outside of R integration
1 parent a8d3409 commit 5f62328

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

Eiger.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,9 @@ def r_import(args):
3434
def r_export(args):
3535
database.dumpModelToFile(args.database, args.file, args.id)
3636

37-
def r_list(args):
38-
all_models = database.getModels(args.database, 'R')
39-
table = [a[:-1] for a in all_models]
40-
print tabulate(table, headers=['ID', 'Description', 'Created'])
37+
def list_models(args):
38+
all_models = database.getModels(args.database)
39+
print tabulate(all_models, headers=['ID', 'Description', 'Created', 'Source'])
4140

4241
def trainModel(args):
4342
print "Training the model..."
@@ -346,6 +345,10 @@ def convert(args):
346345
help='transform a model into a different file format',
347346
description='Transform a model into a different file format')
348347
convert_parser.set_defaults(func=convert)
348+
list_model_parser = subparsers.add_parser('list',
349+
help='list available models in the Eiger DB',
350+
description='List available models in the Eiger DB')
351+
list_model_parser.set_defaults(func=list_models)
349352
r_parser = subparsers.add_parser('R',
350353
help='interact with the R language for modeling',
351354
description='Interact with the R language for modeling')
@@ -417,6 +420,9 @@ def convert(args):
417420
help='Name of input model to convert from')
418421
convert_parser.add_argument('output', type=str,
419422
help='Name of output model to convert to')
423+
424+
"""LIST-MODEL ARGUMENTS"""
425+
list_model_parser.add_argument('database', type=str, help='Name of the database file')
420426

421427
"""R-MODEL ARGUMENTS"""
422428
r_subparser = r_parser.add_subparsers(title='subcommands')
@@ -443,12 +449,6 @@ def convert(args):
443449
help='ID number identifying which model in the database to export ')
444450
r_export_parser.add_argument('file', type=str,
445451
help='Name of the file to export into')
446-
"""R LIST ARGUMENTS"""
447-
r_list_parser = r_subparser.add_parser('list',
448-
help='list available models in the Eiger DB',
449-
description='List available models in the Eiger DB')
450-
r_list_parser.set_defaults(func=r_list)
451-
r_list_parser.add_argument('database', type=str, help='Name of the database file')
452452

453453
args = parser.parse_args()
454454
args.func(args)

0 commit comments

Comments
 (0)