*types.ModuleType

This commit is contained in:
Costa Shulyupin 2018-09-16 16:01:42 +03:00
parent f90b1b84fe
commit f0972fc1f8
1 changed files with 5 additions and 5 deletions

View File

@ -929,14 +929,14 @@ def main():
else: else:
a1 = sys.argv[1] a1 = sys.argv[1]
sys.argv = sys.argv[1:] sys.argv = sys.argv[1:]
if isinstance(eval(a1), types.ModuleType): if '(' in a1:
ret = eval(a1+".main()")
elif '(' in a1:
ret = eval(a1) ret = eval(a1)
# ret = exec(sys.argv[1]) # ret = exec(sys.argv[1])
elif len(sys.argv) == 1 and isinstance(eval(a1), types.ModuleType):
ret = eval(a1 + ".main()")
else: else:
ret = eval(a1 + '(' + ', '.join("'%s'" % (a1) ret = eval(a1 + '(' + ', '.join("'%s'" % (a)
for a1 in sys.argv[1:]) + ')') for a in sys.argv[1:]) + ')')
if isinstance(ret, nx.DiGraph): if isinstance(ret, nx.DiGraph):
digraph_print(ret) digraph_print(ret)
if isinstance(ret, bool) and ret is False: if isinstance(ret, bool) and ret is False: