This file is indexed.

/usr/lib/python3/dist-packages/stl/main.py is in python3-stl 2.3.2-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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import sys
import random
import argparse

from . import stl


def _get_parser(description):
    parser = argparse.ArgumentParser(description=description)
    parser.add_argument('infile', nargs='?', type=argparse.FileType('rb'),
                        default=sys.stdin, help='STL file to read')
    parser.add_argument('outfile', nargs='?', type=argparse.FileType('wb'),
                        default=sys.stdout, help='STL file to write')
    parser.add_argument('--name', nargs='?', help='Name of the mesh')
    parser.add_argument(
        '-n', '--use-file-normals', action='store_true',
        help='Read the normals from the file instead of recalculating them')
    parser.add_argument(
        '-r', '--remove-empty-areas', action='store_true',
        help='Remove areas with 0 surface areas to prevent errors during '
        'normal calculation')
    parser.add_argument('-s', '--disable-speedups', action='store_true',
                        help='Disable Cython speedups')
    return parser


def _get_name(args):
    names = [
        args.name,
        getattr(args.outfile, 'name', None),
        getattr(args.infile, 'name', None),
        'numpy-stl-%06d' % random.randint(0, 1e6),
    ]

    for name in names:  # pragma: no branch
        if name and isinstance(name, str) and not name.startswith('<'):
            return name


def main():
    parser = _get_parser('Convert STL files from ascii to binary and back')
    parser.add_argument('-a', '--ascii', action='store_true',
                        help='Write ASCII file (default is binary)')
    parser.add_argument('-b', '--binary', action='store_true',
                        help='Force binary file (for TTYs)')

    args = parser.parse_args()
    name = _get_name(args)
    stl_file = stl.StlMesh(filename=name,
                           fh=args.infile,
                           calculate_normals=False,
                           remove_empty_areas=args.remove_empty_areas,
                           speedups=not args.disable_speedups)

    if args.binary:
        mode = stl.BINARY
    elif args.ascii:
        mode = stl.ASCII
    else:
        mode = stl.AUTOMATIC

    stl_file.save(name, args.outfile, mode=mode,
                  update_normals=not args.use_file_normals)


def to_ascii():
    parser = _get_parser('Convert STL files to ASCII (text) format')
    args = parser.parse_args()
    name = _get_name(args)
    stl_file = stl.StlMesh(filename=name, fh=args.infile,
                           calculate_normals=False,
                           remove_empty_areas=args.remove_empty_areas,
                           speedups=not args.disable_speedups)
    stl_file.save(name, args.outfile, mode=stl.ASCII,
                  update_normals=not args.use_file_normals)


def to_binary():
    parser = _get_parser('Convert STL files to ASCII (text) format')
    args = parser.parse_args()
    name = _get_name(args)
    stl_file = stl.StlMesh(filename=name, fh=args.infile,
                           calculate_normals=False,
                           remove_empty_areas=args.remove_empty_areas,
                           speedups=not args.disable_speedups)
    stl_file.save(name, args.outfile, mode=stl.BINARY,
                  update_normals=not args.use_file_normals)