|
| 1 | +# Copyright (c) 2014, Paul Ivanov <[email protected]> |
| 2 | +# Distributed under the terms of the Modified BSD License. |
| 3 | +# The full license is in the LICENSE file distributed with this software. |
| 4 | +"""bipython: the boldly indiscriminate Python interpreter |
1 | 5 |
|
2 | | -# |
3 | | -# The MIT License |
4 | | -# |
5 | | -# Copyright (c) 2010-2011 Marien Zwart |
6 | | -# |
7 | | -# Permission is hereby granted, free of charge, to any person obtaining a copy |
8 | | -# of this software and associated documentation files (the "Software"), to deal |
9 | | -# in the Software without restriction, including without limitation the rights |
10 | | -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
11 | | -# copies of the Software, and to permit persons to whom the Software is |
12 | | -# furnished to do so, subject to the following conditions: |
13 | | -# |
14 | | -# The above copyright notice and this permission notice shall be included in |
15 | | -# all copies or substantial portions of the Software. |
16 | | -# |
17 | | -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
18 | | -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
19 | | -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
20 | | -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
21 | | -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
22 | | -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
23 | | -# THE SOFTWARE. |
24 | | - |
25 | | - |
26 | | -"""bpython backend based on Urwid. |
27 | | -
|
28 | | -Based on Urwid 0.9.9. |
29 | | -
|
30 | | -This steals many things from bpython's "cli" backend. |
31 | | -
|
32 | | -This is still *VERY* rough. |
| 6 | +based on bpython backend based on Urwid. |
| 7 | +
|
| 8 | +http://bipython.org |
33 | 9 | """ |
| 10 | +from __future__ import absolute_import, with_statement, division |
34 | 11 |
|
| 12 | +__author__ = 'Paul Ivanov ([email protected])' |
| 13 | +__copyright__ = 'Copyright (c) 2014 Paul Ivanov' |
| 14 | +__license__ = 'BSD' |
35 | 15 |
|
36 | | -from __future__ import absolute_import, with_statement, division |
37 | 16 |
|
38 | 17 | import sys |
39 | 18 | import os |
40 | | -import pydoc |
41 | 19 | import time |
42 | 20 | import locale |
43 | 21 | import signal |
44 | 22 | from types import ModuleType |
45 | 23 | from optparse import Option |
46 | | -from glob import glob |
47 | 24 |
|
48 | 25 | from pygments.token import Token |
49 | 26 |
|
50 | 27 | from bpython import args as bpargs, repl, translations |
51 | | -from bpython._py3compat import py3 |
52 | 28 | from bpython.formatter import theme_map |
53 | 29 | from bpython.importcompletion import find_coroutine |
54 | | -from bpython import importcompletion, inspection |
55 | 30 | from bpython.translations import _ |
56 | 31 |
|
57 | 32 | from bpython.keys import urwid_key_dispatch as key_dispatch |
|
62 | 37 | if not py3: |
63 | 38 | import inspect |
64 | 39 |
|
65 | | -from inspect import ArgSpec |
| 40 | +from inspect import ArgSpec # we eval an ArgSpec repr, see ipython_get_argspec |
66 | 41 |
|
67 | 42 | from Queue import Empty |
68 | 43 |
|
@@ -1267,7 +1242,7 @@ def ipython_get_argspec(self, func): |
1267 | 1242 | self.echod("got an error") |
1268 | 1243 | return None |
1269 | 1244 |
|
1270 | | - return eval(aspec['data']['text/plain']) |
| 1245 | + return eval(aspec['data']['text/plain']) # relies on ArgSpec |
1271 | 1246 |
|
1272 | 1247 |
|
1273 | 1248 | def ipython_complete(self, base, current_line, pos=None): |
|
0 commit comments