<s> import imp <EOL> import os <EOL> from oslo_log import log as oslo_logging <EOL> LOG = oslo_logging . getLogger ( __name__ ) <EOL> class ClassLoader ( object ) : <EOL> def load_class ( self , class_path ) : <EOL> LOG . debug ( '<STR_LIT>' % class_path ) <EOL> parts = class_path . rsplit ( '<STR_LIT:.>' , <NUM_LIT:1> ) <EOL> module = __import__ ( parts [ <NUM_LIT:0> ] , fromlist = parts [ <NUM_LIT:1> ] ) <EOL> return getattr ( module , parts [ <NUM_LIT:1> ] ) <EOL> def load_module ( self , path ) : <EOL> module_name , file_ext = os . path . splitext ( os . path . split ( path ) [ - <NUM_LIT:1> ] ) <EOL> if file_ext . lower ( ) == '<STR_LIT>' : <EOL> module = imp . load_source ( module_name , path ) <EOL> elif file_ext . lower ( ) == '<STR_LIT>' : <EOL> module = imp . load_compiled ( module_name , path ) <EOL> return module </s>
