ipython / ipython/ipykernel

Embedding Example Bug?

オープン
#440 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
734
フォーク
412
平均マージ
1日 5時間
マージ済み PR(30日)
8

説明

https://github.com/ipython/ipykernel/blob/master/examples/embedding/internal_ipkernel.py
```python
class InternalIPKernel(object):

def init_ipkernel(self, backend):
# Start IPython kernel with GUI event loop and mpl support
self.ipkernel = mpl_kernel(backend)
# To create and track active qt consoles
self.consoles = []

# This application will also act on the shell user namespace
self.namespace = self.ipkernel.shell.user_ns

# Example: a variable that will be seen by the user in the shell, and
# that the GUI modifies (the 'Counter++' button increments it):
self.namespace['app_counter'] = 0
#self.namespace['ipkernel'] = self.ipkernel # dbg

def print_namespace(self, evt=None):
print("\n***Variables in User namespace***")
for k, v in self.namespace.items():
if not k.startswith('_'):
print('%s -> %r' % (k, v))
sys.stdout.flush()

def new_qt_console(self, evt=None):
"""start a new qtconsole connected to our kernel"""
return connect_qtconsole(self.ipkernel.abs_connection_file, profile=self.ipkernel.profile)

def count(self, evt=None):
self.namespace['app_counter'] += 1

def cleanup_consoles(self, evt=None):
for c in self.consoles:
c.kill()
```
`self.consoles` is not appended anywhere in the class, so the cleanup will just be a no-op.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。