20 lines
402 B
Python
20 lines
402 B
Python
_cache = {}
|
|
|
|
def get_app(app):
|
|
try:
|
|
return _cache[app]
|
|
except KeyError:
|
|
try:
|
|
module = __import__(f'/bin/{app}')
|
|
except AttributeError:
|
|
raise AppNotFound(app)
|
|
|
|
try:
|
|
app_class = module.get_app_class(App)
|
|
except AttributeError:
|
|
raise InvalidApp(app)
|
|
|
|
_cache[app] = app_class
|
|
|
|
return app_class
|