mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Add some common modules into the interactive shell names by default
This commit is contained in:
parent
26e53b3f1b
commit
6e3bea5050
@ -7,7 +7,7 @@ __license__ = 'GPL v3'
|
|||||||
__copyright__ = '2012, Kovid Goyal <kovid@kovidgoyal.net>'
|
__copyright__ = '2012, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||||
__docformat__ = 'restructuredtext en'
|
__docformat__ = 'restructuredtext en'
|
||||||
|
|
||||||
import os
|
import os, re, sys
|
||||||
from calibre.constants import iswindows, cache_dir, get_version
|
from calibre.constants import iswindows, cache_dir, get_version
|
||||||
|
|
||||||
ipydir = os.path.join(cache_dir(), 'ipython')
|
ipydir = os.path.join(cache_dir(), 'ipython')
|
||||||
@ -164,8 +164,12 @@ def ipython(user_ns=None):
|
|||||||
from IPython.config.loader import Config
|
from IPython.config.loader import Config
|
||||||
except ImportError:
|
except ImportError:
|
||||||
return simple_repl(user_ns=user_ns)
|
return simple_repl(user_ns=user_ns)
|
||||||
|
defns = {'os':os, 're':re, 'sys':sys}
|
||||||
if not user_ns:
|
if not user_ns:
|
||||||
user_ns = {}
|
user_ns = defns
|
||||||
|
else:
|
||||||
|
user_ns = defns.updatu(user_ns)
|
||||||
|
|
||||||
c = Config()
|
c = Config()
|
||||||
c.InteractiveShellApp.exec_lines = [
|
c.InteractiveShellApp.exec_lines = [
|
||||||
'from __future__ import division, absolute_import, unicode_literals, print_function',
|
'from __future__ import division, absolute_import, unicode_literals, print_function',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user