<s> """<STR_LIT>""" <EOL> import json <EOL> from bottle import route , run , app , response <EOL> from appmetrics import metrics <EOL> @ route ( '<STR_LIT>' ) <EOL> @ metrics . with_meter ( "<STR_LIT>" ) <EOL> @ metrics . with_histogram ( "<STR_LIT>" ) <EOL> @ metrics . with_meter ( "<STR_LIT>" ) <EOL> def factorial ( n ) : <EOL> f = <NUM_LIT:1> <EOL> for i in xrange ( <NUM_LIT:2> , n + <NUM_LIT:1> ) : <EOL> f *= i <EOL> response . content_type = "<STR_LIT:application/json>" <EOL> return json . dumps ( dict ( factorial = str ( f ) ) ) <EOL> @ route ( '<STR_LIT>' ) <EOL> @ metrics . with_meter ( "<STR_LIT>" ) <EOL> @ metrics . with_histogram ( "<STR_LIT>" ) <EOL> @ metrics . with_meter ( "<STR_LIT>" ) <EOL> def is_prime ( n ) : <EOL> result = True <EOL> if n % <NUM_LIT:2> == <NUM_LIT:0> : <EOL> result = False <EOL> else : <EOL> for i in xrange ( <NUM_LIT:3> , int ( n ** <NUM_LIT:0.5> ) + <NUM_LIT:1> , <NUM_LIT:2> ) : <EOL> if n % i == <NUM_LIT:0> : <EOL> result = False <EOL> response . content_type = "<STR_LIT:application/json>" <EOL> return json . dumps ( dict ( is_prime = result ) ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> from appmetrics . wsgi import AppMetricsMiddleware <EOL> myapp = AppMetricsMiddleware ( app ( ) ) <EOL> run ( app = myapp , port = <NUM_LIT> , threaded = True , debug = True ) </s>
