1 | #!/usr/bin/env python |
---|
2 | import os |
---|
3 | |
---|
4 | def _main010(): |
---|
5 | from IPython.Shell import IPShellEmbed |
---|
6 | |
---|
7 | banner = welcome() |
---|
8 | exit_msg = '' |
---|
9 | args = ['-colors','Linux','-noconfirm_exit', '-readline', |
---|
10 | '-xmode', 'Plain', '-autocall', '2', '-autoindent', |
---|
11 | '-pi1', 'ASAP> ', '-po', 'asap>: ', '-pprint'] |
---|
12 | ipshell = IPShellEmbed(args,banner,exit_msg) |
---|
13 | return ipshell |
---|
14 | |
---|
15 | |
---|
16 | def _main011(): |
---|
17 | from IPython.config.loader import Config |
---|
18 | cfg = Config() |
---|
19 | prompt_config = cfg.PromptManager |
---|
20 | prompt_config.in_template = 'ASAP> ' |
---|
21 | prompt_config.out_template = 'asap>: ' |
---|
22 | cfg.InteractiveShell.autoindent = True |
---|
23 | cfg.InteractiveShell.autocall = 2 |
---|
24 | cfg.InteractiveShell.magic_pprint = True |
---|
25 | cfg.InteractiveShell.use_readline=True |
---|
26 | cfg.InteractiveShell.confirm_exit=False |
---|
27 | cfg.InteractiveShell.xmode='Plain' |
---|
28 | try: |
---|
29 | from IPython.terminal.embed import InteractiveShellEmbed |
---|
30 | except ImportError: |
---|
31 | from IPython.frontend.terminal.embed import InteractiveShellEmbed |
---|
32 | ipshell = InteractiveShellEmbed(config=cfg, |
---|
33 | banner1 = welcome(), |
---|
34 | exit_msg = '') |
---|
35 | return ipshell |
---|
36 | |
---|
37 | try: |
---|
38 | os.system('clear') |
---|
39 | import IPython |
---|
40 | from asap import * |
---|
41 | vitems = IPython.__version__.split(".") |
---|
42 | vmaj = int(vitems[0]) |
---|
43 | vmin = int(vitems[1]) |
---|
44 | if vmaj == 0: |
---|
45 | if vmin >= 11: |
---|
46 | ipshell = _main011() |
---|
47 | else: |
---|
48 | ipshell = _main010() |
---|
49 | else: |
---|
50 | ipshell = _main011() |
---|
51 | ipshell() |
---|
52 | |
---|
53 | except ImportError: |
---|
54 | banner = "No ipython found. Running standard python" |
---|
55 | import code |
---|
56 | from asap import * |
---|
57 | code.interact(banner, local=locals()) |
---|