Show More
@@ -634,7 +634,7 b' class MatplotlibMTShell(MatplotlibShellBase,MTInteractiveShell):' | |||
|
634 | 634 | |
|
635 | 635 | def __init__(self,name,usage=None,rc=Struct(opts=None,args=None), |
|
636 | 636 | user_ns=None,user_global_ns=None, **kw): |
|
637 | user_ns,b2 = self._matplotlib_config(name,user_ns) | |
|
637 | user_ns,user_global_ns,b2 = self._matplotlib_config(name,user_ns,user_global_ns) | |
|
638 | 638 | MTInteractiveShell.__init__(self,name,usage,rc,user_ns,user_global_ns, |
|
639 | 639 | banner2=b2,**kw) |
|
640 | 640 |
@@ -58,14 +58,22 b' class PrefilterFrontEnd(LineFrontEndBase):' | |||
|
58 | 58 | completion... |
|
59 | 59 | """ |
|
60 | 60 | |
|
61 | def __init__(self, *args, **kwargs): | |
|
61 | def __init__(self, ipython0=None, *args, **kwargs): | |
|
62 | """ Parameters: | |
|
63 | ----------- | |
|
64 | ||
|
65 | ipython0: an optional ipython0 instance to use for command | |
|
66 | prefiltering and completion. | |
|
67 | """ | |
|
62 | 68 | self.save_output_hooks() |
|
63 | # Instanciate an IPython0 interpreter to be able to use the | |
|
64 | # prefiltering. | |
|
65 | self.ipython0 = make_IPython() | |
|
69 | if ipython0 is None: | |
|
70 | # Instanciate an IPython0 interpreter to be able to use the | |
|
71 | # prefiltering. | |
|
72 | ipython0 = make_IPython() | |
|
73 | self.ipython0 = ipython0 | |
|
66 | 74 | # Set the pager: |
|
67 | 75 | self.ipython0.set_hook('show_in_pager', |
|
68 | lambda s, string: self.write("\n"+string)) | |
|
76 | lambda s, string: self.write("\n" + string)) | |
|
69 | 77 | self.ipython0.write = self.write |
|
70 | 78 | self._ip = _ip = IPApi(self.ipython0) |
|
71 | 79 | # Make sure the raw system call doesn't get called, as we don't |
@@ -16,6 +16,7 b' from IPython.frontend.prefilterfrontend import PrefilterFrontEnd' | |||
|
16 | 16 | from cStringIO import StringIO |
|
17 | 17 | import string |
|
18 | 18 | import sys |
|
19 | from IPython.ipapi import get as get_ipython0 | |
|
19 | 20 | |
|
20 | 21 | class TestPrefilterFrontEnd(PrefilterFrontEnd): |
|
21 | 22 | |
@@ -23,8 +24,9 b' class TestPrefilterFrontEnd(PrefilterFrontEnd):' | |||
|
23 | 24 | output_prompt_template = string.Template('') |
|
24 | 25 | |
|
25 | 26 | def __init__(self): |
|
27 | ipython0 = get_ipython0() | |
|
26 | 28 | self.out = StringIO() |
|
27 | PrefilterFrontEnd.__init__(self) | |
|
29 | PrefilterFrontEnd.__init__(self, ipython0=ipython0) | |
|
28 | 30 | |
|
29 | 31 | def write(self, string): |
|
30 | 32 | self.out.write(string) |
@@ -565,6 +565,19 b' def make_user_ns(user_ns = None):' | |||
|
565 | 565 | This builds a dict with the minimal information needed to operate as a |
|
566 | 566 | valid IPython user namespace, which you can pass to the various embedding |
|
567 | 567 | classes in ipython. |
|
568 | ||
|
569 | This API is currently deprecated. Use ipapi.make_user_namespaces() instead | |
|
570 | to make both the local and global namespace objects simultaneously. | |
|
571 | ||
|
572 | :Parameters: | |
|
573 | user_ns : dict-like, optional | |
|
574 | The current user namespace. The items in this namespace should be | |
|
575 | included in the output. If None, an appropriate blank namespace | |
|
576 | should be created. | |
|
577 | ||
|
578 | :Returns: | |
|
579 | A dictionary-like object to be used as the local namespace of the | |
|
580 | interpreter. | |
|
568 | 581 | """ |
|
569 | 582 | |
|
570 | 583 | raise NotImplementedError |
@@ -575,7 +588,20 b' def make_user_global_ns(ns = None):' | |||
|
575 | 588 | |
|
576 | 589 | Similar to make_user_ns(), but global namespaces are really only needed in |
|
577 | 590 | embedded applications, where there is a distinction between the user's |
|
578 |
interactive namespace and the global one where ipython is running. |
|
|
591 | interactive namespace and the global one where ipython is running. | |
|
592 | ||
|
593 | This API is currently deprecated. Use ipapi.make_user_namespaces() instead | |
|
594 | to make both the local and global namespace objects simultaneously. | |
|
595 | ||
|
596 | :Parameters: | |
|
597 | ns : dict, optional | |
|
598 | The current user global namespace. The items in this namespace | |
|
599 | should be included in the output. If None, an appropriate blank | |
|
600 | namespace should be created. | |
|
601 | ||
|
602 | :Returns: | |
|
603 | A true dict to be used as the global namespace of the interpreter. | |
|
604 | """ | |
|
579 | 605 | |
|
580 | 606 | raise NotImplementedError |
|
581 | 607 | |
@@ -599,6 +625,20 b' def make_user_namespaces(user_ns = None,user_global_ns = None):' | |||
|
599 | 625 | namespace synchronize with the globals dict somehow. |
|
600 | 626 | |
|
601 | 627 | Raises TypeError if the provided globals namespace is not a true dict. |
|
628 | ||
|
629 | :Parameters: | |
|
630 | user_ns : dict-like, optional | |
|
631 | The current user namespace. The items in this namespace should be | |
|
632 | included in the output. If None, an appropriate blank namespace | |
|
633 | should be created. | |
|
634 | user_global_ns : dict, optional | |
|
635 | The current user global namespace. The items in this namespace | |
|
636 | should be included in the output. If None, an appropriate blank | |
|
637 | namespace should be created. | |
|
638 | ||
|
639 | :Returns: | |
|
640 | A tuple pair of dictionary-like object to be used as the local namespace | |
|
641 | of the interpreter and a dict to be used as the global namespace. | |
|
602 | 642 | """ |
|
603 | 643 | |
|
604 | 644 | if user_ns is None: |
General Comments 0
You need to be logged in to leave comments.
Login now