Fix import error, tweaks

This commit is contained in:
Jon Herron 2022-09-12 20:45:44 -04:00
parent 7eb4c5c29c
commit 0f6a5f4b9a
1 changed files with 4 additions and 3 deletions

7
app.py
View File

@ -42,6 +42,7 @@ import importlib
import inspect import inspect
import pkgutil import pkgutil
import types import types
import typing
class PluginService: class PluginService:
PLUGIN_PREFIX = 'cmd_proxy_' PLUGIN_PREFIX = 'cmd_proxy_'
@ -133,7 +134,7 @@ class PluginService:
annotation_types = set( annotation_types = set(
map( map(
lambda t: t if t in supported_types else unsupported_type_marker, lambda t: t if t in supported_types else unsupported_type_marker,
get_args(annotation), typing.get_args(annotation),
) )
) )
@ -155,7 +156,7 @@ class PluginService:
@staticmethod @staticmethod
def command_params_desc(command): def command_params_desc(command):
sig = inspect.signature(command) sig = inspect.signature(command)
params_to_skip = ['self', 'kwargs'] # TODO no self if staying with function params_to_skip = ['self', 'kwargs']
sig_params = filter( sig_params = filter(
lambda param: param.name not in params_to_skip, sig.parameters.values() lambda param: param.name not in params_to_skip, sig.parameters.values()
) )
@ -166,4 +167,4 @@ class PluginService:
return params return params
if __name__ == '__main__': if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000) app.run(host='localhost', port=5000)