Mercurial > hg > pyloader
diff pyloader/invoke.py @ 92:36f5d31c3ed6
partial upgrade to py3.7
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Sun, 10 May 2020 14:43:00 -0700 |
parents | efb7a8a189e8 |
children | 93cf6ebe8a94 |
line wrap: on
line diff
--- a/pyloader/invoke.py Wed Apr 12 12:47:44 2017 -0700 +++ b/pyloader/invoke.py Sun May 10 14:43:00 2020 -0700 @@ -13,7 +13,7 @@ # - you should also be able to provide your own casts # This will have to be made an object in order to actually do this # so that these parameters may be provided to __init__ - + inspected = obj if inspect.isclass(obj): inspected = obj.__init__ # inspect the ctor @@ -47,8 +47,10 @@ kw[arg] = kwargs[arg] return obj(**kw) + def main(args=sys.argv[1:]): """CLI entry point""" + from loader import load from optparse import OptionParser usage = '%prog Object arg1=value1 arg2=value2 [...]' @@ -59,7 +61,7 @@ parser.exit() obj = load(args[0]) obj_args, obj_kwargs = str2args(' '.join(args[1:])) - print strcall(obj, *obj_args, **obj_kwargs) + print(strcall(obj, *obj_args, **obj_kwargs)) if __name__ == '__main__': main()