Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. #try to import those and get the keys
  2. for engine in engines:
  3. try:
  4. print('Importing ... ' + engine)
  5. __import__('engines.' + engine, globals=globals(), level=-1)
  6. except Exception as e:
  7. print('File: %s: import error %s' %(engine, str(e)) )
  8.  
  9. for klass in AbstractLookupEngine.__subclasses__():
  10. print('Creating instance of '+ str(klass.__name__))
  11. object = klass()
  12. print (dir(object))
  13. self.register_engine(object)
  14.  
  15. def _find_all_engines(self):
  16. # get the file name of the all the .py files
  17. return [ x[:-3]
  18. for x in os.listdir(self._engines_dir)
  19. if x.endswith('.py') and not x in self._ignored_list ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement