You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
402 B
19 lines
402 B
_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
|
|
|