#!/usr/bin/env python
"""Benchmark scipy.stats.beta.cdf."""

import timeit

name = "beta:cdf"
repeats = 3
iterations = 1000


def print_version():
    """Print the TAP version."""

    print("TAP version 13")


def print_summary(total, passing):
    """Print the benchmark summary.

    # Arguments

    * `total`: total number of tests
    * `passing`: number of passing tests

    """

    print("#")
    print("1.." + str(total))  # TAP plan
    print("# total " + str(total))
    print("# pass  " + str(passing))
    print("#")
    print("# ok")


def print_results(elapsed):
    """Print benchmark results.

    # Arguments

    * `elapsed`: elapsed time (in seconds)

    # Examples

    ``` python
    python> print_results(0.131009101868)
    ```
    """

    rate = iterations / elapsed

    print("  ---")
    print("  iterations: " + str(iterations))
    print("  elapsed: " + str(elapsed))
    print("  rate: " + str(rate))
    print("  ...")


def benchmark():
    """Run the benchmark and print benchmark results."""

    setup = "from scipy.stats import beta; from random import random;"
    stmt = "y = beta.cdf(random(), 100.56789, 55.54321)"

    t = timeit.Timer(stmt, setup=setup)

    print_version()

    for i in xrange(repeats):
        print("# python::" + name)
        elapsed = t.timeit(number=iterations)
        print_results(elapsed)
        print("ok " + str(i+1) + " benchmark finished")

    print_summary(repeats, repeats)


def main():
    """Run the benchmark."""
    benchmark()


if __name__ == "__main__":
    main()

@@ -54,16 +54,54 @@
 df.%22%22%22%0A%0A
+from __future__ import print_function%0A
 import t
@@ -107,20 +107,20 @@
 timeit%0A%0A
-name
+NAME
  = %22beta
@@ -129,30 +129,30 @@
 df%22%0A
-repeats = 3%0Aiterations
+REPEATS = 3%0AITERATIONS
  = 1
@@ -806,26 +806,26 @@
  rate = 
-iterations
+ITERATIONS
  / elaps
@@ -880,26 +880,26 @@
 %22 + str(
-iterations
+ITERATIONS
 ))%0A    p
@@ -1274,23 +1274,23 @@
  xrange(
-repeats
+REPEATS
 ):%0A     
@@ -1313,20 +1313,20 @@
 on::%22 + 
-name
+NAME
 )%0A      
@@ -1353,26 +1353,26 @@
 (number=
-iterations
+ITERATIONS
 )%0A      
@@ -1475,24 +1475,24 @@
 ary(
-repeats, repeats
+REPEATS, REPEATS
 )%0A%0A%0A

Fix lint errors