<s> import re <EOL> from olympia . versions . compare import version_re <EOL> def floor_version ( s ) : <EOL> result = s <EOL> if result : <EOL> s = s . replace ( '<STR_LIT>' , '<STR_LIT>' ) . replace ( '<STR_LIT>' , '<STR_LIT>' ) . replace ( '<STR_LIT:*>' , '<STR_LIT>' ) <EOL> match = re . match ( version_re , s ) <EOL> if match : <EOL> major , minor = match . groups ( ) [ : <NUM_LIT:2> ] <EOL> major , minor = int ( major ) , int ( minor or <NUM_LIT:0> ) <EOL> result = '<STR_LIT>' % ( major , minor ) <EOL> return result </s>
