| 155 | self._call_location_id) |
| 156 | |
| 157 | def __init__(self, **kw): |
| 158 | assert ( |
| 159 | "user_global_ns" not in kw |
| 160 | ), "Key word argument `user_global_ns` has been replaced by `user_module` since IPython 4.0." |
| 161 | # temporary fix for https://github.com/ipython/ipython/issues/14164 |
| 162 | cls = type(self) |
| 163 | if cls._instance is None: |
| 164 | for subclass in cls._walk_mro(): |
| 165 | subclass._instance = self |
| 166 | cls._instance = self |
| 167 | |
| 168 | clid = kw.pop('_init_location_id', None) |
| 169 | if not clid: |
| 170 | frame = sys._getframe(1) |
| 171 | clid = '%s:%s' % (frame.f_code.co_filename, frame.f_lineno) |
| 172 | self._init_location_id = clid |
| 173 | |
| 174 | super(InteractiveShellEmbed,self).__init__(**kw) |
| 175 | |
| 176 | # don't use the ipython crash handler so that user exceptions aren't |
| 177 | # trapped |
| 178 | sys.excepthook = ultratb.FormattedTB( |
| 179 | theme_name=self.colors, |
| 180 | mode=self.xmode, |
| 181 | call_pdb=self.pdb, |
| 182 | ) |
| 183 | |
| 184 | def init_sys_modules(self): |
| 185 | """ |