<s> import re <EOL> from importlib import import_module <EOL> from abc import ABCMeta , abstractmethod <EOL> from . exceptions import * <EOL> class Source ( object ) : <EOL> """<STR_LIT>""" <EOL> __metaclass__ = ABCMeta <EOL> include_syntax = '<STR_LIT>' <EOL> syntaxes = [ ] <EOL> highlights = [ ] <EOL> candidates = [ ] <EOL> def __init__ ( self , args ) : <EOL> self . args = args <EOL> def __eq__ ( self , other ) : <EOL> return ( self . name ( ) , self . args ) == ( other . name ( ) , other . args ) <EOL> @ classmethod <EOL> def name ( cls ) : <EOL> return cls . __name__ . lower ( ) <EOL> @ abstractmethod <EOL> def populate_candidates ( self ) : <EOL> pass <EOL> def formatted_candidates ( self ) : <EOL> return self . candidates <EOL> def parse_source ( string ) : <EOL> colons_with_no_backslashes = r'<STR_LIT>' <EOL> splits = re . split ( colons_with_no_backslashes , string ) <EOL> name = splits [ <NUM_LIT:0> ] <EOL> args = splits [ <NUM_LIT:1> : ] <EOL> try : <EOL> cls = name . capitalize ( ) <EOL> return import_module ( '<STR_LIT>' + name ) . __dict__ [ cls ] ( args ) <EOL> except ImportError : <EOL> error = '<STR_LIT>' . format ( name ) <EOL> raise PyUniteError ( error ) <EOL> except KeyError : <EOL> error = '<STR_LIT>' . format ( cls , name ) <EOL> raise PyUniteError ( error ) </s>
