<s> """<STR_LIT>""" <EOL> import re <EOL> VERSION_RE = re . compile ( r'<STR_LIT>' ) <EOL> def _parse_version ( text ) : <EOL> "<STR_LIT>" <EOL> major , major2 , minor = VERSION_RE . search ( text ) . groups ( ) <EOL> try : <EOL> return int ( major ) * <NUM_LIT> + int ( major2 ) * <NUM_LIT:100> + int ( minor ) <EOL> except ( ValueError , TypeError ) : <EOL> return int ( major ) * <NUM_LIT> + int ( major2 ) * <NUM_LIT:100> <EOL> def get_version ( connection ) : <EOL> """<STR_LIT>""" <EOL> if hasattr ( connection , '<STR_LIT>' ) : <EOL> return connection . server_version <EOL> else : <EOL> cursor = connection . cursor ( ) <EOL> cursor . execute ( "<STR_LIT>" ) <EOL> return _parse_version ( cursor . fetchone ( ) [ <NUM_LIT:0> ] ) </s>
