<s> import psycopg2 , sys <EOL> sys . path . append ( '<STR_LIT>' ) <EOL> from fecreader . settings import DATABASES <EOL> def get_connection ( ) : <EOL> dbname = DATABASES [ '<STR_LIT:default>' ] [ '<STR_LIT>' ] <EOL> pw = DATABASES [ '<STR_LIT:default>' ] [ '<STR_LIT>' ] <EOL> user = DATABASES [ '<STR_LIT:default>' ] [ '<STR_LIT>' ] <EOL> host = DATABASES [ '<STR_LIT:default>' ] [ '<STR_LIT>' ] <EOL> port = DATABASES [ '<STR_LIT:default>' ] [ '<STR_LIT>' ] <EOL> if not host : <EOL> host = '<STR_LIT:localhost>' <EOL> if not port : <EOL> port = <NUM_LIT> <EOL> conn_string = "<STR_LIT>" % ( host , dbname , user , pw , port ) <EOL> conn = psycopg2 . connect ( conn_string ) <EOL> return conn </s>
