<s> from __future__ import ( absolute_import , division , <EOL> print_function , unicode_literals ) <EOL> from astroid import MANAGER , Class , Instance , Function , Arguments , Pass <EOL> def transform_model_class ( cls ) : <EOL> if cls . is_subtype_of ( '<STR_LIT>' ) : <EOL> core_exceptions = MANAGER . ast_from_module_name ( '<STR_LIT>' ) <EOL> DoesNotExist = Class ( '<STR_LIT>' , None ) <EOL> DoesNotExist . bases = core_exceptions . lookup ( '<STR_LIT>' ) [ <NUM_LIT:1> ] <EOL> cls . locals [ '<STR_LIT>' ] = [ DoesNotExist ] <EOL> MultipleObjectsReturned = Class ( '<STR_LIT>' , None ) <EOL> MultipleObjectsReturned . bases = core_exceptions . lookup ( <EOL> '<STR_LIT>' ) [ <NUM_LIT:1> ] <EOL> cls . locals [ '<STR_LIT>' ] = [ MultipleObjectsReturned ] <EOL> if '<STR_LIT>' not in cls . locals : <EOL> try : <EOL> Manager = MANAGER . ast_from_module_name ( <EOL> '<STR_LIT>' ) . lookup ( '<STR_LIT>' ) [ <NUM_LIT:1> ] [ <NUM_LIT:0> ] <EOL> QuerySet = MANAGER . ast_from_module_name ( <EOL> '<STR_LIT>' ) . lookup ( '<STR_LIT>' ) [ <NUM_LIT:1> ] [ <NUM_LIT:0> ] <EOL> except IndexError : <EOL> pass <EOL> else : <EOL> if isinstance ( Manager . body [ <NUM_LIT:0> ] , Pass ) : <EOL> for func_name , func_list in QuerySet . locals . items ( ) : <EOL> if ( not func_name . startswith ( '<STR_LIT:_>' ) and <EOL> func_name not in Manager . locals ) : <EOL> func = func_list [ <NUM_LIT:0> ] <EOL> if ( isinstance ( func , Function ) and <EOL> '<STR_LIT>' not in func . instance_attrs ) : <EOL> f = Function ( func_name , None ) <EOL> f . args = Arguments ( ) <EOL> Manager . locals [ func_name ] = [ f ] <EOL> cls . locals [ '<STR_LIT>' ] = [ Instance ( Manager ) ] <EOL> if '<STR_LIT:id>' not in cls . locals : <EOL> try : <EOL> AutoField = MANAGER . ast_from_module_name ( <EOL> '<STR_LIT>' ) . lookup ( '<STR_LIT>' ) [ <NUM_LIT:1> ] [ <NUM_LIT:0> ] <EOL> except IndexError : <EOL> pass <EOL> else : <EOL> cls . locals [ '<STR_LIT:id>' ] = [ Instance ( AutoField ) ] </s>
