environment/lib/python2.7/site-packages/IPython/lib/irunner.py
def main():
    """Run as a command-line script."""

    parser = optparse.OptionParser(usage=MAIN_USAGE)
    newopt = parser.add_option
    newopt('--ipython',action='store_const',dest='mode',const='ipython',
           help='IPython interactive runner (default).')
    newopt('--python',action='store_const',dest='mode',const='python',
           help='Python interactive runner.')
    newopt('--sage',action='store_const',dest='mode',const='sage',
           help='SAGE interactive runner.')

    opts,args = parser.parse_args()
    runners = dict(ipython=IPythonRunner,
                   python=PythonRunner,
                   sage=SAGERunner)

    try:
        ext = os.path.splitext(args[0])[-1]
    except IndexError:
        ext = ''
    modes = {'.ipy':'ipython',
             '.py':'python',
             '.sage':'sage'}
    mode = modes.get(ext,"ipython")
    if opts.mode:
        mode = opts.mode
    runners[mode]().main(args)
def main():
    """Run as a command-line script."""

    parser = optparse.OptionParser(usage=MAIN_USAGE)
    newopt = parser.add_option
    newopt('--ipython',action='store_const',dest='mode',const='ipython',
           help='IPython interactive runner (default).')
    newopt('--python',action='store_const',dest='mode',const='python',
           help='Python interactive runner.')
    newopt('--sage',action='store_const',dest='mode',const='sage',
           help='SAGE interactive runner.')

    opts,args = parser.parse_args()
    runners = dict(ipython=IPythonRunner,
                   python=PythonRunner,
                   sage=SAGERunner)

    try:
        ext = os.path.splitext(args[0])[-1]
    except IndexError:
        ext = ''
    modes = {'.ipy':'ipython',
             '.py':'python',
             '.sage':'sage'}
    mode = modes.get(ext,"ipython")
    if opts.mode:
        mode = opts.mode
    runners[mode]().main(args)
def main ( ) : parser = optparse . OptionParser ( usage = MAIN_USAGE ) newopt = parser . add_option newopt ( '--ipython' , action = 'store_const' , dest = 'mode' , const = 'ipython' , help = 'IPython interactive runner (default).' ) newopt ( '--python' , action = 'store_const' , dest = 'mode' , const = 'python' , help = 'Python interactive runner.' ) newopt ( '--sage' , action = 'store_const' , dest = 'mode' , const = 'sage' , help = 'SAGE interactive runner.' ) opts , args = parser . parse_args ( ) runners = dict ( ipython = IPythonRunner , python = PythonRunner , sage = SAGERunner ) try : ext = os . path . splitext ( args [ 0 ] ) [ - 1 ] except IndexError : ext = '' modes = { '.ipy' : 'ipython' , '.py' : 'python' , '.sage' : 'sage' } mode = modes . get ( ext , "ipython" ) if opts . mode : mode = opts . mode runners [ mode ] ( ) . main ( args )
Run as a command-line script.
Run as a command - line script .