mirror of https://github.com/scrapy/scrapy.git
add support for embeded ptpython shell
This commit is contained in:
parent
4e4395f16f
commit
7ba4b0a21b
|
|
@ -31,6 +31,15 @@ def _embed_bpython_shell(namespace={}, banner=''):
|
|||
bpython.embed(locals_=namespace, banner=banner)
|
||||
return wrapper
|
||||
|
||||
def _embed_ptpython_shell(namespace={}, banner=''):
|
||||
"""Start a ptpython shell"""
|
||||
import ptpython.repl
|
||||
@wraps(_embed_ptpython_shell)
|
||||
def wrapper(namespace=namespace, banner=''):
|
||||
print(banner)
|
||||
ptpython.repl.embed(locals=namespace)
|
||||
return wrapper
|
||||
|
||||
def _embed_standard_shell(namespace={}, banner=''):
|
||||
"""Start a standard python shell"""
|
||||
import code
|
||||
|
|
@ -49,7 +58,8 @@ def _embed_standard_shell(namespace={}, banner=''):
|
|||
DEFAULT_PYTHON_SHELLS = OrderedDict([
|
||||
('ipython', _embed_ipython_shell),
|
||||
('bpython', _embed_bpython_shell),
|
||||
( 'python', _embed_standard_shell),
|
||||
('ptpython', _embed_ptpython_shell),
|
||||
('python', _embed_standard_shell),
|
||||
])
|
||||
|
||||
def get_shell_embed_func(shells=None, known_shells=None):
|
||||
|
|
|
|||
Loading…
Reference in New Issue