This file is indexed.

/usr/share/pyshared/ase/tasks/main.py is in python-ase 3.6.0.2515-1.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
88
89
90
91
92
93
94
95
96
97
import os
import sys
import tempfile
import textwrap
import traceback

from ase.tasks.task import Task
from ase.tasks.bulk import BulkTask
from ase.tasks.molecule import MoleculeTask
from ase.tasks.calcfactory import calcnames


usage = """\
Usage: ase [calculator] [task] [options] system(s)

%s
task:       'molecule', 'bulk' or the name of Python script that instantiates
            a Task object.  Default value is 'molecule'.
systems:    chemical formulas or filenames of files containing the atomic
            structure.

Try "ase molecule --help" or "ase bulk --help".
"""


def run(args=sys.argv[1:], calcname='emt'):

    if isinstance(args, str):
        args = args.split(' ')

    argsoriginal = args[:]

    if len(args) > 0 and args[0] in calcnames:
        calcname = args.pop(0)

    taskname = 'molecule'
    if (len(args) > 0 and
        (args[0] in ['molecule', 'bulk'] or args[0].endswith('.py'))):
        taskname = args.pop(0)

    if len(args) == 0:
        sys.stderr.write(
            usage % textwrap.fill(', '.join(calcnames[:-1]) +
                                  ' or ' + calcnames[-1] +
                                  '.  Default value is emt.',
                                  initial_indent='calculator: ',
                                  subsequent_indent=' ' * 12))
        return
    
    if taskname.endswith('.py'):
        locals = {}
        execfile(taskname, locals, locals)
        tasks = [task for task in locals.values() if isinstance(task, Task)]
        assert len(tasks) == 1
        task = tasks[0]
    elif taskname == 'bulk':
        task = BulkTask()
    else:
        task = MoleculeTask()

    task.set_calculator_factory(calcname)

    args = task.parse_args(args)

    if task.interactive_python_session:
        if '-i' in argsoriginal:
            argsoriginal.remove('-i')
        if '--interactive-python-session' in argsoriginal:
            argsoriginal.remove('--interactive-python-session')
        file = tempfile.NamedTemporaryFile()
        file.write('import os\n')
        file.write('if "PYTHONSTARTUP" in os.environ:\n')
        file.write('    execfile(os.environ["PYTHONSTARTUP"])\n')
        file.write('from ase.tasks.main import run\n')
        file.write('atoms, task = run(%r, %r)\n' % (argsoriginal, calcname))
        file.flush()
        os.system('python -i %s' % file.name)
        return

    atoms = task.run(args)

    return atoms, task


def main():
    try:
        run()
    except (KeyboardInterrupt, SystemExit):
        raise
    except Exception:
        traceback.print_exc()
        sys.stderr.write("""
An exception occurred!  Please report the issue to
ase-developer@listserv.fysik.dtu.dk - thanks!  Please also report this
if it was a user error, so that a better error message can be provided
next time.""")
        raise