<s> """<STR_LIT>""" <EOL> import sys <EOL> import os <EOL> import re <EOL> from subprocess import Popen <EOL> try : <EOL> from pkg_resources import get_distribution <EOL> version = get_distribution ( '<STR_LIT>' ) . version <EOL> except Exception : <EOL> version = '<STR_LIT>' <EOL> _filename_re = re . compile ( r'<STR_LIT>' ) <EOL> bench_directory = os . path . abspath ( os . path . dirname ( __file__ ) ) <EOL> def list_benchmarks ( ) : <EOL> result = [ ] <EOL> for name in os . listdir ( bench_directory ) : <EOL> match = _filename_re . match ( name ) <EOL> if match is not None : <EOL> result . append ( match . group ( <NUM_LIT:1> ) ) <EOL> result . sort ( key = lambda x : ( x . startswith ( '<STR_LIT>' ) , x . lower ( ) ) ) <EOL> return result <EOL> def run_bench ( name , use_gevent = False ) : <EOL> sys . stdout . write ( '<STR_LIT>' % name ) <EOL> sys . stdout . flush ( ) <EOL> Popen ( [ sys . executable , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' % name , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' if use_gevent else '<STR_LIT>' , <EOL> '<STR_LIT>' ] ) . wait ( ) <EOL> def bench_wrapper ( use_gevent = False ) : <EOL> print '<STR_LIT:=>' * <NUM_LIT> <EOL> print '<STR_LIT>' % ( version , use_gevent ) <EOL> print '<STR_LIT:->' * <NUM_LIT> <EOL> os . chdir ( bench_directory ) <EOL> for bench in list_benchmarks ( ) : <EOL> run_bench ( bench , use_gevent ) <EOL> print '<STR_LIT:->' * <NUM_LIT> <EOL> def main ( ) : <EOL> bench_wrapper ( False ) <EOL> try : <EOL> import gevent <EOL> bench_wrapper ( True ) <EOL> except ImportError : <EOL> pass <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> main ( ) </s>
