This file is indexed.

/usr/bin/isympy is in python-sympy 0.7.1.rc1-2.

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

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
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
#!/usr/bin/python

"""Python shell for SymPy.

   This is just a normal Python shell (IPython shell if you have the
   IPython package installed),  that executes the following commands
   for the user:

       >>> from __future__ import division
       >>> from sympy import *
       >>> x, y, z, t = symbols('x y z t')
       >>> k, m, n = symbols('k m n', integer=True)
       >>> f, g, h = symbols('f g h', cls=Function)

   So starting 'isympy' is equivalent to starting Python (or IPython)
   and executing the above commands by hand.  It is intended for easy
   and quick experimentation with SymPy.

   COMMAND LINE OPTIONS
   --------------------

   -c CONSOLE, --console=CONSOLE

     Use the specified Python or IPython shell as console backend instead
     of the default one (IPython if present or Python otherwise), e.g.:

        isympy -c python

   -p PRETTY, --pretty PRETTY

     Setup pretty printing in SymPy. By default the most pretty,  Unicode
     printing is enabled. User can use less pretty ASCII printing instead
     or no pretty printing at all, e.g.:

   -q, --quiet

     Print only Python's and SymPy's versions to stdout at startup.

   -- IPython's options

     Additionally you can pass command line options directly to IPython
     interpreter (standard Python shell is not supported).  However you
     need to add '--' separator between two types of options. To run
     SymPy without startup banner and colors, for example, issue:

        isympy -q -- -colors NoColor

"""

import os, sys

# hook in-tree SymPy into Python path, if possible

isympy_dir = os.path.dirname(__file__)         # bin/isympy
sympy_top  = os.path.split(isympy_dir)[0]      # ../
sympy_dir  = os.path.join(sympy_top, 'sympy')  # ../sympy/

if os.path.isdir(sympy_dir):
    sys.path.insert(0, sympy_top)

def main():
    from optparse import OptionParser

    usage = 'usage: isympy [options] -- [ipython options]'
    parser = OptionParser(usage)

    parser.add_option(
        '-c', '--console',
        dest='console',
        action='store',
        default=None,
        choices=['ipython', 'python'],
        help='select type of interactive session: ipython | python')

    parser.add_option(
        '-p', '--pretty',
        dest='pretty',
        action='store',
        default=None,
        choices=['unicode', 'ascii', 'no'],
        help='setup pretty printing: unicode | ascii | no')

    parser.add_option(
        '-t', '--types',
        dest='types',
        action='store',
        default=None,
        choices=['gmpy', 'python', 'sympy'],
        help='setup ground types: gmpy | python | sympy')

    parser.add_option(
        '-o', '--order',
        dest='order',
        action='store',
        default=None,
        choices=['lex', 'grlex', 'grevlex', 'rev-lex', 'rev-grlex', 'rev-grevlex', 'old'],
        help='setup ordering of terms: [rev-]lex | [rev-]grlex | [rev-]grevlex | old')

    parser.add_option(
        '-q', '--quiet',
        dest='quiet',
        action='store_true',
        default=False,
        help='print only version information at startup')

    parser.add_option(
        '-d', '--doctest',
        dest='doctest',
        action='store_true',
        default=False,
        help='use the doctest format for output (you can just copy and paste it)')

    parser.add_option(
        '-C', '--no-cache',
        dest='cache',
        action='store_false',
        default=True,
        help='disable caching mechanism')

    (options, ipy_args) = parser.parse_args()

    if not options.cache:
        os.environ['SYMPY_USE_CACHE'] = 'no'

    if options.types:
        os.environ['SYMPY_GROUND_TYPES'] = options.types

    if options.doctest:
        options.pretty = 'no'
        options.console = 'python'

    session = options.console

    if session is not None:
        ipython = session == 'ipython'
    else:
        ipython = None

    args = {
        'pretty_print' : True,
        'use_unicode'  : None,
        'order'        : None,
        'argv'         : ipy_args,
    }

    if options.pretty == 'unicode':
        args['use_unicode'] = True
    elif options.pretty == 'ascii':
        args['use_unicode'] = False
    elif options.pretty == 'no':
        args['pretty_print'] = False

    if options.order is not None:
        args['order'] = options.order

    args['quiet'] = options.quiet

    from sympy.interactive import init_session
    init_session(ipython, **args)

if __name__ == "__main__":
    main()