From edc7fe114d43cd3fc709e0f9c93a39a1e1f80622 Mon Sep 17 00:00:00 2001 From: linlin Date: Sun, 4 Oct 2020 19:16:38 +0200 Subject: [PATCH] New translations isNotebook.py (French) --- lang/fr/gklearn/utils/isNotebook.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 lang/fr/gklearn/utils/isNotebook.py diff --git a/lang/fr/gklearn/utils/isNotebook.py b/lang/fr/gklearn/utils/isNotebook.py new file mode 100644 index 0000000..0491a36 --- /dev/null +++ b/lang/fr/gklearn/utils/isNotebook.py @@ -0,0 +1,16 @@ +""" Functions for python system. +""" + +def isNotebook(): + """check if code is executed in the IPython notebook. + """ + try: + shell = get_ipython().__class__.__name__ + if shell == 'ZMQInteractiveShell': + return True # Jupyter notebook or qtconsole + elif shell == 'TerminalInteractiveShell': + return False # Terminal running IPython + else: + return False # Other type (?) + except NameError: + return False # Probably standard Python interpreter \ No newline at end of file