<s> import string <EOL> def dedupe_list ( input_list , preserve_order = True ) : <EOL> """<STR_LIT>""" <EOL> seen = set ( ) <EOL> return [ x for x in input_list if x not in seen and not seen . add ( x ) ] <EOL> def snake_to_mixed ( underscore_input ) : <EOL> """<STR_LIT>""" <EOL> word_list = underscore_input . split ( '<STR_LIT:_>' ) <EOL> word_count = len ( word_list ) <EOL> if word_count > <NUM_LIT:1> : <EOL> for i in range ( <NUM_LIT:1> , word_count ) : <EOL> word_list [ i ] = string . capwords ( word_list [ i ] ) <EOL> ret = '<STR_LIT>' . join ( word_list ) <EOL> return ret <EOL> def extract_classes ( clazz ) : <EOL> """<STR_LIT>""" <EOL> extracted = [ clazz ] <EOL> for base in clazz . __bases__ : <EOL> extracted += extract_classes ( base ) <EOL> if object in extracted : <EOL> extracted . remove ( object ) <EOL> return dedupe_list ( extracted , preserve_order = True ) <EOL> class ClassPropertyError ( Exception ) : <EOL> pass <EOL> class ClassPropertyDescriptor ( object ) : <EOL> def __init__ ( self , fget , fset = None ) : <EOL> self . fget = fget <EOL> self . fset = fset <EOL> def __get__ ( self , obj , klass = None ) : <EOL> if klass is None : <EOL> klass = type ( obj ) <EOL> return self . fget . __get__ ( obj , klass ) ( ) <EOL> def classproperty ( func ) : <EOL> if not isinstance ( func , ( classmethod , staticmethod ) ) : <EOL> func = classmethod ( func ) <EOL> return ClassPropertyDescriptor ( func ) </s>
