##// END OF EJS Templates
errores mejorados
José Chávez -
r945:f9b2d290f79c
parent child
Show More
@@ -67,7 +67,6 def clean_modules(module):
67
67
68
68
69 def search(nextcommand):
69 def search(nextcommand):
70
71 if nextcommand is None:
70 if nextcommand is None:
72 log.error('There is no Operation/ProcessingUnit to search')
71 log.error('There is no Operation/ProcessingUnit to search')
73 elif nextcommand == 'procs':
72 elif nextcommand == 'procs':
@@ -91,8 +90,8 def search(nextcommand):
91 else:
90 else:
92 try:
91 try:
93 module = locate('schainpy.model.{}'.format(nextcommand))
92 module = locate('schainpy.model.{}'.format(nextcommand))
94 log.warning('Use this feature with caution. It may not return all the allowed arguments')
95 args = module().getAllowedArgs()
93 args = module().getAllowedArgs()
94 log.warning('Use this feature with caution. It may not return all the allowed arguments')
96 try:
95 try:
97 args.remove('self')
96 args.remove('self')
98 except Exception as e:
97 except Exception as e:
@@ -101,13 +100,17 def search(nextcommand):
101 args.remove('dataOut')
100 args.remove('dataOut')
102 except Exception as e:
101 except Exception as e:
103 pass
102 pass
104 log.success('Showing arguments of {} are:\n\033[1m{}\033[0m'.format(nextcommand, '\n'.join(args)))
103 if len(args) == 0:
104 log.success('{} has no arguments'.format(nextcommand))
105 else:
106 log.success('Showing arguments of {} are:\n\033[1m{}\033[0m'.format(nextcommand, '\n'.join(args)))
105 except Exception as e:
107 except Exception as e:
106 log.error('Module {} does not exists'.format(nextcommand))
108 log.error('Module {} does not exists'.format(nextcommand))
107 allModules = dir(import_module('schainpy.model'))
109 allModules = dir(import_module('schainpy.model'))
108 module = check_module(allModules, Operation)
110 module = check_module(allModules, Operation)
109 module.extend(check_module(allModules, ProcessingUnit))
111 module.extend(check_module(allModules, ProcessingUnit))
110 similar = process.extractOne(nextcommand, module)[0]
112 similar = process.extractOne(nextcommand, module)[0]
113 log.success('Searching {} instead'.format(similar))
111 search(similar)
114 search(similar)
112
115
113
116
General Comments 0
You need to be logged in to leave comments. Login now