Revert "make the docstring more readable and improve the list_models logic"

This reverts commit 248068fe5d.
This commit is contained in:
Lincoln Stein 2022-11-26 12:57:47 -05:00
parent 9e0504abe5
commit 7f3ba16cd2

View File

@ -125,18 +125,15 @@ class ModelCache(object):
def list_models(self) -> dict: def list_models(self) -> dict:
''' '''
Return a dict of models in the format: Return a dict of models in the format:
{ { model_name1: {'status': ('active'|'cached'|'not loaded'),
model_name1: { 'description': description,
'status': ('active'|'cached'|'not loaded'), },
'description': description, model_name2: { etc }
},
model_name2: { etc },
}
''' '''
models = {} result = dict()
for name, config in self.config.items(): for name in self.config:
try: try:
description = config.description description = self.config[name].description
except ConfigAttributeError: except ConfigAttributeError:
description = '<no description>' description = '<no description>'
@ -147,13 +144,11 @@ class ModelCache(object):
else: else:
status = 'not loaded' status = 'not loaded'
models = models.update( result[name]={
name = { 'status' : status,
'status': status, 'description' : description
'description': description, }
}) return result
return models
def print_models(self) -> None: def print_models(self) -> None:
''' '''