This file is indexed.

/usr/lib/python2.7/dist-packages/openpyxl/benchmarks/reader.py is in python-openpyxl 2.3.0-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import os
import sys
import timeit

import openpyxl


def reader(optimised):
    """
    Loop through all cells of a workbook
    """
    folder = os.path.split(__file__)[0]
    src = os.path.join(folder, "files", "very_large.xlsx")
    wb = openpyxl.load_workbook(src, use_iterators=optimised)
    ws = wb.active
    rows = ws.iter_rows()
    for r, row in enumerate(rows):
        for c, col in enumerate(row):
            pass
    print((r+1)* (c+1), "cells")

def timer(fn):
    """
    Create a timeit call to a function and pass in keyword arguments.
    The function is called twice, once using the standard workbook, then with the optimised one.
    Time from the best of three is taken.
    """
    print("lxml", openpyxl.LXML)
    result = []
    for opt in (False, True,):
        print("Workbook is {0}".format(opt and "optimised" or "not optimised"))
        times = timeit.repeat("{0}({1})".format(fn.__name__, opt),
                              setup="from __main__ import {0}".format(fn.__name__),
                              number = 1,
                              repeat = 3
        )
        print("{0:.2f}s".format(min(times)))
        result.append(min(times))
    std, opt = result
    print("Optimised takes {0:.2%} time\n".format(opt/std))
    return std, opt


if __name__ == "__main__":
    timer(reader)